You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(rest): the untyped /meta/diagnostics sweep forwards the caller's organization, so a governance summary stops undercounting its own drill-down (#15622) (#15726)
* fix(rest): the untyped /meta/diagnostics sweep forwards the caller's organization, so a governance summary stops undercounting its own drill-down (#15622)
`GET /api/v1/meta/diagnostics` has two arms. The `?type=` arm has stated the
organization since #13753; the untyped whole-registry sweep passed nothing, so
the Studio governance summary reported clean tiles over a partition it never
read while the per-type screen you reach by clicking into it could see the same
items. A problem-reporting surface that structurally cannot see a class of
problems issues a false all-clear.
The obstacle recorded in the tree was that one `organizationId` could not
express a per-type scope from this door without a fan-out per overridable type
and a REST-side re-aggregation of `total`/`stats`/`scannedTypes`. #14683
dissolved it and #15034 recorded that: `getMetaDiagnostics` loops
`for (const t of targetTypes)` calling `getMetaItems({ type: t, organizationId,
... })`, and the first thing `getMetaItems` does with that organization is
`organizationIdForMetaRead(request.type, ...)` on its OWN folded type. One org
id is therefore already narrowed per type by the callee.
The door now resolves the memoised exec ctx for BOTH arms and passes
`ctx?.tenantId` RAW on the untyped one. Deliberately NOT pre-folded with
`organizationIdForMetaRead(...)` the way the `?type=` arm folds: there is no
single type to fold on, and folding on any one of them would suppress the
organization for every type at once. Identical in shape to the `/references`
repair (e13ede8, #13753).
The pin `an org-scoped item is absent from the whole-registry sweep` carried an
explicit "if this reddens, read the card before making it green" note; #15622 is
that card, so the assertion is REPLACED by its inverse rather than deleted, with
the comment still pointing at the card. Beside it stands the narrowness control
#15622 named as missing: in ONE request a planted pre-#6190 org-scoped row on a
non-overridable type does NOT appear while an overridable type's org-authored
row DOES — the half that tells a per-type gate from an unconditional tenant.
Controls pin that org B is not served org A's items, that an organization-less
caller reads exactly what it read before, that an env-wide item stays visible to
an org caller, and that the wire shape is unchanged (same five response keys,
same `stats` row keys, 200 either way).
`resolveExecCtx` census numbers are unmoved: still 77 sites / 98 mentions, the
hoisted resolution being the same single locally-caught continuation-line site.
No new parameter, response field, status code or contract surface: ADR-0131
D6/D7 retires this partition in v18 (#15206, C5), so nothing is built on it.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* chore(docs): re-anchor the system-context census lines the diagnostics comment shifted
`check:check-system-context-census --fix` output: the five `rest-server.ts`
elevation-read anchors on the system-context page moved by the same +32 lines
the untyped arm's decision record added. Pure line rot, no row content changed.
Part of #15622
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
An organization-scoped caller's own items now appear in the untyped metadata diagnostics sweep.
6
+
7
+
`GET /api/v1/meta/diagnostics` has two arms. The `?type=` arm has stated the caller's organization since #13753; the untyped whole-registry sweep passed none, so the Studio governance summary reported clean tiles over a partition it never read — undercounting relative to the per-type drill-down screen you reach by clicking into it. A summary whose whole job is surfacing problems, and which structurally cannot see a class of them while its own drill-down can, issues a false all-clear. The untyped arm now forwards the caller's organization, so items that organization authored on the five `allowOrgOverride: true` types (`view`, `dashboard`, `report`, `translation`, `email_template`) are counted in `stats`, `total` and `scannedItems`.
8
+
9
+
The organization is passed RAW, deliberately, and that is the whole of the change — no new parameter, response field, status code or contract surface. There is no single type to fold on for a whole-registry sweep, and folding on any one of them would suppress the organization for every type at once; instead `getMetaDiagnostics` reads each swept type through `getMetaItems`, which applies the `allowOrgOverride` read gate to its own request type, so every type is scoped on its own registry flag. A non-overridable type (`object`, `flow`, `app`, …) is still read environment-wide and no pre-#6190 organization-scoped row is resurrected into the report. An anonymous or organization-less caller reads exactly what it read before, and the `stats` / `total` / `scannedTypes` arithmetic is unchanged in shape.
| 50 |`manage_metadata` bypassed on metadata writes | runtime, rest | Get: schema writes without the capability |`domains/meta.ts:471`, `:874`, `rest-server.ts:5016`, `:6442`, `:6690`, `:7121`, `:7314`|
161
+
| 50 |`manage_metadata` bypassed on metadata writes | runtime, rest | Get: schema writes without the capability |`domains/meta.ts:471`, `:874`, `rest-server.ts:5048`, `:6474`, `:6722`, `:7153`, `:7346`|
162
162
| 51 | The shared metadata-write verdict itself returns `allowed`| metadata-core | Get: the one function all of row 50's doors consult answers yes before any capability is examined |`meta-write-capability.ts:134`|
163
163
| 52 | Anonymous-deny seam satisfied on the domain dispatchers and the package/federation routes | runtime, rest | Get: passes with no `userId`|`domains/actions.ts:421`, `domains/ai.ts:60`, `domains/automation.ts:989`, `domains/meta.ts:232`, `domains/security.ts:78`, `domains/packages.ts:422`, `external-datasource-routes.ts:302`, `package-routes.ts:97`|
164
164
| 53 | MCP principal check satisfied | runtime | Get: MCP surface reachable with no user |`domains/mcp.ts:61`|
0 commit comments