Skip to content

runtime: thread the session's organization into saveMetaItem only for types declaring allowOrgOverride — the #6190 ruling's runtime half, lands FIRST #7018

Description

@os-zhuang

Part of #6190 (maintainer ruling 2026-08-09 ~08:51Z, second STOP resolved — Option A, runtime half first). Filed by the domain:spec seat as the ruling-mandated linkage card, under the maintainer's live v17 acceleration; ownership is already ruled: the domain:metadata seat's offer to take this card was accepted in the ruling — that seat claims it (cross-seat declaration discipline applies: packages/runtime is outside its package family, so the claim declares the full file surface). Routing/domain labels left to the triage seat; target:v17 carried over from #6190's board membership (this card is that card's landing prerequisite).

The ruling, verbatim (from #6190 comment 5230671098)

  1. packages/runtime half, first: domains/meta.ts (and the ADR-0045 visibility flip in domains/packages.ts) thread the session's active organization into saveMetaItem only when the target type declares allowOrgOverride: true; otherwise the write lands env-wide — the same row a no-active-org session already produces today. This is independently correct and fixes the live phantom-write defect on its own (the runtime is already minting rows boot never reads).
  2. PR fix(metadata-protocol): refuse an org-scoped write of a type that has no per-org channel (#6190) #6973 second: after the runtime half merges, rebase (it predates #4463 运行时发布门在 host-config 拓扑(environmentId 未绑定)上整体不跑——#5086 只把 code-only 拒绝移出了同一条短路 #6710's landing and shares protocol.platform-schedule-org-gate.test.ts) and land as the declared=enforced backstop.
  3. Option B (scope parameter) rejected — public vocabulary with no pull, and a knob an AI author can get wrong; Option C rejected as unshippable.

What to change (measured anchors from PR #6973's blocking finding — re-verify, lines drift)

  • packages/runtime/src/domains/meta.ts:270-271 — currently threads session.activeOrganizationId into saveMetaItem unconditionally; make it conditional on the target type's registry declaration (allowOrgOverride: true), else omit (write lands env-wide, identical to today's no-active-org session).
  • packages/runtime/src/domains/packages.ts:231 — the ADR-0045 publish visibility flip threads the same org into saveMetaItem({type:'app'}); same predicate applies (app declares allowOrgOverride: false, so the flip must write env-wide — today's org-scoped write is already a phantom that reverts on restart).
  • Predicate derived from the registry (the existing OVERLAY_ALLOWED_TYPES / isOverlayAllowed family) — no parallel allowlist.

Measured evidence (PR #6973, end-to-end through the real handleMetadataRequest)

session WITH activeOrganizationId -> status 403, NOT_OVERRIDABLE, 0 rows written   (after #6973 alone)
session with NO active org        -> status 200, row lands organization_id = null

Today (before either half): the org-threaded write for a non-overridable type mints a row boot never reads — flow silently stops firing after restart, object 404s every record. This card is independently correct: it fixes the live phantom-write defect even before #6973 lands, and it is what makes #6973 mergeable (the refusal's remedy becomes reachable).

Sequencing

Refs: #6190 (ruling + full evidence chain), PR #6973 (implementation of the protocol half + the blocking finding), #6710 (the authoring-channel precedent the ruling cites as the A1 shape), ADR-0005, ADR-0045.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions