Skip to content

fix(cc034): install/uninstall-hooks idempotency by basename after repo rename#53

Merged
screenleon merged 3 commits into
mainfrom
fix/cc034-install-hooks-basename
May 15, 2026
Merged

fix(cc034): install/uninstall-hooks idempotency by basename after repo rename#53
screenleon merged 3 commits into
mainfrom
fix/cc034-install-hooks-basename

Conversation

@screenleon
Copy link
Copy Markdown
Owner

Summary

  • Switch install-hooks.sh idempotency checks from full-path to basename + scripts/ parent-dir comparison, preventing duplicate hook entries after a repo rename/move (e.g., claude-configpm-dispatch)
  • Add path-refresh pass in install-hooks.sh that updates stale command paths in-place (same basename, scripts/ parent) before the append-if-absent step
  • Apply the same basename + scripts/ guard to uninstall-hooks.sh so stale managed paths are correctly removed after a rename
  • 3 new regression tests; full suite 32/32

PR-Gate

Standard tier (critic, qa-tester, architecture-reviewer): GO

Advisory (not blocking): the basename + scripts/ parent managed-hook heuristic does not protect against an unrelated tool whose hook also lives under a scripts/ subdirectory with the same filename. This collision path is uncommon (requires another tool to adopt our exact filenames and layout), and is accepted as a known tradeoff. Tracked in BACKLOG as CC-035 for future tightening if needed.

Test plan

  • bash scripts/test-install.sh → 32 passed, 0 failed
  • bash scripts/test-install.sh --filter install-hooks-updates-stale-paths-after-rename → PASS
  • bash scripts/test-install.sh --filter install-hooks-preserves-unrelated-same-basename-hook → PASS
  • bash scripts/test-install.sh --filter install-hooks-uninstall-stale-paths-after-rename → PASS

🤖 Generated with Claude Code

screenleon and others added 3 commits May 15, 2026 09:41
Full-path comparison in the jq `_present` checks caused duplicate hook
entries when the repo was renamed or moved. Switch all six checks to
basename comparison via `split("/") | last`, add a path-refresh pass
that updates stale command paths in-place, and apply the same fix to
the statusLine bash check. Add regression test
`test_install_hooks_updates_stale_paths_after_rename` (30/30 pass).

Closes CC-034.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add parent-dir == "scripts" guard to all six jq basename checks and
the statusLine refresh so unrelated tools with the same hook filename
are never overwritten. Add regression test
test_install_hooks_preserves_unrelated_same_basename_hook (31/31 pass).

Addresses qa-tester block from PR-gate round 1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…name

Switch all four hook-group selectors in uninstall-hooks.sh from exact-path
to basename + scripts/ parent-dir match, so uninstalling after a repo rename
correctly removes stale entries. Retain exact-path removal for legacy old_stop
hooks/ path. Add regression test (32/32 pass).

Completes CC-034 requirement item #4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@screenleon screenleon merged commit aeff33f into main May 15, 2026
6 checks passed
@screenleon screenleon deleted the fix/cc034-install-hooks-basename branch May 15, 2026 01:14
screenleon added a commit that referenced this pull request May 16, 2026
…/028/034 (#60)

Index row CC-029 was still 🔵 active even though PR #57 landed it
2026-05-15. Promote to ✅ closed and add Outcome + See pointers.

Backfill missing **See**: pr:#NN stubs for previously-closed entries
CC-027/CC-028/CC-034 that already pointed at PR #54/#55/#53 in their
Refs column but lacked the body-side See stub required by
pm/scripts/validate.sh E-CLOSURE-NO-SEE.

Pure data drift fix; no validator or runtime change. Remaining
baseline noise (CC-035 E-INDEX-MISMATCH, CC-038 E-AREA-ENUM +
E-REFS-PREFIX) is tracked separately and intentionally out of
scope here.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
screenleon added a commit that referenced this pull request May 16, 2026
CC-030 strengthened closure-date rule (heading marker OR **Outcome**:
line only) exposes drift: CC-027 and CC-028 Outcome lines lacked a
date token (previously masked by Source-line dates), and CC-034 had
no Outcome line at all.

Add `2026-05-15 —` prefix to existing CC-027 / CC-028 Outcome lines.
Add a new Outcome line for CC-034 (dated 2026-05-15, summarizing PR
#53 landing). No semantic change to history; only date metadata
needed by the strengthened validator.

Verified against the strengthened validator (from feat/cc030 branch):
emits only the pre-existing 3 token set (E-AREA-ENUM, E-REFS-PREFIX,
E-INDEX-MISMATCH). No new errors introduced.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant