Skip to content

docs: tell refresh clients to refresh one request at a time - #143

Merged
aaronbrethorst merged 2 commits into
OneBusAway:mainfrom
diveshpatil9104:docs/single-flight-refresh
Oct 11, 2026
Merged

aaronbrethorst merged 2 commits into
OneBusAway:mainfrom
diveshpatil9104:docs/single-flight-refresh

Conversation

@diveshpatil9104

Copy link
Copy Markdown
Contributor

Fixes #140.

Since #135, presenting a refresh token that was already used revokes every refresh
token the user holds, with no grace window. That puts a requirement on clients that
nothing wrote down: a client that sends two refreshes with the same token ends its
own user's sessions. One request wins, the other lands on the !rotated branch,
and its revocation runs after the winner commits (the #129 lock), so the
replacement the winner was just given is revoked too.

This adds that to the refresh section of the README and to the
/api/v1/auth/refresh description in openapi.yaml: refresh single-flight, with one
refresh in flight and any request that fails meanwhile waiting for its result.
It also says plainly that a lost response can't be handled the same way, since a
retry after the server processed the refresh presents a spent token and the user
has to log in again. The README notes that the Android app's refresh-on-401
interceptor has to work this way when it is added.

It also fixes a sentence #135 missed. The operation description in openapi.yaml
still said a consumed token is "rejected and logged". It now says the token also
revokes every refresh token the user holds, which is what the 401 description
already said.

I checked each claim against auth_refresh.go: both the UsedAt != nil and the
!rotated branches revoke, and both return the same 401.

#136 also edits these two files, so I kept this away from its lines (the README's
429 bullet and openapi's 429 description). git merge-tree against #136's branch
merges cleanly. Docs only. go build, go vet and go test pass, including the
openapi drift guards.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 58 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0257416a-00cc-445e-a07e-2a47c49483f1

📥 Commits

Reviewing files that changed from the base of the PR and between a672ab2 and 94bbd91.


📒 Files selected for processing (2)
  • README.md
  • openapi.yaml


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@aaronbrethorst

Copy link
Copy Markdown
Member

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

@aaronbrethorst aaronbrethorst left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This matches the server's rotation and reuse-detection behavior exactly, and fixes the openapi sentence #135 missed. Clear, useful guidance for client authors.

@aaronbrethorst
aaronbrethorst merged commit ba7cbe1 into OneBusAway:main Oct 11, 2026
3 checks passed
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.

Document single-flight refresh for clients of /api/v1/auth/refresh

2 participants