fix(hashline-edit): address Cubic review issues - boundary echo, chunking dedup, empty stream alignment

- Fix single-line anchor-echo stripping to trigger empty-insert validation

- Fix trailing boundary-echo stripping for boundary-only payloads

- Extract shared chunking logic to hashline-chunk-formatter

- Align empty stream/iterable handling with formatHashLines

- Add regression tests for all fixes
This commit is contained in:
YeonGyu-Kim
2026-02-22 03:54:31 +09:00
parent 22b4f465ab
commit 7e68690c70
5 changed files with 112 additions and 84 deletions
@@ -116,4 +116,26 @@ describe("streamHashLinesFrom*", () => {
//#then
expect(result).toBe(formatHashLines(content))
})
it("matches formatHashLines for empty utf8 stream input", async () => {
//#given
const content = ""
//#when
const result = await collectStream(streamHashLinesFromUtf8(utf8Chunks(content, 1), { maxChunkLines: 1 }))
//#then
expect(result).toBe(formatHashLines(content))
})
it("matches formatHashLines for empty line iterable input", async () => {
//#given
const content = ""
//#when
const result = await collectStream(streamHashLinesFromLines([], { maxChunkLines: 1 }))
//#then
expect(result).toBe(formatHashLines(content))
})
})