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 161 to 162

Compare

+35 −0 in 1 place
new file, 35 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { StoredJson, storeJson } from "../src/stored-json.ts";
4+import { storedJsonView } from "../src/stored-json-view.ts";
5+import { SqliteWriterState } from "../src/writer-host.ts";
6+import { memoryStorage } from "./helpers.ts";
7+
8+test("stored JSON views expose array operations without decoding unrelated payloads", (t) => {
9+ const database = memoryStorage();
10+ t.after(() => database.db.close());
11+ SqliteWriterState.initialize(database);
12+ const state = new SqliteWriterState(database, "view");
13+ const input = { type: "draft", atom: { deps: ["a0", "a1"], message: "x".repeat(50000) } };
14+ storeJson(state, "entry", [JSON.stringify(input)]);
15+ const read = state.read.bind(state);
16+ let chunks = 0;
17+ state.read = (collection, key) => {
18+ if (collection.endsWith(":text:chunks")) chunks++;
19+ return read(collection, key);
20+ };
21+ const value = storedJsonView(new StoredJson(state, "entry")) as typeof input;
22+ assert.equal(chunks, 0);
23+ assert.equal(value.atom.deps.length, 2);
24+ assert.equal(chunks, 0);
25+ assert.deepEqual(
26+ value.atom.deps.map((x) => x),
27+ ["a0", "a1"],
28+ );
29+ assert.equal(chunks, 2);
30+ assert.equal("message" in value.atom, true);
31+ assert.throws(() => {
32+ value.atom.deps[0] = "changed";
33+ }, /read-only/);
34+ assert.deepEqual(JSON.parse(JSON.stringify(value)), input);
35+});
MCP
compare on this site's /mcp
CLI
abso diff 161 162 server/test/stored-json-view.test.ts --json
JSON
/christopher/abso-core/compare/161..162?file=server%2Ftest%2Fstored-json-view.test.ts&format=json