Skip to content

The mint seam takes a grant, not two callables - #290

Merged
czpython merged 1 commit into
mainfrom
oauth-grant-seam
Aug 19, 2026
Merged

The mint seam takes a grant, not two callables#290
czpython merged 1 commit into
mainfrom
oauth-grant-seam

Conversation

@czpython

@czpython czpython commented Aug 19, 2026

Copy link
Copy Markdown
Owner

OauthClient.mint_access_token now takes key= and grant= — one object carrying the two grant verbs — instead of the load_refresh_token= / save_refresh_token= callable pair from #285.

The engine's real dependency is a grant: something it can read fresh under the refresh lock and rotate durably. Two loose callables atomized that noun — nothing in the signature said they refer to the same grant, and the lock/commit contracts attached to two disconnected parameters. The verbs are now:

  • grant.load_refresh_token() -> str — runs under the refresh lock; must observe rotations other processes committed (read past the identity map).
  • grant.save_refresh_token(rotated) — must have committed before returning; the provider already invalidated the old token. The cache fills only after it returns.

The shape is duck-typed and documented on the parameter — no Protocol, no base class, no runtime registration.

McpOauthGrant carries the two verbs itself and the MCP mint wrapper passes the row. Redis keys, lock/cache semantics, and all observable MCP behavior are unchanged; the MCP tests pass untouched. The extension-author docs show the verbs as methods on the author's own grant row.

The engine tests pass small grant stubs, keep every behavioral assertion, and add one the seam affords: an error raised by a grant's own verb surfaces unmasked.

The callable kwargs are removed outright — they are days old with no external consumers.

Verification: ruff check + format clean, editable proof-extension install, full backend suite green (1277 passed).

🤖 Generated with Claude Code

@czpython
czpython force-pushed the oauth-grant-seam branch 3 times, most recently from d046d10 to 262c6d2 Compare August 19, 2026 14:45
mint_access_token(key=..., grant=...) now takes one object carrying the
two grant verbs: load_refresh_token() and save_refresh_token(rotated).
The engine's real dependency is a grant it can read fresh under the
refresh lock and rotate durably; two loose callables atomized that noun
and let a loader for one row pair silently with a saver for another.
The lock and commit contracts now live on the grant parameter's
documentation.

McpOauthGrant carries the two verbs itself; the MCP mint wrapper passes
the row. Redis keys, lock and cache semantics, and all observable MCP
behavior are unchanged.

The engine tests use small grant stubs, keep every behavioral
assertion, and add one the seam now affords: an error raised by a
grant's own verb surfaces unmasked.
@czpython
czpython merged commit b4498df into main Aug 19, 2026
1 check passed
@czpython
czpython deleted the oauth-grant-seam branch August 19, 2026 15:07
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