Skip to content

feat(server-core): mount entity controllers under /realms/:realmId - #3049

Merged
tada5hi merged 2 commits into
masterfrom
feat/realm-scoped-routes
May 13, 2026
Merged

tada5hi merged 2 commits into
masterfrom
feat/realm-scoped-routes

Conversation

@tada5hi

@tada5hi tada5hi commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Dual-mount the six realm-aware controllers (client, robot, user, permission, policy, identity-provider) via @routup/decorators array paths at both /<entity> and /realms/:realmId/<entity>. Bumps @routup/decorators to ^4.2.0 for the DController(url: string | string[]) overload.
  • New RealmResolverMiddleware mounted at /realms/:realmId resolves the path segment (UUID or realm name) to a canonical UUID via IRealmRepository and stashes it on event.store. Two helpers in adapters/http/request/helpers/realm-id.ts (getRequestRealmID, applyRouteRealmIDToBody) let controllers read the realm and override data.realm_id on write — route realm wins silently over body realm.
  • Permission policy semantics are unchanged. system.realm-match still gates cross-realm writes; the route prefix is a routing convenience, not an authorization shortcut.

Resolves the long-standing precedence bug originally flagged on IdentityProviderController.write() in PR #3030 review: lookups and creates no longer ignore the route's :realmId in favour of body or actor-identity realm.

Closes #3031

Test plan

  • npm run build -w apps/server-core clean
  • npm run test -w apps/server-core -- test/unit/http/controllers/entities/realm-scoped.spec.ts — 9/9 pass (user list by name/UUID/404, route-wins-over-body create, smoke GET for the other 5 nested entities)
  • npm run test -w apps/server-core — full HTTP suite green (existing tests should be unaffected — non-nested routes get a no-op middleware path)
  • Manual smoke: hit GET /realms/master/users and GET /realms/<unknown>/users against a dev server

Summary by CodeRabbit

  • New Features

    • Entity endpoints (clients, identity providers, permissions, policies, robots, users) now support realm-scoped access via /realms/:realmId/ routes alongside global endpoints.
    • Added request helpers and a realm-resolver middleware that resolve and apply route realm IDs to requests; middleware is mounted early in HTTP pipeline.
  • Documentation

    • Architecture docs updated with realm scoping behavior, HTTP wiring, and nested route mounting patterns.
  • Chores

    • Dependency bump for routing decorators.
  • Tests

    • Added tests covering realm-scoped controller behavior and nested mount scenarios.

Review Change Stack

Dual-mount six realm-aware controllers (client, robot, user, permission,
policy, identity-provider) via @routup/decorators array paths at both
`/<entity>` and `/realms/:realmId/<entity>`.

RealmResolverMiddleware (registered at `/realms/:realmId`) accepts the
path segment as UUID or realm name, resolves via IRealmRepository, and
stashes the canonical UUID on event.store. Controllers read it through
`getRequestRealmID(event)` — falling back to `event.params.realmId` for
non-nested routes — because the decorator-mounted route re-extracts the
raw URL segment into params after the middleware runs.

Writes call `applyRouteRealmIDToBody(event, data)` at the top of
add/edit/put handlers so the route realm wins silently over body realm.
system.realm-match still gates cross-realm writes; the prefix is a
routing convenience, not an authorization shortcut.

Bumps @routup/decorators to ^4.2.0 for the
`DController(url: string | string[])` overload.

Closes #3031
Copilot AI review requested due to automatic review settings May 12, 2026 15:42
@coderabbitai

coderabbitai Bot commented May 12, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4aef564b-9239-4418-94a3-f31ed765cfe5

📥 Commits

Reviewing files that changed from the base of the PR and between d17610b and d0a6571.

📒 Files selected for processing (2)
  • .agents/architecture.md
  • apps/server-core/src/app/modules/http/modules/middleware.ts
✅ Files skipped from review due to trivial changes (1)
  • .agents/architecture.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/server-core/src/app/modules/http/modules/middleware.ts

📝 Walkthrough

Walkthrough

This PR adds realm-scoped HTTP routing to entity controllers. It introduces request helpers to manage realm ID context, a new RealmResolverMiddleware that resolves realm identifiers from route parameters, updates six entity controllers to support dual-mounted routes (/path and /realms/:realmId/path), and includes integration tests and documentation.

Changes

Realm-Scoped HTTP Endpoints

Layer / File(s) Summary
Request realm helpers
apps/server-core/src/adapters/http/request/helpers/realm-id.ts, apps/server-core/src/adapters/http/request/helpers/index.ts
New utilities manage realm ID on HTTP events: setRequestRealmID stores to event.store, getRequestRealmID retrieves stored or route-parameter realm ID, and applyRouteRealmIDToBody injects resolved realm ID into request payloads.
Realm resolver middleware
apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/*
RealmResolverMiddleware resolves realm from route :realmId parameter (UUID or name via IRealmRepository.resolve), stores the UUID via setRequestRealmID, and throws EntityNotFoundError if unresolved. Factory, index barrel, and types included.
Package dependency update
apps/server-core/package.json
@routup/decorators updated from ^4.1.0 to ^4.2.0 to support multi-path controller routing (e.g., @DController(['/path', '/realms/:realmId/path'])).
HTTP middleware integration
apps/server-core/src/app/modules/http/modules/middleware.ts
HTTPMiddlewareModule.mountRealmResolver() wires realm resolver middleware: resolves repository from DI container, wraps with RealmRepositoryAdapter, creates the middleware, and registers it on /realms/:realmId/:nested during mountBefore before authorization.
Entity controller realm-scoped routes
apps/server-core/src/adapters/http/controllers/entities/{client,identity-provider,permission,policy,robot,user}/module.ts
Client, Identity Provider, Permission, Policy, Robot, and User controllers updated: @DController now includes realm-scoped paths; reads use getRequestRealmID(event) for realm; writes call applyRouteRealmIDToBody(event, data) to inject route realm ID into payloads before service calls.
Integration tests
apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts
Tests verify realm-scoped user endpoints with realm name and UUID, 404 on unknown realm, request body realm_id overridden by route realm, and smoke tests for nested entity GET endpoints.
Architecture documentation
.agents/architecture.md
Documented controller realm scoping conventions, HTTP request helpers, realm resolver middleware wiring, nested route mounting pattern, request flow, realm ID precedence, and routing behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • authup/authup#2945: Refactors HTTPMiddlewareModule DI container types and dependency resolution in middleware wiring; related to integrating the realm resolver middleware.

Poem

🐰 I hopped through routes both wide and deep,
Nesting realms where handlers keep,
Middleware whispers UUIDs clear,
Controllers heed the route they hear,
A tiny rabbit cheers the new frontier.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: mounting entity controllers under /realms/:realmId routes.
Linked Issues check ✅ Passed The PR addresses issue #3031 by implementing route-realm precedence across all affected controllers using consistent helpers.
Out of Scope Changes check ✅ Passed All changes are directly related to the objectives: realm-scoped routing, middleware, helpers, and related documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/realm-scoped-routes

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 and usage tips.

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.

Pull request overview

This PR adds nested realm-scoped routing for key entity controllers in apps/server-core by dual-mounting them at both flat paths (e.g. /users) and nested paths (e.g. /realms/:realmId/users). It introduces a realm-resolver middleware + request helpers so controllers can consistently treat the route realm as authoritative (especially for writes) while keeping existing permission semantics intact.

Changes:

  • Dual-mount six realm-aware controllers under both /<entity> and /realms/:realmId/<entity> and update controller read/write paths to use getRequestRealmID() / applyRouteRealmIDToBody().
  • Add RealmResolverMiddleware mounted at /realms/:realmId to resolve realm name/UUID to a canonical UUID stored on event.store.
  • Add unit tests for nested-route availability and “route realm overrides body realm_id” on create, plus bump @routup/decorators to support array controller paths.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
package-lock.json Updates routup-related dependency versions and lockfile entries for the new decorators capability.
apps/server-core/package.json Bumps @routup/decorators to ^4.2.0 (array path overload).
apps/server-core/src/app/modules/http/modules/middleware.ts Mounts the new realm resolver middleware at /realms/:realmId.
apps/server-core/src/adapters/http/request/helpers/realm-id.ts Adds request helpers to read/store resolved realm UUID and to force route realm onto write payloads.
apps/server-core/src/adapters/http/request/helpers/index.ts Exports the new realm-id helpers.
apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/types.ts Defines the realm-resolver middleware context type.
apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/module.ts Implements realm key resolution and stashing of the canonical realm UUID.
apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/factory.ts Adds factory to expose the resolver as a Routup handler.
apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/index.ts Barrel export for realm-resolver middleware module/factory/types.
apps/server-core/src/adapters/http/middleware/built-in/index.ts Re-exports realm-resolver middleware from built-in middleware index.
apps/server-core/src/adapters/http/controllers/entities/user/module.ts Dual-mounts under /realms/:realmId/users and applies route realm to reads/writes.
apps/server-core/src/adapters/http/controllers/entities/robot/module.ts Dual-mounts under /realms/:realmId/robots and applies route realm to reads/writes.
apps/server-core/src/adapters/http/controllers/entities/policy/module.ts Dual-mounts under /realms/:realmId/policies and applies route realm to reads/writes.
apps/server-core/src/adapters/http/controllers/entities/permission/module.ts Dual-mounts under /realms/:realmId/permissions and applies route realm to reads/writes.
apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts Dual-mounts under /realms/:realmId/identity-providers and applies route realm precedence in lookups/writes.
apps/server-core/src/adapters/http/controllers/entities/client/module.ts Dual-mounts under /realms/:realmId/clients and applies route realm to reads/writes.
apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts Adds unit tests for nested route reachability and route-realm precedence on create.
.agents/architecture.md Documents the nested route mounting model and the “route realm wins” convention.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +28 to +33
if (isUUID(value)) {
setRequestRealmID(event, value);
return;
}

const realm = await this.realmRepository.resolve(value);
Comment on lines 47 to 49
@DTags('oauth2')
@DController('/clients')
@DController(['/clients', '/realms/:realmId/clients'])
export class ClientController {
Comment on lines 41 to 43
@DTags('user')
@DController('/users')
@DController(['/users', '/realms/:realmId/users'])
export class UserController {
Comment on lines 52 to 54
@DTags('robot')
@DController('/robots')
@DController(['/robots', '/realms/:realmId/robots'])
export class RobotController {
Comment on lines 46 to 48
@DTags('permission')
@DController('/permissions')
@DController(['/permissions', '/realms/:realmId/permissions'])
export class PermissionController {
Comment on lines 46 to 48
@DTags('policy')
@DController('/policies')
@DController(['/policies', '/realms/:realmId/policies'])
export class PolicyController {
Comment on lines 75 to 77
@DTags('identity')
@DController('/identity-providers')
@DController(['/identity-providers', '/realms/:realmId/identity-providers'])
export class IdentityProviderController {
Comment on lines +40 to +78
describe('user', () => {
it('should list users via /realms/<name>/users', async () => {
const response = await httpRequest(suite, 'GET', '/realms/master/users', { headers: { Authorization: basicAuth } });

expect(response.status).toEqual(200);
const body = await response.json();
expect(body.data).toBeDefined();
expect(Array.isArray(body.data)).toBe(true);
});

it('should list users via /realms/<uuid>/users', async () => {
const response = await httpRequest(suite, 'GET', `/realms/${masterRealm.id}/users`, { headers: { Authorization: basicAuth } });

expect(response.status).toEqual(200);
});

it('should 404 on unknown realm key in path', async () => {
const response = await httpRequest(suite, 'GET', '/realms/this-realm-does-not-exist/users', { headers: { Authorization: basicAuth } });

expect(response.status).toEqual(404);
});

it('should create user under route realm, overriding body realm_id', async () => {
// body points at scopedRealm (a realm the admin can't write to);
// route says master. If the override works, the user lands in
// master and the permission check passes (admin is in master).
// If body won instead, the request would 403.
const payload = { ...createFakeUser(), realm_id: scopedRealm.id };

const response = await httpRequest(suite, 'POST', `/realms/${masterRealm.id}/users`, {
headers: { Authorization: basicAuth, 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});

expect(response.status).toEqual(201);
const body = await response.json();
expect(body.realm_id).toEqual(masterRealm.id);
expect(body.realm_id).not.toEqual(scopedRealm.id);
});

@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.

Actionable comments posted: 1

🧹 Nitpick comments (2)
apps/server-core/src/app/modules/http/modules/middleware.ts (1)

119-124: ⚖️ Poor tradeoff

Consider mounting position relative to RealmController.

The documentation notes (architecture.md lines 532-533) that RealmController is mounted at /realms with routes like /realms/:id, and this realm-resolver middleware also fires on those URLs (prefix match), causing one extra realmRepository.resolve() call per realm-CRUD request.

While the docs acknowledge this as acceptable, consider whether mounting the resolver more specifically (e.g., only on the entity paths that need it: /realms/:realmId/users, /realms/:realmId/clients, etc.) would be more efficient. This would avoid the unnecessary resolution for RealmController endpoints.

🤖 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 `@apps/server-core/src/app/modules/http/modules/middleware.ts` around lines 119
- 124, The mountRealmResolver middleware is currently mounted broadly with
router.use('/realms/:realmId', middleware) in mountRealmResolver and thus runs
for RealmController endpoints too; change its mounting to only the specific
subpaths that actually need a resolved realm (for example mount under
'/realms/:realmId/users', '/realms/:realmId/clients', '/realms/:realmId/roles',
etc.) by replacing the single router.use('/realms/:realmId', middleware) with
explicit router.use calls for those entity routes (or call middleware when
registering those routers), keeping createRealmResolverMiddleware and
RealmRepositoryAdapter usage the same so you avoid extra
realmRepository.resolve() calls on plain /realms CRUD endpoints.
apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts (1)

62-78: ⚡ Quick win

Consider adding a conflict detection test.

The current test validates that route realm overrides body realm, but consider adding a test case that explicitly validates the conflict scenario: when route and body specify different realms, does the system detect and handle this appropriately? The PR objectives mention "If route and body realm_id conflict, return a BadRequest."

However, based on the implementation in applyRouteRealmIDToBody, it appears the route realm silently wins rather than detecting conflicts. This may be intentional per the PR description ("route realm silently wins"), but the test suite should clarify this behavior.

🤖 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 `@apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts`
around lines 62 - 78, Add a unit test in realm-scoped.spec.ts that explicitly
asserts the conflict behavior when route and body realm_id differ: craft a POST
to /realms/{routeRealm.id}/users with a payload containing a different realm_id
and assert the API returns a 400 Bad Request (per the PR objective that
conflicts should fail), referencing the existing test pattern (use httpRequest,
basicAuth, createFakeUser) and the function applyRouteRealmIDToBody to locate
the logic under test; if the implementation intentionally lets the route
silently win, instead add a clarifying test that asserts the route-wins behavior
and update the test name/comment to document which behavior is intended.
🤖 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.

Inline comments:
In `@apps/server-core/package.json`:
- Line 82: The PR claims "@routup/decorators": "^4.2.0" was bumped to enable
DController(url: string | string[]) array paths support, but the package docs
show only single-string controllers; verify the actual changelog/commit history
or source of `@routup/decorators` v4.2.0 to confirm if DController supports
string[] paths, and then either (a) update the PR description to state the true
reason for the upgrade (cite the exact feature/bugfix from the changelog) or (b)
if array-path support is not present, remove that claim and/or revert the
version bump and instead adopt the correct version that adds the feature;
reference the dependency line "@routup/decorators": "^4.2.0" and the
DController(url: string | string[]) mention when making the correction.

---

Nitpick comments:
In `@apps/server-core/src/app/modules/http/modules/middleware.ts`:
- Around line 119-124: The mountRealmResolver middleware is currently mounted
broadly with router.use('/realms/:realmId', middleware) in mountRealmResolver
and thus runs for RealmController endpoints too; change its mounting to only the
specific subpaths that actually need a resolved realm (for example mount under
'/realms/:realmId/users', '/realms/:realmId/clients', '/realms/:realmId/roles',
etc.) by replacing the single router.use('/realms/:realmId', middleware) with
explicit router.use calls for those entity routes (or call middleware when
registering those routers), keeping createRealmResolverMiddleware and
RealmRepositoryAdapter usage the same so you avoid extra
realmRepository.resolve() calls on plain /realms CRUD endpoints.

In `@apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts`:
- Around line 62-78: Add a unit test in realm-scoped.spec.ts that explicitly
asserts the conflict behavior when route and body realm_id differ: craft a POST
to /realms/{routeRealm.id}/users with a payload containing a different realm_id
and assert the API returns a 400 Bad Request (per the PR objective that
conflicts should fail), referencing the existing test pattern (use httpRequest,
basicAuth, createFakeUser) and the function applyRouteRealmIDToBody to locate
the logic under test; if the implementation intentionally lets the route
silently win, instead add a clarifying test that asserts the route-wins behavior
and update the test name/comment to document which behavior is intended.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3f9afac9-d6fc-4dac-aa76-120f20829174

📥 Commits

Reviewing files that changed from the base of the PR and between c639a05 and d17610b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (17)
  • .agents/architecture.md
  • apps/server-core/package.json
  • apps/server-core/src/adapters/http/controllers/entities/client/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/identity-provider/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/permission/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/policy/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/robot/module.ts
  • apps/server-core/src/adapters/http/controllers/entities/user/module.ts
  • apps/server-core/src/adapters/http/middleware/built-in/index.ts
  • apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/factory.ts
  • apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/index.ts
  • apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/module.ts
  • apps/server-core/src/adapters/http/middleware/built-in/realm-resolver/types.ts
  • apps/server-core/src/adapters/http/request/helpers/index.ts
  • apps/server-core/src/adapters/http/request/helpers/realm-id.ts
  • apps/server-core/src/app/modules/http/modules/middleware.ts
  • apps/server-core/test/unit/http/controllers/entities/realm-scoped.spec.ts

"@routup/basic": "^2.1.0",
"@routup/cors": "^1.0.1",
"@routup/decorators": "^4.1.0",
"@routup/decorators": "^4.2.0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Verify `@routup/decorators` version 4.2.0 exists and check for security advisories

# Check if version 4.2.0 exists on npm
echo "Checking `@routup/decorators` version 4.2.0 on npm..."
curl -s https://registry.npmjs.org/@routup/decorators/4.2.0 | jq -r '.version // "Version not found"'

# Get all available versions
echo -e "\nAvailable versions:"
curl -s https://registry.npmjs.org/@routup/decorators | jq -r '.versions | keys[]' | tail -10

# Check for security advisories
echo -e "\nChecking for security advisories..."
gh api graphql -f query='
{
  securityVulnerabilities(first: 5, ecosystem: NPM, package: "@routup/decorators") {
    nodes {
      advisory {
        summary
        severity
        publishedAt
      }
      vulnerableVersionRange
      firstPatchedVersion {
        identifier
      }
    }
  }
}'

Repository: authup/authup

Length of output: 1946


🌐 Web query:

@routup/decorators 4.2.0 DController array paths support

💡 Result:

Summary: The published @routup/decorators docs (including the examples shown for the decorators package) do not indicate that DController accepts an array of path strings (e.g., @DController(['/a','/b'])). The example shown uses a single string path in @DController('/users'), not an array. There is therefore no evidence from the authoritative package documentation that “array paths” are supported in version 4.2.0 (or at all), and the best-supported usage is a single string path per DController. What the sources show 1) The @routup/decorators package example defines a controller with a single string path: @DController('/users'). [1] 2) The same documentation snippet shows a method decorator with a second argument for DDelete('/:id',[]) (i.e., an array is used as an argument for that specific decorator invocation), but this is not presented as “array paths” for DController. [1] 3) The example also shows how the decorators plugin is mounted, via decorators({controllers:[UserController],...}). This again implies controllers are registered as classes and their base route comes from the single path argument given to @DController. [1] Answer to the query - Does @routup/decorators 4.2.0 DController support array paths? Based on the available authoritative documentation, there is no stated/ documented support for passing an array of paths to @DController; only a single string path is shown. [1] Suggested workaround (if you need multiple base paths) - Create multiple controllers (or multiple decorated classes) each with its own @DController('') base path, and register them in the decorators plugin’s controllers list. This is consistent with the way controllers are passed to decorators({ controllers: [...] }). [1]

Citations:


Clarify the purpose of the @routup/decorators version bump.

The PR states this version is required for DController(url: string | string[]) array paths support, but official package documentation shows only single string paths are supported (@DController('/users')). Confirm whether version 4.2.0 actually provides this feature or update the PR description to reflect the actual reason for the upgrade.

🤖 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 `@apps/server-core/package.json` at line 82, The PR claims
"@routup/decorators": "^4.2.0" was bumped to enable DController(url: string |
string[]) array paths support, but the package docs show only single-string
controllers; verify the actual changelog/commit history or source of
`@routup/decorators` v4.2.0 to confirm if DController supports string[] paths, and
then either (a) update the PR description to state the true reason for the
upgrade (cite the exact feature/bugfix from the changelog) or (b) if array-path
support is not present, remove that claim and/or revert the version bump and
instead adopt the correct version that adds the feature; reference the
dependency line "@routup/decorators": "^4.2.0" and the DController(url: string |
string[]) mention when making the correction.

@tada5hi

tada5hi commented May 12, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 12, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Previously the middleware was mounted at `/realms/:realmId`, which also
intercepted bare RealmController routes including `PUT /realms/:id` (the
upsert path). On a create-via-PUT, the realm doesn't exist yet, so the
middleware threw EntityNotFoundError before the controller could create
it — breaking the existing `realm.spec.ts > should create and update
resource with put` test.

Mount at `/realms/:realmId/:nested` so the middleware only fires when
there is at least one path segment after `:realmId`. Nested-entity URLs
(`/realms/master/users/...`) still match; RealmController's own routes
(CRUD, openid-config, jwks) are no longer intercepted.
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.

identity-provider write() ignores route realmId on nested routes

2 participants