feat(frontier): add FlowIntent and the consent document RPC - #502
feat(frontier): add FlowIntent and the consent document RPC#502rohanchkrabrty wants to merge 1 commit into
Conversation
Frontier cannot tell a signup from a login today: AuthenticateRequest carries no intent, so a login with an unknown address creates the account. FlowIntent separates the two, and its zero value keeps every existing client on today's create-or-get behaviour. Consent rides on the same request. accepted_document_ids carries the ids the user accepted, and ListConsentDocuments serves the list they came from, unauthenticated like ListAuthStrategies so a sign-up view can render the documents before the account exists. Both fields land here together so neither can claim the other's number. Flat fields rather than a oneof over login and signup arms: AuthenticateRequest.email is already a field only some strategies use, checked at runtime, so this is the shape the message has. AuthCallback needs neither field, since both ride on the flow. Part of RFC 0002: https://github.com/raystack/frontier/blob/main/docs/rfcs/0002-explicit-consent-at-signup.md Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VW3nysiE4H83VQk6BroMYc
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe Frontier API adds an unauthenticated Suggested reviewers: Merge Risk: ⚪ Minimal · up to This adds consent-document listing and explicit authentication-flow fields without changing existing fields or RPCs; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (1 skipped: 1 unsupported.) Warning Some tools did not complete. Review the errors below. 🔧 Buf (1.72.0)raystack/frontier/v1beta1/frontier.protofatal: unable to access 'https://github.com/raystack/proton.git/': Failed to connect to github.com port 443 via 127.0.0.1 after 0 ms: Could not connect to server 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. Comment |
|
The latest Buf updates on your PR. Results from workflow Validate / validate (pull_request).
|
Part of RFC 0002: Explicit consent at signup. Frontier pulls this through
PROTON_COMMIT; nothing here is frontier logic.Adds one enum, two fields and one read-only RPC to
FrontierService:Why the intent. Frontier cannot tell a signup from a login today.
AuthenticateRequestcarries no intent and every strategy ends atgetOrCreateUser, so a login with an unknown address creates the account — through a view that never showed the documents.flow_intentseparates the two: a login never creates an account, a signup never logs an existing user in. It is also what lets a consent check run before the browser leaves for the identity provider, where the email is not yet known but the intent is.Why the documents. A deployment lists the documents it requires in server config with an id, title, version and URL.
ListConsentDocumentsserves that list and the client sends back the ids it accepted inaccepted_document_ids. Ids rather than one boolean, because the list the client rendered can still differ from config, and ids expose the mismatch instead of stamping a record that says the user accepted something they never saw.Deliberate choices, so they do not read as oversights:
flow_intentkeeps today's create-or-get behaviour.oneofoverLoginIntent/SignupIntentarms with the ids on the signup arm. Aoneofwould make a signup-only field unrepresentable on a login rather than merely rejected, butAuthenticateRequest.emailis already a field only some strategies use and is checked at runtime, so the flat field is the shape this message has. RFC alternative 8 records the tradeoff; moving later means deprecating field 6 and carrying both for a window.AuthCallbackgains nothing. Both values ride on the flow row, which is written before the redirect and read after it returns, so neither passes through the browser.ListConsentDocumentsis separate fromListAuthStrategies. Consent is not a strategy, andAuthStrategycarriesnameandparamsand nothing else, so the documents would go in aparamsmap every client has to parse.ListAuthStrategies. The document URLs are meant to be read by anyone considering an account, and the ids are an input to an unauthenticatedAuthenticate— requiring a session to learn what to accept before the account exists is a cycle.buf lint,buf buildandbuf breaking --against '.git#branch=main'are all clean. Additive only; no existing field or RPC changes.🤖 Generated with Claude Code
Supersedes #501, which GitHub auto-closed when its head branch was renamed. Same commit, same content.