Skip to content

Commit ebdb9d6

Browse files
committed
docs(metadata-protocol): the getMetaItems gate enumerates six rest-server call sites, not five, and names the transitive diagnostics door
The `[#14683]` gate docblock above `getMetaItems`' `organizationIdForMetaRead` call called the `GET /meta/:type` list door "the only door that both gates and reaches this method", then accounted for "the four remaining" `organizationIdForMetaRead` call sites in `rest-server.ts`. One named plus four remaining is five; that file has SIX, and the missing one is `GET /meta/diagnostics?type=`, which both gates and reaches this method. It was missed because it does not call `getMetaItems`. It calls `getMetaDiagnostics`, whose `?type=` arm sets `targetTypes = [request.type]` and loops `getMetaItems({ type: t, organizationId, ... })` over it, so a grep for doors invoking `getMetaItems` cannot see it. That hop is also undeclared: `getMetaDiagnostics` is not a member of `MetadataProtocol`, neither required nor optional, so the door reaches it through a runtime cast behind a 501 feature-detect - real at runtime, invisible to the type system. The enumeration is what #14683 offers as evidence that its change is a no-op for every already-gating caller. That conclusion is measured and holds; only the enumeration backing it was short a caller. Comment only: no behaviour change, no schema change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ARYe3yQTQCUFm5qPYNgKaJ
1 parent 9b459b7 commit ebdb9d6

1 file changed

Lines changed: 34 additions & 4 deletions

File tree

packages/metadata-protocol/src/protocol.ts

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6797,23 +6797,53 @@ export class ObjectStackProtocolImplementation implements
67976797
// caller that already gates therefore sees no change, provided it gated
67986798
// on the same type this line gates on. Every such caller does:
67996799
//
6800-
// • `packages/rest`'s `GET /meta/:type` list door — the only door
6801-
// that both gates and reaches this method — computes
6800+
// • `packages/rest`'s `GET /meta/:type` list door — one of TWO doors
6801+
// that both gate and reach this method — computes
68026802
// `organizationIdForMetaRead(canonicalMetaUrlType(req.params.type),
68036803
// ctx?.tenantId)` and then passes `type: req.params.type`, the RAW
68046804
// segment. The first statement of this method folds that segment
68056805
// through {@link canonicalizeMetaRequestType}, which IS
68066806
// `canonicalMetaUrlType` — so `request.type` here is the identical
68076807
// STRING the door gated on, and the second application is the
68086808
// algebraic no-op above.
6809+
// • `GET /meta/diagnostics?type=` — the SECOND such door, and the one
6810+
// a caller-side grep cannot see. It gates the same way
6811+
// (`organizationIdForMetaRead(canonicalMetaUrlType(diagnosticsType),
6812+
// ctx?.tenantId)`) and then passes its own RAW segment on — but it
6813+
// reaches this method TRANSITIVELY, through
6814+
// {@link getMetaDiagnostics}, whose `?type=` arm sets `targetTypes =
6815+
// [request.type]` and loops `getMetaItems({ type: t,
6816+
// organizationId, … })` over it. So the door's segment still arrives
6817+
// here as `request.type` and is still folded by the same first
6818+
// statement: the identical STRING, the same algebraic no-op, one hop
6819+
// further out. ⚠️ That hop is UNDECLARED — `getMetaDiagnostics` is
6820+
// not a member of `MetadataProtocol`, neither required nor optional,
6821+
// so the door reaches it through a `(p as any)` cast behind a 501
6822+
// feature-detect. Real at runtime, invisible to the type system, and
6823+
// therefore something a caller census must be TOLD rather than left
6824+
// to derive.
68096825
// • the search sweep's page read below gates on `'page'` and passes
68106826
// `'page'`; `page` is non-overridable, so both readings are
68116827
// `undefined` whatever the session holds.
68126828
// • the four remaining `organizationIdForMetaRead` call sites in
68136829
// `rest-server.ts` (`/layers`, the by-name read, `/history`,
68146830
// `/diff`) reach `getMetaItemLayered` / `getMetaItem` /
6815-
// `historyMetaItem` / `diffMetaItem` — never this method — so this
6816-
// line cannot move them at all.
6831+
// `historyMetaItem` / `diffMetaItem` — never this method, at any
6832+
// depth — so this line cannot move them at all. Two doors named
6833+
// above plus these four IS that file's whole set of SIX; the
6834+
// enumeration that named one door and "four remaining" described
6835+
// five, and the door it dropped was the one that reaches here.
6836+
//
6837+
// ⭐ Read this list from the CALLEE side, which is how it is now built.
6838+
// A grep for doors that invoke `getMetaItems` answers only its own
6839+
// question: it cannot see a door that arrives through something else,
6840+
// and that is exactly how the diagnostics door went unlisted. The
6841+
// closed form is the other direction — `this.getMetaItems(` has THREE
6842+
// callers in this file: {@link getMetaDiagnostics},
6843+
// {@link searchAll} and {@link findReferencesToMeta}. The third gates
6844+
// nothing, deliberately: its door spends the organization on the
6845+
// reference SOURCES while `req.params.type` is the TARGET, so it hands
6846+
// the tenant over RAW and is not a caller this paragraph is about.
68176847
//
68186848
// ⛔ Gate AFTER the fold, never before it. `declaresOrgOverride`
68196849
// tolerates the MANIFEST plurals and not the URL-only ones

0 commit comments

Comments
 (0)