Skip to content

fix(test): assert #158's semantics, not the ones it replaced - #164

Merged
VickyXAI merged 1 commit into
mainfrom
fix/billing-copy-test-vs-158
Sep 5, 2026
Merged

VickyXAI merged 1 commit into
mainfrom
fix/billing-copy-test-vs-158

Conversation

@VickyXAI

@VickyXAI VickyXAI commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

main is red. The code is right; my test was wrong.

#163 landed before #158, when invalidateKey() demoted to wallet mode after a 401. #158 changed that on purpose — a rejected key now only refreshes the credential, because an account failure is never permission to spend from a wallet.

The test now uses useWalletMode() (--wallet), the lever that actually flips the mode, and additionally asserts invalidateKey() does not move billing to the wallet so it cannot drift back.

Mutation-tested both directions: freezing the mode at import fails it; restoring the old demotion fails it too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h

main went red on `the mode is read at call time, not captured at import`.
The code is right; the test was wrong.

#163 landed before #158, when invalidateKey() demoted a session to wallet
mode after a 401, so the test used it to prove the billing copy re-reads the
mode. #158 changed that on purpose: a rejected key now only refreshes the
credential, because an account failure is never permission to spend from a
wallet.

The property still holds — useWalletMode() (`--wallet`) is the lever that
actually flips the mode. The test now uses it, and additionally asserts that
invalidateKey() does NOT move billing to the wallet, so it cannot drift back.

Both directions are mutation-tested: freezing the mode at import fails it, and
restoring invalidateKey()'s old demotion fails it too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Rm7cRGtC7wCofhYuHRo21h
@VickyXAI
VickyXAI merged commit ed005d8 into main Sep 5, 2026
3 checks passed
@VickyXAI
VickyXAI deleted the fix/billing-copy-test-vs-158 branch September 5, 2026 22:20
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