Skip to content

fix(rest): unwrap getMetaItem envelope so nav capability gate fires (ADR-0057 D10)#2166

Merged
xuyushun441-sys merged 1 commit into
mainfrom
fix/adr-0057-d10-envelope-unwrap
Jun 22, 2026
Merged

fix(rest): unwrap getMetaItem envelope so nav capability gate fires (ADR-0057 D10)#2166
xuyushun441-sys merged 1 commit into
mainfrom
fix/adr-0057-d10-envelope-unwrap

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Follow-up fix to ADR-0057 D10 (#2150).

The bug (you reported it)

Even on latest single-tenant code, Organizations still showed in the Setup app sidebar.

Root cause

GET /meta/app/:name returns a metadata envelope { type, name, item: <app>, ... }, but filterAppForUser was handed the envelope — whose .navigation is undefined — so it returned it untouched. That silently bypassed both the pre-existing requiredPermissions gate and the new D10 requiresService gate on this path. (The list path /meta/app already passed the raw app, so it worked there — which is why the unit test passed but the live console didn't.)

Fix

filterAppForUser and resolveRegisteredServices now unwrap the isMetaEnvelope shape (filter the inner app, re-wrap). One unwrap point; the call site is simplified back.

Verification (live os dev, fresh build)

single-tenant multi-tenant
nav_organizations hidden shown ✓
nav_invitations hidden shown ✓
nav_business_units shown ✓ shown ✓

Confirmed on both the by-name and list endpoints. Plus a regression unit test (envelope → inner app gated).

🤖 Generated with Claude Code

…es (ADR-0057 D10)

GET /meta/app/:name returns an envelope { type, name, item: <app>, ... }, but filterAppForUser was applied to the envelope (whose .navigation is undefined) → it returned untouched, silently bypassing BOTH the requiredPermissions gate and the D10 requiresService gate. So Organizations/Invitations still showed in the Setup app even single-tenant. filterAppForUser + resolveRegisteredServices now unwrap the envelope (the list path already passed the raw app). Verified live (os dev): single-tenant hides Organizations/Invitations, multi-tenant shows them; +regression unit test.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 22, 2026 3:36am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tests tooling size/s labels Jun 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/rest.

5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/implementation-status.mdx (via @objectstack/rest)
  • content/docs/concepts/packages.mdx (via @objectstack/rest)
  • content/docs/guides/api-reference.mdx (via @objectstack/rest)
  • content/docs/guides/packages.mdx (via @objectstack/rest)
  • content/docs/guides/plugins.mdx (via @objectstack/rest)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@xuyushun441-sys
xuyushun441-sys merged commit 3754f80 into main Jun 22, 2026
16 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the fix/adr-0057-d10-envelope-unwrap branch June 22, 2026 03:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tests tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants