Repository navigation
✅ test(sink/git): lock REL-06 ls-remote fail-safe (REL-06-FUP) - #188
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a targeted regression test to pin the REL-06 “fail-safe” behavior in the git CLI sink: when git ls-remote cannot reach the remote, syncCLIWorkdir must abort with an error (rather than incorrectly reporting synced or pushing a stranded local commit).
Changes:
- Introduces
TestSyncCLIWorkdir_abortsOnLsRemoteFailureto assert non-nil error propagation fromls-remotefailures. - Uses a
remote.origin.urlvsremote.origin.pushurlsplit to ensure the failure is isolated to the read/verification path while a push would still succeed in a regression. - Verifies the remote HEAD remains unchanged (no accidental delivery) when the sync aborts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.



Lane: REL-06-FUP (P2, test-only)
Locks the REL-06 git-sink fail-safe with the missing regression test the REL-06 reviewer flagged.
Background
REL-06 (PR #173) fixed a warm-mirror git sink that reported
Synced=truewhile a commit was stranded unpushed.syncCLIWorkdirnow checksremoteHasLocalHeadviagit ls-remoteand is FAIL-SAFE: on anls-remotefailure it ABORTS (returns a non-nil error) rather than reporting false-synced. That error path was guaranteed only by trivial error propagation and was not directly tested.What this adds
TestSyncCLIWorkdir_abortsOnLsRemoteFailureininternal/sink/git/export_ahead_test.go. Test-only; no production change.The harness commits a stranded snapshot (local ahead of remote, tree clean) and splits the origin's URLs so the failure is isolated to the read path:
remote.origin.url-> a nonexistent bare (git ls-remoteexits 128, so the read fails)remote.origin.pushurl-> the real bare (a push, if reached, would succeed)Asserts the fail-safe holds:
syncCLIWorkdirreturns a non-nil error wrapped from thegit ls-remotefailure.RED-meaningful
The url/pushurl split makes it discriminating. A regression that swallows the ls-remote error (returns not-synced instead of propagating) falls through and pushes to the valid pushurl, advancing the remote and returning nil. Demonstrated locally by temporarily changing
remoteHasLocalHeadtoreturn false, nilon ls-remote failure: the test fails onsyncCLIWorkdir() = nil, want ls-remote failure to abort. Reverted; production code is unchanged.Gate matrix (all green)
go build ./...- passgo vet ./...- passtask lint- 0 issues; arch-lint OKtask test- passtask verify- oktask coverage-internal/ coverage 86.6% (floor 85%)Hermetic: no network; local bare repos and a nonexistent file:// path only.