Skip to content

fix(#974): restore rotate-credential advice to the git-backup untrack receipt - #987

Merged
fdaviddpt merged 4 commits into
mainfrom
fix/974
Oct 8, 2026
Merged

fdaviddpt merged 4 commits into
mainfrom
fix/974

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

#918 reworded docs/git-backup-security.md SS4's stale haiku.oauth_token wording and, in the same commit, silently dropped the "rotate that credential" sentence from hooks.d/after_save/50-git-backup.sh's own untrack receipt -- the one log line a user actually sees when a legacy $SLUG/config.json, committed by a pre-#719 version of the hook, gets untracked. The doc still told a reader to rotate; the hook stopped saying it.

Restores the rotate-credential sentence to:

  • the "succeeded" untrack branch's log message (line 627) -- the primary fix.
  • the sibling "deferred" untrack branch's log message (line 624), reached when the store has other staged changes so the untrack commit is deferred to the next backup -- the credential is already in git history either way, so this sibling needs the same advice. Found by a round-1 Explore reviewer; judged to meet the fix-it bar (stated mechanism, one-sentence blast radius, same file) and fixed rather than filed.

A third sibling branch (line 630, the "could not untrack" failure/retry message) was found missing the same advice by the round-2 auditor, and is logged to trap.d/974.untrack-rotate-advice-third-sibling.md rather than fixed -- ranked misreports/can-ship-behind-a-trap.d-fragment, non-blocking, to avoid an open-ended sweep of sibling branches across two already-completed review rounds.

Tests

New tests/test_git_backup_rotate_advice_974.py: the rotate sentence is present on a successful legacy-config.json untrack and on the deferred-untrack-with-staged-changes branch, each paired with a positive control asserting the sentence is absent when there is no legacy config.json to begin with.

Red (reverted fix): python3 -m pytest tests/test_git_backup_rotate_advice_974.py -q -> 1 failed, 1 (then 2) passed.
Green (fix restored): python3 -m pytest tests/test_git_backup_rotate_advice_974.py tests/test_git_backup_config_json_719.py tests/test_git_backup_silent_exclude_mkdir_759.py -q -> 7 passed.

Full repo pytest deliberately not run locally -- CI is this repo's gate (CLAUDE.md).

Docs

README.md checked against the fix (docs_targets) -- no change needed, it makes no claim about the hook's own log wording.

Closes #974

🤖 Generated with Claude Code

Co-Authored-By: Claude Sonnet 5 [email protected]

[AI-generated]

fdaviddpt and others added 4 commits October 8, 2026 06:00
… receipt

Commit 73c77f8 (#918) reworded docs/git-backup-security.md SS4's stale
haiku.oauth_token wording and, in the same commit, silently dropped the
"rotate that credential" sentence from the hook's own untrack receipt --
the one place a user actually learns their legacy config.json was
committed to history. The doc still told a reader to rotate; the
receipt no longer did.

hooks.d/after_save/50-git-backup.sh's untrack log message now carries
the same rotate advice the doc gives, with a red/green test pair
(tests/test_git_backup_rotate_advice_974.py) asserting the message and
a positive control that an ordinary backup (no legacy config.json)
never logs it.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ack branch

Self-review on 21caa42 found the sibling log message at line 624 --
reached when a legacy config.json is tracked but the store has other
staged changes, so the untrack commit is deferred to the next backup --
was missing the same rotate advice just added to the succeeded branch,
even though the credential is already in this store's git history
either way (the deferral is only about when the untrack COMMIT lands,
not whether config.json was ever committed).

Adds the matching sentence to that message, a red/green test
(test_deferred_untrack_with_staged_changes_also_logs_rotate_advice),
and updates the changelog fragment.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…king

Round-2 self-review audit found a third log message in the same
untrack block (the "could not untrack" failure branch) also lacking
the rotate-credential advice the other two branches now carry. Ranked
misreports/can-ship-behind-a-trap.d-fragment, not blocking -- logged
for a later pass rather than extending this fix into an open-ended
sweep of sibling branches.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
…ing sweep

PR #987 CI caught two deterministic failures:

1. tests/test_stale_oauth_wording_sweep_918.py -- the "live
   haiku.oauth_token" phrasing restored in 21caa42/0d2b8d3 is exactly
   the "a credential still described as live" shape #918's own sweep
   exists to catch (it is, almost verbatim, that test's own positive
   control fixture). Dropped "live" from both log sentences; the
   rotate advice itself (the credential is already in this store's
   git history, rotate it via claude setup-token) is unchanged and
   says nothing about whether the token is currently live, so nothing
   substantive is lost. Also fixed the same wording in the trap.d
   fragment's candidate-fix text for consistency, though that file is
   outside the sweep's scanned set.

2. tests/test_windows_skip_triage_497.py -- the new
   tests/test_git_backup_rotate_advice_974.py carries a win32 blanket
   skip with no matching row in docs/windows-skip-triage.md. Added the
   row (same reason string/verdict as its sibling git-backup tests,
   whose fixtures it imports and reuses directly).

Confirmed red on the unmodified tree (git stash) and green after,
for both: python3 -m pytest tests/test_stale_oauth_wording_sweep_918.py
tests/test_windows_skip_triage_497.py. Full targeted set including the
original #974 tests: 13 passed.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@fdaviddpt
fdaviddpt merged commit 50c5cdf into main Oct 8, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the fix/974 branch October 8, 2026 05:19
fdaviddpt added a commit that referenced this pull request Oct 8, 2026
…rack receipt (#993)

* fix(#989): add rotate-credential advice to git-backup's could-not-untrack receipt

The untrack block's third branch (git rm --cached or the untrack commit
failing) logged "could not untrack ..." with no advice to rotate a
haiku.oauth_token the legacy config.json may have carried, even though
#974/#987 already added that sentence to the other two branches and the
credential is already in git history the moment ls-files finds config.json
tracked, regardless of which branch fires. Found by self-review on #974/#987
and deliberately deferred to this follow-up.

Red/green: tests/test_git_backup_rotate_advice_974.py now also covers this
branch, forcing the failure with a pre-commit hook in the remember repo that
always exits non-zero so _gb_commit_untrack's git commit fails.

Co-Authored-By: Claude Sonnet 5 <[email protected]>

* review(#989): expand rotate-advice wording to match the succeeded branch; log a trap.d CRLF finding

Self-review (Explore) found the could-not-untrack branch's new sentence used the
shorter deferred-branch form instead of the fuller succeeded-branch rationale
(#860, claude.ai still accepting the old token, anyone with git-history access) --
expanded it to match, one line, no test change needed (the test only asserts the
substring "rotate").

Self-review (oss:auditor) found tests/test_git_backup_rotate_advice_974.py's new
pre-commit hook script is written via Path.write_text with no newline="", so a
Windows run would get CRLF-translated and the shebang could fail to exec -- inert
today since the whole file is already skipped on win32 (#79) and CI's own matrix
confirms that leg never runs it. Logged to trap.d/ rather than fixed/filed per the
spine's ranking (non-blocking, ships behind a trap.d fragment).

Co-Authored-By: Claude Sonnet 5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5 <[email protected]>
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.

50-git-backup.sh: untrack receipt lost its rotate-the-credential advice when #918 reworded the stale oauth_token wording

1 participant