feat(hutch,ios): discover the reader session-mint action instead of hard-coding it#925
Merged
FagnerMartinsBrack merged 1 commit intoJul 5, 2026
Conversation
…ard-coding it The iOS reader mints a browser session cookie from the bearer token before loading the cookie-authenticated reader page. The client hard-coded that route and method (`POST /auth/session`), so a server-side rename would break every article tap until an App Store release — the exact URL coupling the hypermedia contract exists to remove. - Server: advertise a `create-session` action on the collection (href `/auth/session`, method POST). It carries no fields — the route reads the bearer from the Authorization header — and no title, since it is a machine capability a client invokes bespoke rather than a rendered control (like `save-articles`). - Client: discover the action from the loaded collection and follow its href and method to mint the session; map `create-session` to a non-toolbar presentation so it never renders as a control. A server that hasn't advertised the action yet falls back to the fixed path, so an older shipped build keeps working. The action is additive and non-breaking: a client without a handler skips it.
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.
Purpose
The iOS in-app reader mints a browser session cookie from the bearer token before loading the cookie-authenticated reader page. The client hard-coded that route and method (
POST /auth/session), so a server-side rename would break every article tap ("Couldn't open the reader") until an App Store release — the flagship URL-coupling the hypermedia contract exists to remove, sitting on the app's core flow in its slowest-shipping client.What changed & the value
collection-siren.ts): advertise acreate-sessionaction on the collection —href: /auth/session,method: POST. No fields (the route reads the bearer from theAuthorizationheader) and no title, because it's a machine capability a client invokes bespoke, not a rendered control (mirroring the untitledsave-articles). Additive and non-breaking: a client without a handler skips it.create-sessionmaps to a non-toolbar presentation so it never renders as a control. A server that hasn't advertised it yet falls back to the fixed path, so an older shipped build keeps working (App-Store back-compat).Now a server can move
/auth/sessionby changing the action's href; the client follows it with no release.Deploy ordering
Deploy the server (advertising
create-session) before it matters; the client change is safe to ship in either order thanks to the fallback.Testing
collection-siren.test.tsgreen (18 tests incl. the newcreate-sessionassertion);pnpm checkpasses./custom/sessionand a VM test that mints via the server-advertised action; coverage gate + STAGING smoke pass.