Skip to content

feat!: unwrap authup single-resource envelope - #128

Open
tada5hi wants to merge 2 commits into
feat/authup-camelcase-management-apifrom
feat/authup-single-resource-envelope
Open

feat!: unwrap authup single-resource envelope#128
tada5hi wants to merge 2 commits into
feat/authup-camelcase-management-apifrom
feat/authup-single-resource-envelope

Conversation

@tada5hi

@tada5hi tada5hi commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Stacked on #117.

Why

authup wraps every single-record entity response in a data/meta envelope since 1.0.0-beta.57 (authup/authup#3332). getOne, create, update and delete of all entity controllers now respond with {"data": ..., "meta": ...} instead of the entity itself, mirroring the envelope that collection responses have always used. meta carries response-scoped extras such as the queryable schema of the endpoint. The OAuth2 protocol surface (token, introspect, revoke, …) stays flat, so _auth_flows is unaffected.

What

  • BaseClient._unwrap_single_resource extracts the entity from the body of a single-resource response and returns it unchanged by default. It is called in _create_resource, _get_single_resource and _update_resource.
  • AuthClient overrides the hook to return the data property and raises a ValueError naming the required authup version if the property is absent, instead of failing with a KeyError deep inside pydantic.
  • The FLAME Hub core and storage services keep responding with the bare entity, so CoreClient and StorageClient are untouched. Collection responses were already validated as an envelope by ResourceList.

Verification

Unit tests over a mocked transport cover get/create/update unwrapping, the rejection of an unwrapped body, untouched collection responses and the untouched BaseClient default.

Additionally smoke tested against a live authup/authup:latest (1.0.0-beta.57) container: realm, role and user create → get → update → delete round-trip, as does get_user with an included realm.

Follow-ups (not in this PR)

Two further beta.57 breaks surfaced while testing against the live instance:

  • Robots are removed. /robots, /robot-permissions and /robot-roles respond with 404, the robot_credentials grant is gone, and machine identities are OAuth2 clients now. create_robot and friends, the Robot* models, RobotAuth and the robot fixtures in tests/test_auth.py are dead against beta.57.
  • Model drift. Permission.policyId no longer exists on the wire, which also breaks every response that includes a permission, such as find_role_permissions. Client.isConfidential is gone as well. New wire properties that the models do not expose: Permission.decisionStrategy, Client.authMethod, Client.tokenBindingMethod, Client.postLogoutRedirectUri, Client.accessPolicyId, Role.builtIn, Role.clientId, User.status, User.statusMessage and RolePermission.realmScope.

authup wraps every single-record entity response in a data/meta envelope
since 1.0.0-beta.57 (authup/authup@00f2f4c3a, "feat: query-capability
discovery via meta.schema + entity record response envelope", #3332).
getOne, create, update and delete of all entity controllers now respond
with {"data": ..., "meta": ...} instead of the entity itself, mirroring
the envelope that collection responses have always used. meta carries
response-scoped extras such as the queryable schema of the endpoint. The
OAuth2 protocol surface (token, introspect, revoke, ...) stays flat, so
_auth_flows is unaffected.

Add the _unwrap_single_resource hook to BaseClient, which returns the
response body unchanged, and call it in _create_resource,
_get_single_resource and _update_resource. AuthClient overrides the hook
to return the data property and raises a ValueError naming the required
authup version if the property is absent. The FLAME Hub core and storage
services keep responding with the bare entity, so CoreClient and
StorageClient are untouched. Collection responses were already validated
as an envelope by ResourceList.

BREAKING CHANGE: AuthClient requires authup 1.0.0-beta.57 or newer.
Copilot AI review requested due to automatic review settings July 29, 2026 12:41

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 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 1172549b-6fc4-4eac-ae0d-04fa7c67ed8f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

…single-resource-envelope

Rebuild the envelope handling on top of the merged base. _base_client
gained the _request indirection and per-request auth on main, so the
_unwrap_single_resource hook is re-applied to the three call sites that
validate a single resource, and the AuthClient override is re-applied to
the camelCase auth client.
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