Repository navigation
test(explore): the cross-call dedup test passes with LF and CRLF checkouts alike - #2772
Merged
Merged
Conversation
…kouts alike explore-cross-call-dedup's "never re-sends a line it already sent" case has failed on every LF checkout (Linux, macOS, CI) since PR #2655. It passed on Windows only because core.autocrlf writes the fixture with CRLF. Root cause. Since PR #2655 the payroll fixture's RunResult struct (cycle.go lines 31-37) references Payslip through a field, so call 1 renders it. Call 2 renders the file's head, and that 7-line held run comes back inside it: dedupeRange keeps a covered run shorter than MIN_COVERED_LINES (8) in the emit set on purpose, rule 3 of the range algebra, which its own unit test pins. The handler case counted any repeated line as a duplicate. On a CRLF checkout explore's per-file character budget also counts each line's carriage return, so cycle.go rendered fewer lines and the case never met the short run. Fix, test only: - The case groups the repeated lines into consecutive runs and fails on a run of MIN_COVERED_LINES lines or more, read from EXPLORE_DEDUP. A shorter run is the algebra's deliberate re-send. What agents receive is unchanged. - The suite gives its copy of the fixture LF line endings, so every checkout indexes and renders the same bytes. Validation on Windows, with the kernel and with CODEGRAPH_KERNEL=0: - main's test fails with an LF fixture ("call 2 re-sent internal/usecase/payroll/cycle.go lines 31,32,33,34,35") and passes with the CRLF one. The new test passes 26/26 with both. - With the normalisation and main's assertion, a CRLF checkout fails the way an LF one does (lines 31-37): both checkouts now test one scenario. - Teeth: an algebra mutated to re-send held runs of 8-23 lines fails the new case ("call 2 re-sent internal/usecase/payroll/cycle.go lines 42-51 (10 lines)"). - tsc on the test file is clean. Contributor PR #2758 by @danusha2345 reached the same diagnosis. This change was written separately and also normalises the fixture. Fixes #2756 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
__tests__/explore-cross-call-dedup.test.ts› "a second call against a real index › never re-sends a line it already sent, and points at every line it withholds" has failed on every LF checkout (Linux, macOS, CI) since #2655. It kept passing on Windows only becausecore.autocrlfwrites the fixture with CRLF. This makes the case's expectation match the range algebra's deliberate re-send of a short held run, and makes the suite index the same fixture bytes on every checkout. Test only: what agents receive doesn't change.Root cause
RunResultstruct (internal/usecase/payroll/cycle.golines 31-37) referencesPayslipthrough itsPayslips []payroll.Payslipfield, so call 1 renders it.dedupeRangekeeps a covered run shorter thanEXPLORE_DEDUP.MIN_COVERED_LINES(8) in the emit set on purpose: rule 3 of the algebra, "cut chunks, not slivers", pinned by the unit test "withholds nothing when the overlap is smaller than a chunk worth pointing at". The handler case counted any repeated line as a duplicate.\n, so on a CRLF checkout each line keeps its\rand the per-file character budget counts it. cycle.go then rendered fewer lines, and the case never met the short run. The suite tested a different scenario on each platform.Fix
EXPLORE_DEDUP.MIN_COVERED_LINESlines or more. The threshold is read from the module, so the two can't drift apart. A shorter run is the sanctioned re-send, beside the anti-abandonment restore the comment already named.beforeAllgives its copy of the fixture LF line endings (normalizeLineEndings, a byte-exact latin1 rewrite of\r\nonly), so every checkout indexes and renders the same bytes, and the other cases' thresholds (fresh > 20,savedChars > 1000, …) are measured on one scenario everywhere.Validation
Windows 11,
CODEGRAPH_KERNEL=0andCODEGRAPH_KERNEL_EXPECT=1, base 0abae11:call 2 re-sent internal/usecase/payroll/cycle.go lines 31,32,33,34,35(wasm and kernel)dedupeRangemutated to re-send held runs of 8-23 lines while longer ones still get pointers, the case fails:call 2 re-sent internal/usecase/payroll/cycle.go lines 42-51 (10 lines).tscwith the repo's strict options on the test file (temporary tsconfig extending the repo's): clean.CODEGRAPH_KERNEL_EXPECT=1 npx vitest run --maxWorkers=4 --minWorkers=1): 696 files passed, 6 skipped; 8,347 tests passed, 0 failed, 82 skipped; vitest exit 0.No CHANGELOG entry: this is a test-only change with nothing user-facing.
Fixes #2756
Notes
\ron CRLF files, and the\rthat ends each fenced line there, are product behaviour on Windows checkouts. That's outside this test fix.🤖 Generated with Claude Code