Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 144 to 145

Compare

+42 −0 in 1 place
Lines 5–52 at 145 (were 5–10 at 144)
55import { lines, Repo } from "./helpers.ts";
66import { SqlState } from "./storage-helper.ts";
77
8+test("counter writes avoid rereads while respecting failed writes, rollback and cache bounds", () => {
9+ const source = new SqlState();
10+ try {
11+ const cache = new CachedStateStorage(source, 512, 2);
12+ const before = source.reads;
13+ for (let n = 0; n < 100; n++) {
14+ cache.write("counter", "next", n);
15+ assert.equal(cache.read("counter", "next"), n);
16+ assert.ok(cache.retainedBytes <= 512);
17+ assert.ok(cache.retainedEntries <= 2);
18+ }
19+ assert.equal(source.reads, before);
20+ source.failWrite = source.writes + 1;
21+ assert.throws(() => cache.write("counter", "next", 100), /injected/);
22+ assert.equal(cache.read("counter", "next"), 99);
23+ source.failWrite = Infinity;
24+ assert.throws(
25+ () =>
26+ cache.transaction(() => {
27+ cache.write("counter", "next", 101);
28+ assert.equal(cache.read("counter", "next"), 101);
29+ throw Error("counter rollback");
30+ }),
31+ /counter rollback/,
32+ );
33+ assert.equal(cache.retainedEntries, 0);
34+ assert.equal(cache.read("counter", "next"), 99);
35+ for (let n = 0; n < 20; n++) cache.write("counter", String(n), n);
36+ assert.ok(cache.retainedBytes <= 512);
37+ assert.ok(cache.retainedEntries <= 2);
38+ assert.equal(cache.read("counter", "0"), 0);
39+ const disabled = new CachedStateStorage(source, 0, 0);
40+ disabled.write("counter", "next", 102);
41+ assert.equal(disabled.retainedEntries, 0);
42+ assert.equal(disabled.read("counter", "next"), 102);
43+ cache.write("counter", "negative-zero", -0);
44+ assert.equal(Object.is(cache.read("counter", "negative-zero"), source.read("counter", "negative-zero")), true);
45+ } finally {
46+ source.db.close();
47+ }
48+});
850test("current visibility stops at the first included deletion while history retains every deleter", () => {
951 class ObservedStorage extends SqlState {
1052 pageReads = 0;
MCP
compare on this site's /mcp
CLI
abso diff 144 145 src/engine/test/state-source.test.ts --json
JSON
/christopher/abso-core/compare/144..145?file=src%2Fengine%2Ftest%2Fstate-source.test.ts&format=json