Skip to content

test(claude): cover the renewal-then-read-back path end to end - #169

Merged
jaywedgeworth22 merged 1 commit into
mainfrom
mm/claude-refresh-rereads-keychain
Oct 6, 2026
Merged

jaywedgeworth22 merged 1 commit into
mainfrom
mm/claude-refresh-rereads-keychain

Conversation

@jaywedgeworth22

Copy link
Copy Markdown
Collaborator

Follow-up to #168 (which merged as c39639c).

The renewal-then-read-back path had no coverage at all. An expired-but-renewable login is the one case LocalQuotaReader is supposed to recover from on its own — it asks Claude Code to renew its own login, then reads the result back on the same refresh — and nothing asserted that a renewal which actually lands is used.

This drives the real sequence through LocalQuotaReader: expired record → one renewal run → Claude Code's rewritten login read back → quota published from the renewed token, with no issue and no consent prompt. The injected credential closure asserts Bearer renewed, so a reader that quietly sent the stale token would fail rather than pass quietly.

Uses a locked one-way gate for the flag the renewal closure and the credential closure both touch, since they run on different tasks.

Scope: test-only, one file, +55. The production fix in #168 is unchanged.

swift test on main + this commit: 331 passed, 3 skipped, 0 failures.

Note for reviewers: I checked this test against a reverted gate — it does not fail without the #168 fix, because the fix lives in ClaudeCredentialSource.resolveSilently and this test injects past it. It is not a regression test for #168. The real regression coverage for that bug is the two ClaudeConsentTests cases that shipped in #168. This test covers a separate, previously-untested path.

The self-healing path had no coverage at all: an expired-but-renewable
login was the one case the reader is supposed to recover from on its own,
and nothing asserted that a renewal which actually lands is used.

This drives the real sequence through LocalQuotaReader — expired record,
one renewal run, Claude Code's rewritten login read back on the same
refresh — and asserts the row reports the renewed token's quota with no
issue and no consent prompt.  Uses a locked one-way gate for the flag both
closures touch, since they run on different tasks.

Suite is now 332 tests, 3 skipped, 0 failures.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@jaywedgeworth22
jaywedgeworth22 merged commit 5c1e7e1 into main Oct 6, 2026
3 checks passed
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