Repository navigation
fix(test): assert #158's semantics, not the ones it replaced - #164
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 assertsinvalidateKey()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