Skip to content

squash-merge-history: scope to the work, not the repo history - #142

Merged
missingbulb merged 2 commits into
mainfrom
claude/squash-merge-history-test-qrnob7
Jul 7, 2026
Merged

squash-merge-history: scope to the work, not the repo history#142
missingbulb merged 2 commits into
mainfrom
claude/squash-merge-history-test-qrnob7

Conversation

@missingbulb

Copy link
Copy Markdown
Owner

Problem

The squash-merge-history check audited the entire first-parent history of the default branch on every run (ctx.mergeCommitsOn(ctx.baseRef)), emitting one finding per merge commit found anywhere in that history. It "tested the world" — the repo's whole past — rather than "testing the work," out of step with every other delta-scoped check in the system (warning-suppression ignores pre-existing markers; task-lifecycle scopes to commits since the merge-base).

The tax this imposed was concrete: .claudinite-checks.json had grown nine squash-merge-history acceptance entries — one hand-written reason per legacy merge commit — purely to keep the whole-history audit from re-flagging ancient merges every session.

Change

Scope the check to the merge commits the current change introduces — those on HEAD's first-parent chain since the merge-base — so it fires only when a merge is happening in the work, never re-auditing legacy merges already on main that the work never touched.

  • checks/lib/context.mjs: mergeCommitsOn(ref) (whole-history) → introducedMergeCommits() (range mergeBase..HEAD, empty when no base resolves).
  • packs/universal/squash-merge-history.mjs: fires per introduced merge; message, description, and why updated to the work-scoped framing.
  • .claudinite-checks.json: the nine legacy squash-merge-history acceptances deleted as dead config.
  • Docs tracked to the new semantics: checks/DESIGN.md (effect-check bullet), checks/README.md (delta-rule note), checks/conversion-inventory.md, packs/universal/README.md.
  • checks/test/rules.test.mjs: rewritten to assert a merge the branch introduces fires, while a pre-existing merge already on main (before the branch's work) stays silent.

Decision confirmed with the owner: drop the retrospective whole-history audit entirely; do not keep a CI-only history backstop.

Verification

  • node --test checks/test/*.test.mjs — 64/64 pass.
  • node checks/run.mjs (full-repo sweep) — exits 0 clean, including no orphaned/reasonless acceptances after removing the nine legacy entries.

Closes #141

🤖 Generated with Claude Code


Generated by Claude Code

claude added 2 commits July 7, 2026 08:25
The check audited main's entire first-parent history on every run, so it
re-flagged every legacy merge commit each session — nine of them had to be
individually silenced in .claudinite-checks.json. That is "test the world,"
out of step with every other delta-scoped check here.

Scope it to the work: flag only the merge commits the current change
introduces (HEAD's first-parent chain since the merge-base). Pre-existing
merges already on the base are out of range, so the nine legacy acceptances
are deleted as dead config. Context gains introducedMergeCommits() replacing
the whole-history mergeCommitsOn(); docs and the test track the new semantics.

Closes #141

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019mW2ZDXbTgZxwsyrPcUrwy
The work-scoped squash-merge-history check evaluates HEAD's branch commits.
actions/checkout defaults to refs/pull/N/merge on pull_request events, making
HEAD an ephemeral merge of the branch into main — which the check correctly
flags as an introduced merge commit. Check out the PR head SHA instead so CI
evaluates exactly what the local Stop hook does (the branch tip); fall back to
github.sha on push to main.

Refs #141

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019mW2ZDXbTgZxwsyrPcUrwy
@missingbulb
missingbulb marked this pull request as ready for review July 7, 2026 08:43
@missingbulb
missingbulb merged commit 44c030e into main Jul 7, 2026
1 check passed
@missingbulb
missingbulb deleted the claude/squash-merge-history-test-qrnob7 branch July 7, 2026 08:43
missingbulb pushed a commit that referenced this pull request Jul 7, 2026
On pull_request, actions/checkout defaults to the synthetic refs/pull/N/merge
commit — an ephemeral merge of the head into the base — so HEAD is a merge
commit, not the branch tip. Any CI job that inspects commit shape/history
misfires on it; e.g. a "no merge commits" check false-positives on a linear
branch. Land the gotcha next to the sibling actions/checkout-default trap in
the git-github-advanced skill (GitHub Actions gotchas are its scope), framed
portably rather than tied to this repo's own checks.

Captured from the #141/#142 session, where this cost a CI round-trip.

Closes #145

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019mW2ZDXbTgZxwsyrPcUrwy
missingbulb added a commit that referenced this pull request Jul 7, 2026
Add a git-github-advanced gotcha: on pull_request, actions/checkout defaults to the synthetic refs/pull/N/merge commit, so HEAD is a merge commit; a CI job that inspects commit shape/history must check out the PR head SHA. Captured from the #141/#142 session.

Closes #145
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

squash-merge-history: scope to the work, not the whole repo history

2 participants