Skip to content

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

Merged
fdaviddpt merged 2 commits into
mainfrom
fix/989
Oct 8, 2026
Merged

fdaviddpt merged 2 commits into
mainfrom
fix/989

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

The untrack block in hooks.d/after_save/50-git-backup.sh has three branches that fire once git ls-files already shows a legacy $SLUG/config.json tracked -- i.e. any haiku.oauth_token it carried is already in the store's git history regardless of which branch fires. #974/#987 added rotate advice to the deferred and succeeded branches; this fix adds the same advice to the third, previously-silent 'could not untrack' branch (line ~630), expanded during self-review to carry the fuller wording that matches the succeeded branch (the #860 rationale: claude.ai may still accept the old token even though this plugin no longer reads it, and anyone with access to the store's git history can still see it).

Closes #989.

Testing

  • Red: tests/test_git_backup_rotate_advice_974.py::TestUntrackReceiptCarriesRotateAdvice::test_could_not_untrack_also_logs_rotate_advice, which forces the 'could not untrack' branch with a pre-commit git hook that always exits 1. Before the fix: FAILED, "rotate" not in log_text.
  • Green: same test, after the fix: 4 passed (whole file, including the positive control test_ordinary_backup_does_not_log_rotate_advice, which pairs the 'must not fire' case with a 'must fire' case).
  • Full pytest not run locally per this repo's own guidance (targeted-only; CI is the cross-platform/interpreter matrix gate).

Review

Two reviewers (Explore, oss:auditor) ran against the pre-self-review commit, told not to edit:

  • Explore found the new sentence used the shorter deferred-branch wording instead of the fuller succeeded-branch rationale -- fixed by expanding the wording to match.
  • oss:auditor found that the test's new pre-commit hook script is written via Path.write_text with no newline="", so on Windows the default newline translation would emit a CRLF-terminated shebang that some shebang parsers could fail to exec. Non-blocking: the whole test file is already skipped on win32 for an unrelated reason (Windows: re-enable shell-subprocess tests via Git Bash on PATH #79), and CI's matrix confirms that leg never runs this file. Logged to trap.d/989.pre-commit-hook-script-crlf-write-text.md rather than fixed now, so it is not lost if the win32 skip is ever narrowed.

A tree-snapshot compare (taken before spawning reviewers, checked after their return and after my own self-review edits) reported mutated, naming exactly the two self-review edits above (the wording expansion and the new trap.d fragment) -- no reviewer-caused mutation.

Docs

README.md already documents (around the haiku.oauth_token section) that the key/env var are fully removed and no longer read anywhere, and that a still-configured value is harmless and not logged. It does not enumerate the hook's individual log messages, so no README change was needed.

🤖 Generated with Claude Code

[AI-generated]

fdaviddpt and others added 2 commits October 8, 2026 09:23
…rack 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]>
…nch; 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]>
@fdaviddpt
fdaviddpt merged commit b7e1403 into main Oct 8, 2026
19 checks passed
@fdaviddpt
fdaviddpt deleted the fix/989 branch October 8, 2026 08:06
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.

git-backup's 'could not untrack' message (line 630) still has no rotate-credential advice

1 participant