fix(hashline): accept legacy hashes for indented anchors
Keep persisted LINE#ID anchors working after strict whitespace hashing by falling back to the legacy hash for validation-only lookups. Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { describe, it, expect } from "bun:test"
|
||||
import {
|
||||
computeLineHash,
|
||||
computeLegacyLineHash,
|
||||
formatHashLine,
|
||||
formatHashLines,
|
||||
streamHashLinesFromLines,
|
||||
@@ -58,6 +59,19 @@ describe("computeLineHash", () => {
|
||||
expect(hash1).not.toBe(hash2)
|
||||
})
|
||||
|
||||
it("preserves legacy hashes for leading indentation variants", () => {
|
||||
//#given
|
||||
const content1 = "function hello() {"
|
||||
const content2 = " function hello() {"
|
||||
|
||||
//#when
|
||||
const hash1 = computeLegacyLineHash(1, content1)
|
||||
const hash2 = computeLegacyLineHash(1, content2)
|
||||
|
||||
//#then
|
||||
expect(hash1).toBe(hash2)
|
||||
})
|
||||
|
||||
it("ignores trailing whitespace differences", () => {
|
||||
//#given
|
||||
const content1 = "function hello() {"
|
||||
|
||||
Reference in New Issue
Block a user