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

Compare

+41 −0 in 1 place
new file, 41 lines
1+import assert from "node:assert/strict";
2+import { test } from "node:test";
3+import { buildAtom } from "../build.ts";
4+import { Graph } from "../graph.ts";
5+import { StoredText } from "../stored-text.ts";
6+import { diffChunkedLines } from "../text.ts";
7+import { View } from "../view.ts";
8+import { Repo } from "./helpers.ts";
9+import { SqlState } from "./storage-helper.ts";
11+test("stored line comparison and atom construction never assemble historical long text", (t) => {
12+ const storage = new SqlState();
13+ t.after(() => storage.db.close());
14+ const line = "x".repeat(100000) + "\ud800\udc00";
15+ const repo = Repo.init({ "f.txt": `${line}\nkeep\n` });
16+ const graph = new Graph({ storage });
17+ graph.add(repo.graph.atom("a0"));
18+ t.mock.method(StoredText.prototype, "read", () => {
19+ throw Error("whole stored text forbidden");
20+ });
21+ t.mock.method(graph, "textOf", () => {
22+ throw Error("whole line forbidden");
23+ });
24+ const chunks = [...graph.textChunks(0)];
25+ assert.equal(chunks.join(""), line);
26+ assert.ok(chunks.every((chunk) => chunk.length <= StoredText.chunkCharacters));
27+ const view = new View(graph, ["a0"]);
28+ assert.deepEqual(diffChunkedLines(view.lineChunks("f.txt"), [line, "changed"]), [
29+ { start: 1, end: 2, lines: ["changed"] },
30+ ]);
31+ assert.equal(
32+ buildAtom(view, {
33+ author: "writer",
34+ message: "change",
35+ edits: [{ file: "f.txt", start: 0, end: 1, lines: ["replacement"] }],
36+ }).deletes.length,
37+ 1,
38+ );
39+ assert.throws(() => [...graph.textChunks(-1)], /invalid line/);
40+ assert.throws(() => [...graph.textChunks(2)], /invalid line/);
41+});
MCP
compare on this site's /mcp
CLI
abso diff 116 318 src/engine/test/graph-line-chunks.test.ts --json
JSON
/christopher/abso-core/compare/116..318?file=src%2Fengine%2Ftest%2Fgraph-line-chunks.test.ts&format=json