Skip to content

feat!: adapt auth client to authup camelCase management API - #117

Open
tada5hi wants to merge 2 commits into
mainfrom
feat/authup-camelcase-management-api
Open

feat!: adapt auth client to authup camelCase management API#117
tada5hi wants to merge 2 commits into
mainfrom
feat/authup-camelcase-management-api

Conversation

@tada5hi

@tada5hi tada5hi commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

What

authup renamed its entity / management-API vocabulary from snake_case → camelCase in c31b20ee9 ("refactor!: camelCase entity properties, domain types & management API", authup#3273). The OAuth2/OIDC protocol surface and JWT claims deliberately stay snake_case in that change.

This PR mirrors the rename onto flame_hub's AuthClient (which wraps authup's management API), so the client keeps working against the new authup.

Changes

  • flame_hub/_auth_client.py — model fields, method keyword arguments, and the rapiq filter / sort / field / include vocabulary are now camelCase:
    • display_name → displayName, realm_id → realmId, built_in → builtIn, created_at → createdAt, updated_at → updatedAt, name_locked → nameLocked, first_name → firstName, last_name → lastName
    • is_confidential → isConfidential, secret_hashed → secretHashed, secret_encrypted → secretEncrypted, grant_types → grantTypes, redirect_uri → redirectUri, base_url (client field) → baseUrl, root_url → rootUrl
    • junction ids role_id → roleId, permission_id → permissionId, user_id → userId, robot_id → robotId, client_id → clientId, policy_id → policyId, *_realm_id → *RealmId
    • relation includes role_realm → roleRealm, permission_realm → permissionRealm, user_realm → userRealm, robot_realm → robotRealm
  • Tests / docs updated to the camelCase vocabulary (tests/test_auth.py, tests/test_flow.py, README.md, docs/user_guide.rst).

Deliberately unchanged

  • BaseClient, CoreClient, StorageClient — untouched. A pydantic field name is the wire key, so no shared serialization changes were needed. The FLAME Hub core/storage services did not change and stay snake_case (so users never see mixed casing within one service).
  • _auth_flows.py — the OAuth2 /token surface (grant_type, client_id, client_secret, refresh_token, id, secret, …) stays snake_case, matching authup's frozen protocol surface. RobotAuth / ClientAuth credential kwargs are unchanged.
  • Scope is the casing rename only — this is based on authup#3273. Later/other authup commits (robot-entity removal #3275, auth_method replacing is_confidential, rapiq v2) are not in scope here.

Verification

  • ruff format + ruff check clean.
  • Non-integration suite: 58 passed.
  • Smoke checks: create/update payloads serialize camelCase on the wire; camelCase responses parse back; get_includable_names(...) returns the camelCase relation names.
  • Integration tests (-m integration, need a live Hub) were not run locally.

Note

The deployed FLAME Hub / authup image must serve the plan-073 camelCase API for the integration suite (and real usage) to pass — this client change should land together with (or after) the corresponding Hub/authup bump.

Breaking change

AuthClient model attributes, method keyword arguments, and rapiq filter/sort/field/include keys are now camelCase.

Summary by CodeRabbit

  • Changes
    • Standardized authentication client models and API parameters on camelCase naming.
    • Updated realm, user, role, permission, relationship, and client operations to use consistent identifier names.
    • Updated client creation, retrieval, modification, and deletion workflows to match the revised naming convention.
    • Updated authentication and permission tests to validate the new parameter and field names.

authup renamed its entity/management-API vocabulary from snake_case to
camelCase (authup/authup@c31b20ee9, "refactor!: camelCase entity
properties, domain types & management API", #3273). Its OAuth2/OIDC
protocol surface and JWT claims stay snake_case.

Mirror that on the AuthClient: model fields, method keyword arguments and
the rapiq filter/sort/field/include vocabulary move to camelCase
(display_name -> displayName, realm_id -> realmId, role_id -> roleId,
built_in -> builtIn, created_at -> createdAt, is_confidential ->
isConfidential, the *_realm relation includes -> *Realm, ...). Because a
pydantic field name is the wire key, the shared BaseClient and the
CoreClient / StorageClient are untouched and stay snake_case (the FLAME
Hub core/storage services did not change). The _auth_flows OAuth2 token
surface (grant_type, client_id, client_secret, refresh_token, id, secret)
stays snake_case.

Docs and tests are updated to the camelCase vocabulary.

BREAKING CHANGE: AuthClient model attributes, method keyword arguments and
rapiq filter/sort/field/include keys are now camelCase.
Copilot AI review requested due to automatic review settings July 20, 2026 09:25

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 510dcabe-5ea1-487c-9721-bc6a33efecaa

📥 Commits

Reviewing files that changed from the base of the PR and between c356a64 and 3ad0646.

📒 Files selected for processing (3)
  • flame_hub/_auth_client.py
  • tests/test_auth.py
  • tests/test_flow.py
💤 Files with no reviewable changes (1)
  • tests/test_auth.py

📝 Walkthrough

Walkthrough

AuthClient Pydantic models and public endpoint signatures now use camelCase fields and identifiers directly. Realm, permission, role, relationship, user, and client operations were updated, along with corresponding auth and flow tests.

Changes

camelCase AuthClient API

Layer / File(s) Summary
Schema and core resource updates
flame_hub/_auth_client.py
Auth resource models and realm, permission, and role methods now expose camelCase fields and parameters without the shared alias-generation base model.
Relationship endpoint updates
flame_hub/_auth_client.py
Role-permission, user-permission, and user-role operations use camelCase identifiers and payload fields.
Client endpoint updates
flame_hub/_auth_client.py
Client CRUD and update methods use camelCase identifiers, fields, and optional update values.
Usage and test alignment
tests/test_auth.py, tests/test_flow.py
Auth and flow tests were updated to call the camelCase API and inspect camelCase model attributes.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: pbrassel

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the breaking auth client shift to authup's camelCase management API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/authup-camelcase-management-api

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
flame_hub/_auth_client.py (2)

376-393: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Pre-existing policyId=None TODO carried through the rename.

create_permission still hard-codes policyId=None pending hub policy support. Not introduced here, but flagging so it isn't lost in the camelCase churn. Want me to open a tracking issue?

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flame_hub/_auth_client.py` around lines 376 - 393, The existing
create_permission implementation still passes policyId=None; preserve this
intentional TODO during the camelCase rename and do not remove or alter the
field until hub policy support is implemented.

24-279: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy lift

Consider keeping snake_case Python fields and adding camelCase aliases.
Renaming the model attributes themselves makes the client API a breaking change for downstream code; alias_generator=to_camel with populate_by_name=True would preserve the Python surface while still serializing camelCase on the wire.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@flame_hub/_auth_client.py` around lines 24 - 279, Preserve the existing
snake_case Python attribute names across the models in this diff instead of
exposing camelCase names such as displayName, realmId, and createdAt. Configure
the shared Pydantic model setup with alias_generator=to_camel and
populate_by_name=True so Python callers use snake_case while request
serialization and response parsing continue to use camelCase wire fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@flame_hub/_auth_client.py`:
- Around line 376-393: The existing create_permission implementation still
passes policyId=None; preserve this intentional TODO during the camelCase rename
and do not remove or alter the field until hub policy support is implemented.
- Around line 24-279: Preserve the existing snake_case Python attribute names
across the models in this diff instead of exposing camelCase names such as
displayName, realmId, and createdAt. Configure the shared Pydantic model setup
with alias_generator=to_camel and populate_by_name=True so Python callers use
snake_case while request serialization and response parsing continue to use
camelCase wire fields.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d3c04c8d-4a37-4674-8483-71af45980f5e

📥 Commits

Reviewing files that changed from the base of the PR and between 1d66a1f and c356a64.

📒 Files selected for processing (5)
  • README.md
  • docs/user_guide.rst
  • flame_hub/_auth_client.py
  • tests/test_auth.py
  • tests/test_flow.py

This was referenced Jul 27, 2026
@tada5hi tada5hi closed this Jul 29, 2026
@tada5hi tada5hi reopened this Jul 29, 2026
Take everything main brings (httpx2, per-request auth, the typing pass,
Hub v0.12.5 and the error-response and client-authentication fixes) and
keep this branch's explicit camelCase vocabulary on top of it.

main adapted the auth client to authup's camelCase management API in
22f93a6 by keeping snake_case attributes and deriving the wire names with
a pydantic alias generator (AuthBaseModel, alias_generator=to_camel). The
generator is dropped here: attribute names are spelled out as the wire
spells them, so the model is explicit about what is sent and received.

It also covers what an alias generator cannot reach. rapiq query
parameters are built from attribute names, so with snake_case attributes
the client sends filter[realm_id], sort=created_at and include=role_realm,
and authup silently ignores every key outside its allowed vocabulary
instead of rejecting it: filter[realm_id]=<uuid> returns all users while
filter[realmId]=<uuid> filters them.

The client models and the robot removal are taken from main, with
authMethod and tokenBindingMethod renamed to match.
@tada5hi

tada5hi commented Jul 29, 2026

Copy link
Copy Markdown
Contributor Author

Merged the latest main in (3ad0646). Everything main brings is taken as is: httpx2, per-request auth, the typing pass, Hub v0.12.5, the error-response and client-authentication fixes, and the removal of the robot entity.

One resolution is worth calling out. main adapted the auth client to authup's camelCase management API in 22f93a6 by keeping snake_case attributes and deriving the wire names with a pydantic alias generator (AuthBaseModel, alias_generator=to_camel). This branch drops the generator again and spells the attribute names as authup spells them, so the model states explicitly what is sent and received.

Beyond the preference for explicitness, an alias generator does not reach the query vocabulary. rapiq parameters are built from attribute names, so with snake_case attributes the client sends filter[realm_id], sort=created_at and include=role_realm — and authup silently ignores every key outside its allowed vocabulary rather than rejecting it. Verified against a live 1.0.0-beta.57 instance:

filter[realmId]=<random uuid>   -> total=0   (honored)
filter[realm_id]=<random uuid>  -> total=1   (silently ignored, returns everything)

main's new auth_method and token_binding_method client fields are renamed to authMethod and tokenBindingMethod accordingly, which is what beta.57 puts on the wire.

Note that this branch alone is not yet enough to talk to beta.57: single-resource responses are wrapped in a data/meta envelope there, which is #128 on top of this branch.

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.

2 participants