Skip to content

fix(account): surface malformed CSHIP_ACCOUNT in explain hint, warn on empty - #204

Merged
stephenleo merged 1 commit into
mainfrom
fix/account-env-followup
Sep 6, 2026
Merged

fix(account): surface malformed CSHIP_ACCOUNT in explain hint, warn on empty#204
stephenleo merged 1 commit into
mainfrom
fix/account-env-followup

Conversation

@stephenleo

Copy link
Copy Markdown
Owner

Follow-up to code review of #201 (CSHIP_ACCOUNT account source). Three minimal fixes:

  1. src/explain.rs — the "account" arm of error_hint_for now checks CSHIP_ACCOUNT first. When it's set and non-empty but fails to parse as the expected JSON, the hint now names the malformed CSHIP_ACCOUNT payload as the cause instead of the misleading "no Claude Code credential found" / re-authenticate message. Reuses modules::account::parse_account_env rather than duplicating the parsing logic.
  2. docs/configuration.md — qualified two pre-existing unconditional statements that now contradict the CSHIP_ACCOUNT paragraph: the "fetched once from the OAuth endpoint and cached for 24 hours" line and the "requires an OAuth token in the OS credential store" prerequisite, both now read "unless CSHIP_ACCOUNT is set".
  3. src/modules/account.rsparse_account_env now emits tracing::warn! on set-but-empty CSHIP_ACCOUNT (previously silent None), matching CLAUDE.md's "absent data → explicit match + tracing::warn! + None" convention already applied to the malformed-JSON case. Updated the existing test's comment to reflect both branches now warn.

Test plan

  • cargo test
  • cargo clippy --all-targets -- -D warnings
  • cargo fmt --check

🤖 Generated with Claude Code

…n empty

Follow-up to PR #201's CSHIP_ACCOUNT account source:
- explain.rs: the "account" hint arm now checks CSHIP_ACCOUNT first, so a
  set-but-unparseable value is reported as the cause instead of the
  misleading "no credential found" / re-authenticate hint
- modules/account.rs: parse_account_env now warns on set-but-empty
  CSHIP_ACCOUNT (previously silent), matching the "absent data -> warn"
  convention already used for the malformed-JSON case
- docs/configuration.md: qualify the two now-inaccurate unconditional
  statements about the OAuth fetch/cache and credential-store prerequisite
  with "unless CSHIP_ACCOUNT is set"

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@stephenleo
stephenleo merged commit 9edaa8f into main Sep 6, 2026
3 checks passed
@stephenleo
stephenleo deleted the fix/account-env-followup branch September 6, 2026 09:19
@stephenleo stephenleo mentioned this pull request Sep 6, 2026
stephenleo added a commit that referenced this pull request Sep 6, 2026
Bumps to 1.8.2 and adds the changelog entries for the per-window
usage_limits tokens with {bar} (#202), the CSHIP_ACCOUNT account source
(#201), and the CSHIP_ACCOUNT explain-hint fix (#204).

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
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