Repository navigation
🐛 fix(sink/git): push stranded commit so warm-mirror can't report Synced=true unpushed (REL-06) - #173
Merged
Merged
Conversation
…-mirror can't report Synced=true with an unpushed commit (REL-06)
There was a problem hiding this comment.
Pull request overview
Fixes REL-06 in the git CLI export path by ensuring “Synced=true” is only reported when the remote actually contains the local HEAD, preventing silent non-delivery when a warm mirror has a committed-but-unpushed snapshot.
Changes:
- Refactors CLI export syncing into
syncCLIWorkdir, adding a remote-vs-local HEAD check on clean trees and pushing stranded commits when needed. - Introduces
remoteHasLocalHead(viagit ls-remote+rev-parse) to validate remote state fail-safe before skipping push. - Adds TDD coverage for both the stranded-commit push and the “already synced => no push” behavior.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| internal/sink/git/export_file.go | Adds syncCLIWorkdir to prevent false “synced” results by validating remote state and pushing stranded commits when necessary. |
| internal/sink/git/export_ahead_test.go | Adds regression tests reproducing REL-06 and proving the “no push when already synced” gate. |
| internal/sink/git/exec_git.go | Adds remoteHasLocalHead and remoteSHAFromLsRemote to query remote refs directly via ls-remote. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+298
to
+309
| func remoteSHAFromLsRemote(out string) string { | ||
| line := strings.TrimSpace(out) | ||
| if line == "" { | ||
| return "" | ||
| } | ||
|
|
||
| if idx := strings.IndexAny(line, " \t"); idx >= 0 { | ||
| return line[:idx] | ||
| } | ||
|
|
||
| return line | ||
| } |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
This was referenced Aug 3, 2026
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.


Audit finding REL-06 (P2; P1 for
engine: cli) — silent data non-delivery.Bug: the warm-mirror git-CLI export path reported
Synced=truewhen the local branch was AHEAD oforigin/<pushBranch>(a committed-but-unpushed snapshot stranded). Root cause: the clean check compared working-tree vs HEAD, not local vs remote.Fix: on a clean tree,
syncCLIWorkdirnow consults the remote viaremoteHasLocalHead(ls-remote refs/heads/<pushBranch>vs local HEAD) and only returns success without pushing when the remote already holds the local HEAD; otherwise it pushes the stranded commit. Fail-safe: any ls-remote/rev-parse error aborts the export rather than falsely reporting synced. Dirty/hot path unchanged (exactly one push per path).TDD:
TestSyncCLIWorkdir_pushesStrandedCommitWhenTreeClean(fails on revert) +TestSyncCLIWorkdir_noPushWhenRemoteAlreadyHasHead. Gates green (test/vet/fmt/lint/build).Independent review: APPROVE, no P0/P1 — traced all
Synced=truepaths, confirmed fail-safe. P2 follow-up (non-blocking): add an explicit ls-remote-failure error-path test.Disjoint from all other lanes (sink/git only).