Uh oh!
There was an error while loading. Please reload this page.
test: make the source-anchor harness immune to CRLF checkouts - #206
Merged
Ryanmello07 merged 1 commit intoSep 1, 2026
Merged
Conversation
functionBody delimits a function with a bare "\n}\n". Git checks these files out with CRLF wherever core.autocrlf is on, which is the default on Windows and is set at system scope on at least one dev box here, so that delimiter matches nothing: ip_remote_multi_client.go has 0 occurrences of "\n}\n" on disk against 286 of the CRLF form. functionBody then fell through to returning the entire rest of the file with ok=true. The six anchors written as strings.Count failed loudly on that - which is how it was found, as six of nine unexplained root package failures. The other 84, written as strings.Contains, matched text from elsewhere in the file and passed vacuously. So on Windows the anchor net was not protecting anything, and these anchors exist precisely because seam wiring turned out to be deletable with zero behavioural failures. readSource now normalizes line endings, which fixes all 66 call sites across 15 test files at once, and functionBody reports false rather than silently widening to the whole file. Verified: 17 anchor tests, 0 failures after the change, so nothing was hiding behind the vacuous passes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011CTciuTefbzH5mEfKwP1Bk
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
Test-only. No production code.
readSource()inip_remote_multi_client_blackhole_test.goreads source files to anchor assertions against real code. On a checkout with CRLF line endings the anchors silently fail to match. Normalising line endings insidereadSource()repairs every call site at once rather than patching them individually.Also makes
functionBody()returnfalsewhen it cannot find the terminator, instead of silently widening to the rest of the file — a miss there previously produced an anchor that matched far more than intended, which is the failure mode most likely to make one of these tests pass for the wrong reason.Verification
Run on a branch cut from
main, not on a fork branch:go build ./...— exit 0go vet ./...— exit 0go test -run "TestBlackhole|SourceAnchor" -v .— 33 PASS, 0 FAILBecause the
functionBodychange tightens terminator handling, I also enumerated every test in the root package that calls it — 50 tests across 19 files, 66 call sites — and ran that explicit set: 50 PASS, 0 FAIL. No existing anchor relies on the old widening behaviour.🤖 Generated with Claude Code