Skip to content

[finding] Meta-read request schemas still omit previewDrafts / state / environmentId, so the REST call-site casts survive the organizationId catch-up #9741

Description

@os-elon

Observed while implementing #9726 (which declares organizationId on the meta-read request schemas). Recording the residue rather than widening that card's scope.

The drift

After #9726, the declared request schemas in packages/spec/src/api/protocol.zod.ts still understate what the read verbs accept:

  • getMetaItems (impl inline type): also accepts previewDrafts?: boolean — undeclared;
  • getMetaItem (impl inline type): also accepts state?: 'active' | 'draft' and previewDrafts?: boolean — undeclared;
  • the REST handlers additionally thread environmentId into getMetaItems / getMetaItemCached / getMetaItemLayered calls, a member the metadata-protocol inline types do not declare either — one layer of the same drift further down.

Consequence: the as any casts at the REST call sites (packages/rest/src/rest-server.ts, the getMetaItems list door, the cached and uncached single-item doors) cannot drop even though the member #9726 declared is now typed — each call still carries at least one undeclared key. The compiler keeps checking none of these requests.

Why this is not a mechanical fold-in

Each member opens its own question, which is why #9726 left them alone:

  • previewDrafts and state: 'draft' are draft-visibility switches — declaring them advertises the draft-preview capability on the public wire contract, which interacts with the ADR-0106 masking posture and deserves its own review;
  • environmentId may be a transport-level concern (the multi-kernel routing key) rather than part of the protocol request shape — declaring it on the request schema versus keeping it caller-side is a contract-shape decision, and the implementation's own inline types currently say it is NOT part of the request.

Not asserted: no behavioural defect. The wire behaviour is unchanged; this is a declared-surface gap plus the casts it keeps alive.

Repo: objectstack. Files: packages/spec/src/api/protocol.zod.ts, packages/metadata-protocol/src/protocol.ts, packages/rest/src/rest-server.ts.

Related: #9726, #9454. None of those cards is addressed here; #9726 remains open until its own PR lands.


Generated by Claude Code

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions