Skip to content

Extract the OS keyring into core/keyring_store#215

Merged
alexkroman merged 1 commit into
mainfrom
claude/extract-keyring-store
Jun 17, 2026
Merged

Extract the OS keyring into core/keyring_store#215
alexkroman merged 1 commit into
mainfrom
claude/extract-keyring-store

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

core/config.py sat at exactly the 500-line gate with zero headroom (the next addition would break the max-file-length check). This splits the OS keyring access — the one external secret dependency — onto its natural seam.

What changed

  • New core/keyring_store.py — the single importer of keyring, holding KEYRING_SERVICE plus set_secret / get_secret / restore_secret / delete_secret / usable.
  • core/config.py (500 → 442) — reads and writes secrets through that wrapper and no longer imports keyring directly, so the documented "secrets live in the keyring, not the dotfile" boundary is now structural. config.keyring_usable stays as a thin delegator so the auth-state facade (doctor / login and their tests) is unchanged. The two clear_* paths collapse onto the shared delete_secret.
  • Tests that reached into config's keyring internals repoint to keyring_store (config.keyringkeyring_store.keyring, config.KEYRING_SERVICEkeyring_store.KEYRING_SERVICE).

No behavior change. Full scripts/check.sh gate passes — 100% patch coverage, mutation gate, CodeQL, import-linter contracts (the new module lands in the core layer).

Note: separated from #214 (eval/stream refactor, currently in the merge queue) so it lands independently.

🤖 Generated with Claude Code

https://claude.ai/code/session_018Bkx51XDcYBdnot1EF8h9U


Generated by Claude Code

config.py sat at exactly the 500-line gate with no headroom. Split the OS
keyring access — the one external secret dependency — into a new
core/keyring_store.py: KEYRING_SERVICE plus set_secret/get_secret/
restore_secret/delete_secret/usable, the single importer of `keyring`.

config.py (500 -> 442) now reads and writes secrets through that wrapper and
no longer imports keyring directly, so the documented "secrets live in the
keyring, not the dotfile" boundary is structural. config.keyring_usable stays
as a thin delegator so the auth-state facade (doctor/login and their tests) is
unchanged. The two clear_* paths collapse onto the shared delete_secret.

Tests that reached into config's keyring internals repointed to keyring_store
(config.keyring -> keyring_store.keyring, config.KEYRING_SERVICE ->
keyring_store.KEYRING_SERVICE). No behavior change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Bkx51XDcYBdnot1EF8h9U
@alexkroman alexkroman enabled auto-merge June 17, 2026 04:41
@alexkroman alexkroman added this pull request to the merge queue Jun 17, 2026
Merged via the queue into main with commit 4a3d8ba Jun 17, 2026
19 checks passed
@alexkroman alexkroman deleted the claude/extract-keyring-store branch June 17, 2026 04:47
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.

2 participants