fix(#106): CHANGELOG fallback in drift hook for squash-merged forks#129
Merged
Conversation
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
Fixes the bug from #106: the v1.1.0 tag-based drift hook keeps firing on forks that sync via GitHub's default squash-merge. The squash collapses the upstream-tag commit into a synthetic SHA, the tag becomes unreachable from the fork's main, and
git tag --merged mainreturns empty — so the hook says "vX.Y.Z available" forever.Adds a CHANGELOG-content fallback that fires only when the primary tag-reachability check fails. If the fork's main has a
## [X.Y.Z]heading matching the upstream tag's version, the release is treated as absorbed and the banner stays silent.changelog_has_version()helper does a tolerant grep against${DEFAULT_BRANCH}:CHANGELOG.md. Strips leadingvfrom the tag for the heading match.LOCAL_TAGempty (first sync, squash-merged); (2)UPSTREAM_TAGstrictly newer thanLOCAL_TAG(intermediate sync, squash-merged).docs/agdr/AgDR-0008-changelog-fallback-for-squash-merged-forks.md(extends AgDR-0005's original tag-based-drift design).Why this approach
The ticket listed four options:
(C) is in-place: zero changes to the
/updateskill, zero new files outside the AgDR, zero migration story for existing forks. The CHANGELOG format dependency is acceptable because apexyard owns the CHANGELOG and the format is stable from v1.1.0 onward. AgDR-0008 documents the option table.Testing
5 cases in
.claude/hooks/tests/test_check_upstream_drift.sh. Each builds a tiny upstream + fork pair under$TMPDIR, simulates a specific merge mode, runs the hook, asserts banner / silence:The fifth case is the critical "fail-open" check — a fork that squash-merges but doesn't keep CHANGELOG.md should NOT be silenced incorrectly. Regression-protected.
Acceptance criteria (from #106)
tests/test_check_upstream_drift.shScope — what this does NOT do
/updateskill. Existing flow works as-is.## [X.Y.Z]line into their fork's CHANGELOG, or after the next/updatesync).Glossary
git tag --merged BRANCH— does the tag's target SHA appear in BRANCH's ancestry? Reliable for merge-commit / rebase, not for squash-merge.^##\s+\[X.Y.Z\]heading grep. Tolerant secondary signal.Closes #106