fix: report upstream currency by merged content - #87
Merged
Merged
Conversation
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.
Intent
Make bin/fm-upstream-check.sh report upstream currency by content instead of raw commit ancestry, because squash-landed refit commits permanently inflate the behind count and can trigger duplicate integration. Keep the upstream fetch and ahead/behind ancestry calculation, but label those numbers as commit-identity context that squash refits can inflate, and make a read-only three-way merge simulation with git merge-tree --write-tree the content verdict. Report zero incoming content as content-current with no sync needed even when the ancestry gap is nonzero; when content arrives, report its diffstat and separately list files genuinely absent from the fork's main. A merge-tree exit of 1 with a valid tree is expected conflict behavior and must be accepted, while conflict-marker lines must not inflate incoming-content measurement: exclude conflicted paths from that measurement, report their separate count and names, and keep genuinely absent files as the strongest signal. Do not infer conflicts from merge-tree --name-only output. Detect Git older than 2.38 and use an explicit ancestry-only fallback with a loud warning that the count may be squash-inflated and must not be used as a sync trigger; distinguish unsupported or failed simulations from valid conflict trees. Preserve the read-only contract for tracked files, the working tree, index, HEAD, and local branch refs apart from the upstream remote-tracking ref refreshed by fetch; document that merge-tree writes only loose objects and never pushes, and preserve the successful-report exit-code contract used by refit and heartbeat. Update the refit CURRENCY contract to act only on the content verdict, update docs/scripts.md and the script header, and add synthetic-repository tests covering squash-landed current content, genuine incoming content and absent files, combined squash residue plus new content, conflicted merges without marker inflation and with separate conflict paths, and old-Git fallback. The reverse-apply-per-commit technique is rejected and must not be used. Do not perform upstream sync, merge anything, modify bin/fm-fleet-sync.sh, or change the updatefirstmate path.
What Changed
Risk Assessment
✅ Low: The change is well-bounded and the reviewed content-verdict logic aligns with the stated requirements, captain.
Testing
Captain, exercised squash residue, genuine incoming content, conflicts, absent files, old-Git fallback, and read-only behavior through the focused synthetic-repository tests; syntax validation also completed.
Evidence: Focused upstream currency test transcript
Source: Focused upstream currency test transcript
Pipeline
Updates from git push no-mistakes
✅ **intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
✅ **Review** - passed
✅ No issues found.
✅ **Test** - passed
✅ No issues found.
bash tests/fm-upstream-check.test.shbash -n bin/fm-upstream-check.sh tests/fm-upstream-check.test.sh✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.