feat(model): add Proposal.original for F12 optimistic-apply revert (#64)

This commit is contained in:
BenStullsBets
2026-06-26 06:15:36 -07:00
parent 56cc9eb6ad
commit bea9fd5148
2 changed files with 25 additions and 1 deletions
+15 -1
View File
@@ -1,4 +1,5 @@
import { describe, it, expect } from "vitest";
import assert from "node:assert";
import { describe, it, test, expect } from "vitest";
import {
SCHEMA_VERSION,
emptyArtifact,
@@ -179,6 +180,19 @@ describe("unknown-field preservation (F5 SLICE-2, INV-15)", () => {
});
});
test("serializeArtifact round-trips Proposal.original", () => {
const a = emptyArtifact("doc.md");
a.anchors["a_1"] = { fingerprint: { text: "new", before: "", after: "", lineHint: 0 } };
a.proposals.push({
id: "pr_1", anchorId: "a_1", replacement: "new",
author: { kind: "agent", id: "claude", agent: { sdk: "@cline/sdk", model: "sonnet", sessionId: "s" } },
createdAt: "2026-06-26T00:00:00.000Z", original: "old", granularity: "block",
});
const json = serializeArtifact(a);
assert.match(json, /"original": "old"/);
assert.match(json, /"granularity": "block"/);
});
describe("attributions[] (F3 SLICE-1)", () => {
it("round-trips an attribution record through serialize → parse", () => {
const a = emptyArtifact("docs/x.md");