Refresh an issuer value when the issuer orders it - #46
Merged
Conversation
An issuer can end a value before its expiry, as an OAuth provider does when it revokes the previous token at a refresh. POST /refresh/<host id>/<service> makes the exchange forget the held value, fetch now, and push at once where the provider holds the value. 503 with Retry-After when the issuer gives nothing usable, 404 for an unknown entry, 409 for a static one. The exchange's current, push, and refresh take the host row and resolve the provider from host.provider, the way the hosts service does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
czpython
force-pushed
the
dru-481-refresh-order
branch
from
September 7, 2026 13:22
5546671 to
70d00ec
Compare
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.
What changes
POST /refresh/{host_id}/{service}on the exchange. An issuer that ends a value before its expiry, as an OAuth provider does when it revokes the previous token at a refresh, orders a refresh. The exchange forgets the held value, fetches now, and on a provider that holds the value pushes at once.Secrets.refreshreplaces the entry'sRefreshableSecretwith a fresh one and runs the existingpushorrefreshon it, so the retry wait and the push bookkeeping stay the code they are. It raisesIssuerUnavailableErrorwhen nothing valid came back.200after the refresh and the push.503withRetry-After: 5when the issuer gave nothing usable or the push failed, and the entry then waits as after any failed fetch.404for an unknown host or service.409for a static entry. The route logs the host and the service, never a value./authorizewith no wait, an sbx entry gets the new value pushed at once and the timer finds it fresh afterwards, a failed fetch answers503and the next request waits out the retry delay, a failed push answers503and logs no value, an unknown host or service, and a static entry.docs/api.mdlists the exchange's endpoints.docs/security.mdstates the order's trust: no value, no token, one fetch at most.docs/architecture.mddescribes the flow.Where this differs from the ticket
Secrets.currentand the push timer are unchanged.Names
Secrets.refresh, besidecurrentandpush. The route isrefresh, the word the exchange already uses for the act.Gates
uv run ruff check,uv run ruff format --check,uv run pyright, anduv run pytestare green, 680 tests.Review
Pending.
🤖 Generated with Claude Code