feat: hashline improvements for spark
- Redesigned hashline patch syntax from anchor-based (`A-B:`) to hunk-header format (`@@ A..B @@`) with unified-diff compatibility. - Removed `autoDropPureInsertDuplicates` option and simplified apply behavior to preserve duplicated boundary and context lines. - Changed repeat operator from `^A-B` to `&A..B` and range separator from `-` to `..` for consistency with hunk-header syntax. - Added image resizing and dimension notes to eval tool output; improved write tool hashline header sanitation for legacy formats. - Removed 521 lines of boundary-duplicate absorption code and simplified parser to auto-convert bare body rows and unified-diff contamination.
This commit is contained in:
@@ -236,12 +236,12 @@ describe("computeHashlineDiff", () => {
|
||||
const line = "unchanged content";
|
||||
await Bun.write(sourcePath, `${line}\n`);
|
||||
|
||||
// `1-1:` with the same line in the replace bucket is a true no-op: the edit
|
||||
// `1 1` with the same line in the body is a true no-op: the edit
|
||||
// fires through computeHashlineDiff but produces identical content.
|
||||
const text = `${line}\n`;
|
||||
const snapshotStore = new InMemorySnapshotStore();
|
||||
const tag = snapshotStore.recordContiguous(sourcePath, 1, text.split("\n"), { fullText: text });
|
||||
const input = `${formatHashlineHeader(sourcePath, tag)}\n1-1:\n|${line}\n`;
|
||||
const input = `${formatHashlineHeader(sourcePath, tag)}\n1 1\n+${line}\n`;
|
||||
const result = await computeHashlineDiff({ input }, tempDir, snapshotStore);
|
||||
expect("error" in result).toBe(true);
|
||||
if ("error" in result) {
|
||||
@@ -254,7 +254,7 @@ describe("computeHashlineDiff", () => {
|
||||
await Bun.write(sourcePath, "first\n");
|
||||
|
||||
const result = await computeHashlineDiff(
|
||||
{ input: `¶${sourcePath}\nEOF:\n|second` },
|
||||
{ input: `¶${sourcePath}\nEOF\n+second` },
|
||||
tempDir,
|
||||
new InMemorySnapshotStore(),
|
||||
);
|
||||
@@ -265,7 +265,7 @@ describe("computeHashlineDiff", () => {
|
||||
});
|
||||
test("returns a handled error when the source path is a local URL", async () => {
|
||||
const result = await computeHashlineDiff(
|
||||
{ input: "¶local://PLAN.md\nEOF:\n|x" },
|
||||
{ input: "¶local://PLAN.md\nEOF\n+x" },
|
||||
tempDir,
|
||||
new InMemorySnapshotStore(),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user