Skip to content

fix(#890): resolve the remaining bare main...HEAD consumers via resolveDiffBase - #894

Merged
admarble merged 2 commits into
mainfrom
feature/890-fix-observability-remaining-bare-main-head-con
Aug 4, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/890-fix-observability-remaining-bare-main-head-con

Conversation

@admarble

@admarble admarble commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #878: the remaining bare main...HEAD consumers now resolve their diff base via resolveDiffBase (nearest-candidate between origin/<base> and the bare ref), so a stale local main can no longer leak merged-upstream content into them.

  • qa-cache.ts — diff hash and changed-file invalidation scoping resolve via resolveDiffBase; all five git calls are array-form execFileSync and honor a new injectable QACacheOptions.cwd (default process.cwd()), which also makes the class testable against real repos without process.chdir. Note: existing QA caches invalidate once on upgrade (the ref inside the hash key changes) — a single fresh QA run, as pre-approved in the issue.
  • worktree-manager.ts — per-worktree diff summaries (--name-only, --stat) use the resolved ref.
  • phase-executor.ts — the file-context list handed to file-oriented drivers (aider --file) uses the resolved ref, keeping its per-worktree cwd; execSync → array-form execFileSync.
  • Skill prose — all 13 bare main...HEAD across exec/docs/test/merger/assess/loop (+ predicted-collision-detection.md) audited per occurrence (all worktree-diff contexts, none intentionally local) and origin-qualified identically across all three mirrors, plus one same-root-cause main..HEAD commit list in merger.
  • QA-sweep siblings filled in-branch (commit 2): qa quality-checks.sh (11 refs ×3 mirrors), qa SKILL.md two-dot main..HEAD Phase-0/§10a commands (8 ×3 — fix(observability): phase diff stats compare against the local base ref while worktrees branch from origin/<base> — phantom filesModified + base tip logged as the phase commit #878 swapped three-dot only), and post-tool.sh's coverage hook (.claude/hooks + templates/hooks). The frozen __fixtures__/dependency-markers corpus deliberately keeps its bare refs.

AC Verification

AC Description Status Evidence
AC-1 qa-cache resolves via resolveDiffBase + stale-local-main regression test ✅ Implemented qa-cache.integration.test.ts (7 tests, real repos). Mutation-verified: reverting the ref swap fails exactly the 3 targeted tests; dropping the injected cwd fails exactly the incremental-path test
AC-2 worktree-manager summaries use resolved ref ✅ Implemented worktree-manager.ts:406-437
AC-3 phase-executor file-context uses resolved ref, respects cwd ✅ Implemented phase-executor.ts:1114-1135
AC-4 Non-qa skill bare refs origin-qualified identically across mirrors ✅ Implemented 0 bare / 0 double-prefix per mirror; md5-identical ×3; check-skill-sync.ts 44/44

Test plan

  • Full suite in worktree: 4890 passed / 233 files
  • Lint + lint:skill-calls: clean
  • New real-git regression suite covers cache hash, global + per-check invalidation scoping, and injected-cwd incremental diffs, with recorded mutation results
  • 6 sampled swapped skill-gate commands executed against the real worktree corpus — all scan exactly this branch's diff
  • Semgrep: 4 findings at worktree-manager.ts:575/1254 are pre-existing on origin/main, outside every hunk of this diff

Fixes #890

🤖 Generated with Claude Code

…veDiffBase

qa-cache keys its diff hash and scopes invalidation via resolveDiffBase,
runs all five git calls array-form (execFileSync), and gains an
injectable QACacheOptions.cwd (default process.cwd()) so real-repo tests
need no process.chdir. Existing caches invalidate once (ref inside the
hash key changes). worktree-manager's per-worktree summaries and
phase-executor's aider file-context (keeping its per-worktree cwd) use
the resolved ref. All 13 bare main...HEAD in exec/docs/test/merger/
assess/loop skill prose audited per occurrence (all worktree-diff
contexts, none intentionally local) and origin-qualified identically
across the three mirrors, plus one same-root-cause main..HEAD commit
list in merger.

Regression-tested against real repositories with local main
deliberately behind origin (qa-cache.integration.test.ts): cache hash,
global + per-check invalidation scoping, and injected-cwd incremental
diffs.

Fixes #890
…ompleteness sweep

QA's adversarial sweep found three same-root-cause consumer groups the
issue's enumeration missed: the qa skill's quality-checks.sh gate script
(11 bare main...HEAD per mirror — #878 covered the SKILL.md prose and
the two TS gate scripts, not this one), eight two-dot main..HEAD in
qa/SKILL.md's Phase 0 implementation-detection and s10a changelog-gate
commands (#878 swapped three-dot only; a stale local main makes Phase 0
report phantom "implementation exists"), and the coverage-analysis hook
in post-tool.sh (.claude/hooks + templates/hooks). All swapped
identically across mirrors; hooks stay byte-identical. The
__fixtures__/dependency-markers corpus keeps its bare refs on purpose —
frozen historical issue bodies, not live commands.
@admarble
admarble merged commit 64416d6 into main Aug 4, 2026
8 checks passed
@admarble
admarble deleted the feature/890-fix-observability-remaining-bare-main-head-con branch August 4, 2026 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant