Skip to content

feat: replace hand-written URL builders with generated ones#529

Open
gjtorikian wants to merge 1 commit into
mainfrom
generated-url-builders
Open

feat: replace hand-written URL builders with generated ones#529
gjtorikian wants to merge 1 commit into
mainfrom
generated-url-builders

Conversation

@gjtorikian

Copy link
Copy Markdown
Contributor

Summary

  • Replaces the hand-maintained authorization URL builders with methods generated by the Ruby emitter (regenerated from oagen-emitters), deleting the fence copies they replace: UserManagement#get_authorization_url (H09), UserManagement#get_logout_url, and SSO#get_authorization_url (H14).
  • The generated builders accept an optional per-call client_id override that falls back to the client's configured value.
  • Serialization is unchanged: provider_scopes is joined as CSV and provider_query_params is encoded as JSON, matching the deleted hand-written code.
  • Behavior change: a missing client_id / provider is no longer validated client-side — the URL simply omits client_id, matching the Python SDK.
  • Adds a WorkOS::OMIT sentinel for nullable optional parameters (distinguishes an omitted argument from an explicit nil) and updates the Sorbet RBIs and AuthKit helper tests accordingly.

🤖 Generated with Claude Code

…ones

The Ruby emitter now generates url-builder methods (regenerated from
oagen-emitters) with an optional per-call client_id override that falls
back to the client's configured value. Delete the hand-maintained fence
copies they replace:

- UserManagement#get_authorization_url (H09) and #get_logout_url
- SSO#get_authorization_url (H14)

The generated builders serialize provider_scopes (CSV) and
provider_query_params (JSON) like the deleted hand-written code.
Behavior change: a missing client_id / provider is no longer validated
client-side — the URL simply omits client_id, matching the Python SDK.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@gjtorikian
gjtorikian requested review from a team as code owners July 27, 2026 15:03
@gjtorikian
gjtorikian requested a review from nicknisi July 27, 2026 15:03
@workos-sdk-automation

Copy link
Copy Markdown
Contributor

🤖 This pull request was closed automatically

It edits files that are auto-generated by (each file has a header comment identifying it as generated). Hand edits to generated code are overwritten the next time the SDK is regenerated from the OpenAPI spec, so they can't be merged.

Generated files changed outside their hand-maintainable regions:

  • lib/workos.rb
  • lib/workos/sso.rb
  • lib/workos/user_management.rb
  • rbi/workos/sso.rbi
  • rbi/workos/user_management.rbi

What to do instead

  • Generated code (models, resources, client wiring): make the change upstream in the OpenAPI spec so it lands on the next regeneration.
  • Hand-maintained code inside a generated file: only the regions fenced by @oagen-ignore-start@oagen-ignore-end may be edited by hand. Keep your changes within those fences.
  • Adding, moving, or removing a fence (@oagen-ignore-start / @oagen-ignore-end): fence boundaries are owned by the generator, so they can't change in a hand-authored PR. This must come from a regeneration PR (opened by the SDK Automation Bot or carrying the autogenerated label).

If you believe this was closed in error, a maintainer can reopen the PR.

@greptile-apps

greptile-apps Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Replaces hand-written authorization and logout URL construction with generated builders and adds generated API surface updates.

  • Adds per-call client ID overrides with configured-client fallback for SSO and User Management authorization URLs.
  • Introduces WorkOS::OMIT to distinguish omitted nullable arguments from explicit nil values.
  • Regenerates Sorbet declarations and updates AuthKit URL-helper tests.

Confidence Score: 3/5

The PR is not yet safe to merge because explicit null updates are discarded and the generated authorization URL RBIs reject valid runtime calls.

The shared HTTP serializer compacts request bodies after sentinel-backed fields are added, defeating the new explicit-null contract, while both new authorization URL declarations require keywords that their runtime implementations default.

Files Needing Attention: lib/workos/base_client.rb, lib/workos/user_management.rb, rbi/workos/user_management.rbi, rbi/workos/sso.rbi

Important Files Changed

Filename Overview
lib/workos.rb Adds the WorkOS::OMIT sentinel and an Agents loader collapse entry.
lib/workos/sso.rb Replaces hand-written SSO authorization and logout URL construction with generated local URL builders.
lib/workos/user_management.rb Adds generated URL/API methods and sentinel-backed nullable fields, but shared serialization still drops explicit nulls.
rbi/workos/sso.rbi Adds declarations for generated SSO URL builders, with optional runtime keywords incorrectly represented as required.
rbi/workos/user_management.rbi Adds declarations for generated User Management methods, with authorization URL defaults not reflected in the RBI.
test/workos/test_authkit_helpers.rb Updates AuthKit helper coverage for omitted and overridden client IDs.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  App[Host application] --> Builder[Generated URL builder]
  Client[Configured client_id] --> Builder
  Override[Per-call client_id] --> Builder
  Builder --> URL[Authorization or logout URL]
  App --> API[WorkOS authorization endpoint]
  URL --> API
Loading

Reviews (2): Last reviewed commit: "feat: replace hand-written authorization..." | Re-trigger Greptile

Comment thread lib/workos/user_management.rb
Comment thread rbi/workos/user_management.rbi
@gjtorikian gjtorikian reopened this Jul 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant