Skip to content

The published-seed read still runs a two-attempt org-then-env ladder whose first rung is now a byte-identical repeat — seed is allowOrgOverride: false and getMetaItem gates it #15068

Description

@os-trump

Filed unassigned by the domain:cli execution seat from PR #15063's report (card #14771). ⚠️ Filed unassigned and unlabelled — grading and domain:* are triage's to produce.

⭐ The reporting dev was instructed to bound the class and ⛔ not to fix it, so this is the second of the two members it found — and the bound is the valuable part: exactly two comments under packages/runtime/src/** state the pre-gate rule. #14771 repaired one. This is the other, and unlike its sibling it is not comment-only.

The site

packages/runtime/src/domains/packages.ts — locate by content, not by line (it was :1245 when the dev measured, :1229 on main as I write this; the file moves daily):

// Read the just-published seed body. Try the active org first, then
// fall back to an env-wide read — a workspace seed is often stored
// org-wide (organization_id IS NULL), and resolving the wrong scope
// here is what silently produced "0 rows loaded".
const attempts = organizationId
    ? [{ type: 'seed', name, organizationId }, { type: 'seed', name }]
    : [{ type: 'seed', name }];
let item: any;
for (const args of attempts) {
    try {
        item = await protocol.getMetaItem(args);
        if (item) break;
    } catch (e) { /* … */ }
}

Why the first rung is dead

Verified on origin/main, each reading with a positive control on the same pathspec:

  1. seed declares allowOrgOverride: falsepackages/spec/src/kernel/metadata-plugin.zod.ts:808.
  2. getMetaItem applies organizationIdForMetaRead(request.type, request.organizationId) itself, landed by fix(metadata-protocol): gate getMetaItem's overlay read on the metadata registry #14908 (the singular-read sibling of Where does the allowOrgOverride read gate belong for metadata sweeps that read MORE THAN ONE type per request? getMetaItems applies none of its own #14683/fix(metadata-protocol): apply the allowOrgOverride read gate inside getMetaItems, so multi-type sweeps are scoped per type #14767's plural getMetaItems gate).
  3. That predicate answers undefined for every type the registry declares non-overridable.

{ type: 'seed', name, organizationId } and { type: 'seed', name } now resolve to the identical env-wide read. The loop's first iteration either returns the item — in which case the second never runs and nothing is lost — or returns nothing, and the second attempt repeats the same query verbatim.

So this is two defects, not one

What the fix owes

Do not "restore" org-awareness to the seed read. seed is non-overridable by declaration and the gate is the repair, exactly as on the app read one function up — read #14771's replacement comment before touching this one.

The honest shapes are one of:

  • collapse the ladder to the single read the gate already produces, and rewrite the comment to say the scope is decided by the registry flag rather than by this call site; or
  • keep the ladder and state why — if there is a reading under which the two attempts can still differ, name it. ⚠️ I could not find one and neither could the reporting dev, but a claim of deadness deserves the ablation: neuter the second attempt and show nothing reddens, with a positive control that the ladder is reached at all.

The behaviour-preservation question is the whole risk here: the original comment says resolving the wrong scope "is what silently produced 0 rows loaded", so this ladder was written to fix a real outage. ⇒ ⛔ Do not delete it on a reading of the registry alone — pin the publish-then-read path first.

The method that found it, worth reusing

Enumerate every non-test metadata read call site under ':(glob)packages/runtime/src/**/*.ts' for getMetaItems|getMetaItem|getMetaItemLayered|listMetaItems|getMetaDiagnostics|findReferencesToMeta9 sites. Liveness: the same pathspec returns more when test files are included, so a zero would have been a reading. ⚠️ A git grep pathspec using ** without :(glob) matches zero silently.

Non-members, checked and distinguished rather than skipped: readMergedSkillRows's docblock in domains/mcp.ts already states the correct rule for skill; the getMetaItemLayered note at domains/meta.ts:334 describes a primitive the read gate does not reach (protocol.ts's own docblock says the /layers door never reaches getMetaItems); and the four domains/meta.ts read sites comment on masking and draft preview, asserting nothing about org scope.

Refs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions