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 40 to 318

Compare

+35 −0 in 1 place
new file, 35 lines
1+import assert from "node:assert/strict";
2+import { createHash } from "node:crypto";
3+import { test } from "node:test";
4+import { logParts, SqliteLog } from "../src/engine-project.ts";
5+import { writerFrameChunksDigest, writerFrameDigest } from "../src/writer-host.ts";
6+import { memoryStorage } from "./helpers.ts";
7+
8+test("canonical chunks stream oversized frames and reject missing parts", (t) => {
9+ const storage = memoryStorage();
10+ t.after(() => storage.db.close());
11+ const log = new SqliteLog(storage);
12+ const json = JSON.stringify({ value: "x".repeat(8_100_000) });
13+ for (const [part, text] of logParts(json).entries())
14+ storage.sql.exec("INSERT INTO log (seq,part,text) VALUES (?, ?, ?)", 0, part, text);
15+ assert.equal(writerFrameChunksDigest("", 0, log.frameChunks(0)), writerFrameDigest("", 0, json));
16+ storage.sql.exec("DELETE FROM log WHERE seq = 0 AND part = 1");
17+ assert.throws(() => {
18+ for (const _ of log.frameChunks(0)) {
19+ }
20+ }, /incomplete/);
21+ assert.throws(() => log.frameChunks(1).next(), /missing/);
22+});
23+test("chunked writer digests preserve Unicode across every split", () => {
24+ const text = '{"value":"a\u{1f600}b\u{1d11e}c"}'.replace(/\\u\{([0-9a-f]+)\}/g, (_, hex) =>
25+ String.fromCodePoint(Number.parseInt(hex, 16)),
26+ );
27+ const reference = createHash("sha256")
28+ .update("abso-writer-log-v1\n")
29+ .update(JSON.stringify(["prior", 7]))
30+ .update("\n")
31+ .update(text, "utf8")
32+ .digest("hex");
33+ for (let at = 0; at <= text.length; at++)
34+ assert.equal(writerFrameChunksDigest("prior", 7, [text.slice(0, at), "", text.slice(at)]), reference);
35+});
MCP
compare on this site's /mcp
CLI
abso diff 40 318 server/test/frame-chunks.test.ts --json
JSON
/christopher/abso-core/compare/40..318?file=server%2Ftest%2Fframe-chunks.test.ts&format=json