Skip to content

fix(metadata-protocol)!: $expand and a relation condition stop serving a disabled package's object - #35444

Merged
objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35427-expand-disabled-package
Nov 19, 2026
Merged

objectstack-fleet[bot] merged 4 commits into
mainfrom
claude/issue-35427-expand-disabled-package

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Bill · project thread
Fixes #35427

Clause-②: no (narrowing: $expand withholds a disabled package's object and a relation condition on one is refused, the answer its own data route already gives)
Metadata-protocol: none
Skills-docs: none — no skill teaches what a package disable does per data door, or which lookup targets $expand serves; the change moves a runtime answer, not anything an author writes

维护者速读

  • 用户能看到什么变化:某个应用包停用后,别的应用通过关联字段展开读它的记录时,只拿到关联记录的编号,不再拿到整条记录;按停用包记录的字段做关联筛选会被直接拒绝,与直接打开该对象时的提示一致。
  • 为什么做:停用包的数据本应在所有读取入口都看不到,全局搜索已修好,这是同一类问题的另一个入口。
  • 出错会怎样:最坏情况是展开时仍带出停用包的记录(即今天的样子);没有停用任何包的环境不受影响,撤回本改动即可恢复原状。
  • 要你做什么:无。

席位核对

  • Files to read first: packages/metadata-protocol/src/protocol-query-validation.ts (the two guards in servesExpansionTarget and refuseUnservedRelationTarget), packages/metadata-protocol/src/protocol.expand-disabled-package-35427.test.ts, .changeset/35427-expand-disabled-package.md.
  • Two-minute check: pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.expand-disabled-package-35427.test.ts — 12 tests green (head 1153f76).
  • Ruling zone followed as written: same predicate as the data route and runtime: GET /api/v1/search returns a disabled package's records while its data routes answer 404 OBJECT_PACKAGE_DISABLED #35195 (isObjectOfDisabledPackage), expand withheld (bare id), relation condition refused with objectPackageDisabledError.

What changes

  • servesExpansionTarget now also asks isObjectOfDisabledPackage(registry, target): an $expand entry (comma list, POST relation map, by-id expand, any nesting level) whose target belongs to a disabled package is withheld exactly as an apiEnabled: false target already is. The lookup keeps its stored id; the engine reads nothing of the target. referenceNameVisible titles are produced inside the engine's expansion loop over the handed map (expandRelatedRecords → serveReferenceNames), so a withheld entry gets no title either.
  • refuseUnservedRelationTarget first asks the same predicate: a nested-relation condition on such a target throws objectPackageDisabledError(target) (404 OBJECT_PACKAGE_DISABLED, object set) with param set to the position, before the query runs. Both the engine-gate hook (beforeRelationTarget) and the no-gate walk route through this one function, so the filter, aggregation filters and an expand entry's own filter are covered.
  • No other file moves; protocol.ts docblocks untouched (fence).

Tests

New protocol.expand-disabled-package-35427.test.ts (fake engine, the protocol.expand-target-exposure harness shape): 6 pins + 6 CONTROLs at head 1153f76. The by-id unit pin was dropped in 1153f76: a getData double needs a findOne double, which check:engine-double-contract wants recorded in a ledger outside the fence. By-id is covered at the real door below and runs through the same servedExpand as the pinned list path.

RED at ee40658 (base), measured on the 13-test version at d18331a: 7 failed | 6 passed (13)

All 7 pins red (list comma, POST map, by-id, second level; relation condition for member and system, and inside an expand entry's filter); the 6 CONTROLs green.

Real door (HttpDispatcher + MetadataPlugin + ObjectQLPlugin + SqlDriver, in-memory SQLite), area probe re-run, throwaway (not committed)

At ee40658, with beta_obj's package disabled: GET /data/alpha_obj?$expand=b_ref 200 with b_ref = full row incl. secret_note; GET /data/alpha_obj/:id?expand=b_ref 200, same; relation $filter hit 1 row / miss 0 rows (oracle).
At d18331a (metadata-protocol rebuilt): list $expand and by-id expand 200 with b_ref the bare id; relation $filter hit and miss both 404 OBJECT_PACKAGE_DISABLED; GET /data/beta_obj 404 unchanged; CONTROL with the package enabled still expands to the full row.

Ablation (each guard, on-disk via scripts/ablation-replace.mjs, restored to HEAD blob 69c71bdf)
  • (counts on the 13-test version at d18331a) expansion guard replaced by && true: 4 failed | 9 passed (the four $expand pins).
  • relation guard if (false): 3 failed | 10 passed (the three relation-condition pins).
  • (A first expansion-guard attempt used replacement ;, which ablation-replace refused as not provably landed — no run; redone with a distinctive marker.)
Package suite at d18331a

pnpm --filter @objectstack/metadata-protocol test: Test Files 360 passed | 9 skipped (369), Tests 23247 passed | 45 skipped. typecheck exit 0.

Acceptance notes

  • Not this PR (card's read-only note, not measured): service-analytics object gate has no disabled-package check.
  • test:repo is CI's (Test Core).

Verification

Gates and dogfood battery readings are in the os-dev-report comment on the card, at this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd

…g a disabled package's object

servesExpansionTarget withholds a target that belongs to a disabled
package (the lookup keeps its bare id, as for an apiEnabled:false
target), and refuseUnservedRelationTarget refuses a nested-relation
condition on one with the data route's own 404 OBJECT_PACKAGE_DISABLED.

Claude-Session: https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 19, 2026
@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

2 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 123 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 609b675135f1ea427aff463c551619a83368bcad → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 86730dd820532070b6f5ba98f8a3bea457479d1b — the merge of head 88ea36c3b67886be3e0fca3c07db63be833dc896 into base 609b675135f1ea427aff463c551619a83368bcad, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 86730dd820532070b6f5ba98f8a3bea457479d1b && git checkout 86730dd820532070b6f5ba98f8a3bea457479d1b
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 609b675135f1ea427aff463c551619a83368bcad 88ea36c3b67886be3e0fca3c07db63be833dc896 && git checkout -B drift-repro 609b675135f1ea427aff463c551619a83368bcad && git merge --no-ff 88ea36c3b67886be3e0fca3c07db63be833dc896

node scripts/docs-audit/affected-docs.mjs --json 609b675135f1ea427aff463c551619a83368bcad

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

…he 35427 harness to list reads

check:test-source-alias asks a module-top import of the dynamically
imported lint package; the by-id findOne double is dropped so the file
adds no engine-double ledger row (the by-id expand is measured on a
real stack instead).

Claude-Session: https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbP6iSEGkWb5fn8yqd

2026-11-19T10:50Z Final head for review: 1153f761e3f8fe5f14911db4e0d5fb0a86013154. CI on this head: 37 success, 0 failed (two body-edit runs in progress). Clause-②: no (narrowing) (a disabled package's object stops being served through $expand and relation conditions), dogfood battery green on this head (os-dev-report 7006890635). L1 requested from L1-a; contract review from seat 5 after ACCEPT.

Area notes for the reviewer:

  • The PR body's test counts were corrected to this head (6 pins + 6 CONTROLs, 12 tests). The by-id unit pin was dropped to stay inside the fence: a getData double needs a ledger row in scripts/engine-double-contract.pinned.json. By-id is measured at the real door and shares servedExpand with the pinned list path. L1 to say whether it wants that pin (one --write ledger row) or accepts the real-door reading.
  • Out of scope, noted only: the service-analytics object gate has no disabled-package check; not measured here.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

维护者速读

  • 用户能看到什么变化:某个应用包停用后,别的应用通过关联字段展开时,只能看到关联记录的编号,读不到这个包的记录内容。按这类关联记录的字段筛选,会被直接拒绝。这和直接打开这个包的数据时一致。
  • 为什么做:停用的包本该在所有读取入口都看不到。全局搜索已经修好,这是同一类问题的另一个入口。
  • 出错会怎样:最坏是展开时仍带出停用包的记录,和现在一样。没有停用任何包的环境不受影响。撤回即可。
  • 要你做什么:无。

席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head 1153f761e3 · 2026-11-19T10:52Z

  • Shape: 3 files, +199/−3: metadata-protocol/src/protocol-query-validation.ts (+19/−3), one new protocol test file and a changeset. Not governed. K = 16 since base ee40658d (≥ 15): merge main and get a green re-run before queueing. It merges cleanly.
  • Fixes vs card (metadata-protocol: $expand and a relation condition serve a disabled package's records through an enabled object's lookup, while the data route answers 404 OBJECT_PACKAGE_DISABLED #35427, the measured reach: list $expand, by-id expand and a nested-relation $filter serve or answer for a disabled package's object while its own route answers 404 OBJECT_PACKAGE_DISABLED):
    • servesExpansionTarget now also requires !isObjectOfDisabledPackage(registry, target), the data route's own predicate (assertObjectRegistered). A disabled target is withheld like an apiEnabled: false one: the lookup keeps its bare id, nothing of the target is read, and reference-name titles ride the same map.
    • findData (protocol-data-crud.ts:391) and getData (:986) both go through servedExpand, so one guard covers the list, the POST relation map, by-id and every nesting level.
    • refuseUnservedRelationTarget first throws objectPackageDisabledError(target) with param set, giving 404 OBJECT_PACKAGE_DISABLED before the query runs, on the POST where, the list filter and inside an expand entry's own filter.
    • A registry that cannot answer hides nothing (CONTROL).
  • The by-id pin (asked): not needed. The predicate is pinned once at servesExpansionTarget through the list path. The by-id wiring (getData → servedExpand) is already pinned by protocol.expand-target-exposure.test.ts:147,152 for the apiEnabled: false arm, which uses the same function. On top of that, A1/A2 measured by-id returning the bare id at the real door (HttpDispatcher + SqlDriver) at d18331a0. Adding a findOne double plus a ledger row would re-pin the same line through a second caller, so leave it out.
  • Pins: protocol.expand-disabled-package-35427.test.ts (fake engine, in the expand-target-exposure harness shape) has 6 pins and 6 CONTROLs. The CONTROLs cover re-enable restoring both answers, apiEnabled: false keeping OBJECT_API_DISABLED or being withheld, an unanswering registry, and a plain id comparand on the lookup still being served. The pins were red before the fix.
  • Changeset and level: metadata-protocol patch.
    • Clause-②: yes (narrowing: …) is in the changeset and the PR body. This relay called it "no (narrowing)", but the files say yes, and yes is right: the published data routes' answers narrow.
    • Metadata-protocol: none holds. A package disable is install state, not authored metadata, which is the same reading as fix(metadata-protocol)!: global search leaves out the objects of a disabled package #35367.
    • The BREAKING banner and adr-0087: not-required (no-migration-prescription) are present. That is AGENTS.md's level for a non-protocol breaking change.
    • I read it sentence by sentence: the before and after for $expand (list, by-id, POST map) and the relation condition, the titles, the remedy and "no disabled package sees no change" all match the code.
  • Gates: CI on 1153f761 is 38 success and 18 skipped, with 0 failed. "Check Changeset" was still running at review. The dogfood battery passed 4092. Locally 66 of 67 passed, with 1 NOT MEASURED (dual-build, prerequisite).
  • L2 owed: Clause-②: yes (narrowing), so the seat writes a CONTRACT_REVIEW_TIER L2 over the non-prose diff.
  • Out of scope: service-analytics' object gate (isRegisteredObject) has the same missing check, which the card read but did not measure. pkg-2 measures it and files a card under metadata-protocol: $expand and a relation condition serve a disabled package's records through an enabled object's lookup, while the data route answers 404 OBJECT_PACKAGE_DISABLED #35427 if it serves.
  • Landing clause: not governed. pkg-2 lands it after the seat's L2, merging main and a green re-run. A new push needs a fresh L1 only if it changes more than a main merge.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4

席位核对 — correction to ACCEPT 7007008749 (L1-a) · head 1153f761e3 · 2026-11-19T10:53Z

  • The Clause-② bullet in my ACCEPT was wrong. The exact spelling for this diff is Clause-②: no (narrowing), not yes (narrowing).
  • Fix: change the line in the changeset and the PR body together. This is a declaration-only push and needs no fresh L1.
  • Nothing else moves. The level, Metadata-protocol: none, the BREAKING banner, the ADR-0087 marker, the L2 face (narrowing, CONTRACT_REVIEW_TIER) and the verdict all stand.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 88ea36c3b67886be3e0fca3c07db63be833dc896
Local-runs: none
Scope: packages/metadata-protocol/src/protocol-query-validation.ts, packages/metadata-protocol/src/protocol.expand-disabled-package-35427.test.ts + packages/metadata-protocol/src/protocol-authoring-refusals.ts, packages/metadata-protocol/src/protocol-data-crud.ts, packages/metadata-protocol/src/protocol.ts, packages/objectql/src/engine-summaries-and-expansion.ts, packages/objectql/src/internal-field-evaluation-guard.ts, packages/objectql/src/registry-package-addressing.ts, packages/core/src/utils/relation-condition-sites.ts

① Derived judgments

  • Read. Face: narrowing. PR fix(metadata-protocol)!: $expand and a relation condition stop serving a disabled package's object #35444, card metadata-protocol: $expand and a relation condition serve a disabled package's records through an enabled object's lookup, while the data route answers 404 OBJECT_PACKAGE_DISABLED #35427, under runtime: GET /api/v1/search returns a disabled package's records while its data routes answer 404 OBJECT_PACKAGE_DISABLED #35195: the card body and both its comments, the PR body and its thread (L1 ACCEPT 7007008749 and its correction 7007031119), the net diff against main, and the check-runs. The files after + on the Scope: line are cited by the hunks and were read at this head; none is in the diff.
  • The head. The review was made on e0f8a0ea and is anchored here on 88ea36c3. 88ea36c3 is one commit on top of e0f8a0ea, and the diff between the two is one line of one file: the Clause-②: line of .changeset/35427-expand-disabled-package.md, value yes to no, the arm and its text unchanged. The PR body's line reads the same. e0f8a0ea is a merge of main (second parent 609b6751, which is main's tip and this head's merge base) onto 1153f761, and the three PR paths are byte-identical between 1153f761 and e0f8a0ea. So the non-prose diff judged here is the one L1 accepted at 1153f761: protocol-query-validation.ts +19/-3 and one new test file.
  • $expand served set narrows: right. servesExpansionTarget now also requires !isObjectOfDisabledPackage(registry, target). An entry whose target belongs to a disabled package is dropped from the map before the engine sees it, at every level (servedExpand recurses and asks each level's own target). Both callers go through it: findData (comma list and the POST relation map) and getData (by-id expand), protocol-data-crud.ts lines 391 and 986. The field keeps its stored id.
  • Reference titles ride the same map: right. serveReferenceNames is called only inside expandRelatedRecords' loop over the handed map, so a withheld entry gets no title. The changeset's sentence holds against the code.
  • Relation-condition accept set narrows: right. refuseUnservedRelationTarget first throws objectPackageDisabledError(target) with param set: 404 OBJECT_PACKAGE_DISABLED, object the target. Both routes into it are the ones the exposure refusal already rides: the engine gate's beforeRelationTarget hook and the no-gate walk refuseUnservedRelationTargetsIn. Positions: where and the filter alias, each aggregation's own filter, and each expand entry's filter at every level. findData asks before engine.find, engine.aggregate and engine.count.
  • No surface is added: right. OBJECT_PACKAGE_DISABLED is already in the error-code ledger, and the constructor is the one the data route and the by-name metadata reads use. No route, key, export, code or accepted value appears. param on the refusal is what the exposure refusal at the same position already carries.
  • Precedence moves for one case: right, and unpinned. A target that is both in a disabled package and unexposed (apiEnabled: false, or a whitelist) used to answer OBJECT_API_DISABLED or 405 at this position and now answers OBJECT_PACKAGE_DISABLED. That is the direct route's own order: its registry gate answers the package refusal for such an object. See N2.
  • Caller-independent, system contexts included: right. It matches assertObjectRegistered, and the pins hold it for a member and a system context. The guards sit at the door, so the engine's in-process readers (a hook's ctx.api, services, cascades) are untouched, as ruling record 6545646924 requires.
  • A registry that cannot answer hides nothing: right. The predicate is optional-called, the data route's own fail-open, and a CONTROL pins it.
  • The kind none on the Metadata-protocol line: right. A package disable is install state. Nothing an author writes moves.
  • The test file. 6 pins and 6 CONTROLs on a fake engine in the expand-target-exposure harness shape. The by-id wiring (getData to servedExpand) and the engine-gate wiring (beforeRelationTarget) are pinned by existing files for the exposure arm (protocol.expand-target-exposure.test.ts, protocol.data-door-internal-field-delegation.test.ts), and the new predicate sits behind both.
  • Gates. Check-runs on 88ea36c3 at the reading: 26 success, 18 skipped, 11 in progress, none failed or cancelled. Concluded green: Lint & Repo Gates and every Lint lane, Build Core, Check Changeset, Governed Surface Queue Guard, Live E2E UI, the pull-request Dogfood Regression Gate, the PR-body guards, and the Type Check source, consumer and debt lanes. Still running: Test Core shards 1 to 10 and Type Check · workspace, so the Test Core and TypeScript Type Check contexts have not reported. On 1153f761 every run concluded: 39 success, 18 skipped, none failed. The runs on e0f8a0ea were cancelled by this push, and its two red aggregate contexts are those cancelled lanes, not a gate verdict. An in-progress run is not a pass: the verdict below is on the contract, and green on this head stays the queue's own condition.

② Semver level

  • @objectstack/metadata-protocol: patch: right. A non-protocol breaking change ships patch and keeps its banner and its ADR-0087 disposition.
  • The Clause-② declaration reads no (narrowing): right at this head, in the changeset and in the PR body. Nothing in the diff widens an accept set or a public surface, and scripts/pm/clause2-line.mjs reserves yes (narrowing) for a diff that widens one surface and narrows another. The arm keeps its explanation after a colon, which the reader accepts.
  • BREAKING: the title carries !, and the changeset carries one **BREAKING** paragraph naming who is affected (a caller of the data routes on an environment that disables a package).
  • ADR-0087: exactly one marker, adr-0087: not-required (no-migration-prescription). It holds: no key, export or config field is removed or renamed, nothing stored is rewritten, the body carries no rewrite prescription, and the kind is none.
  • Migration text: present and true to the code. Before and after for $expand (list, by-id, POST map) and the relation condition, the titles, the one-line fix (re-enable the package), and that an environment with no disabled package sees no change.

③ Boundary flags

  • Dev flags. open_questions is empty and security_findings reads none. The five deviations are answered: the dropped by-id unit pin is accepted (L1, and the wiring pin named above); the PR body's test counts were corrected by the area; the four-line maintainer brief is the seat's to judge, not this face's; the throwaway probe is not in the tree; the first battery run was stopped so that one run stands on a final head.
  • Dogfood battery, the narrowing arm. The battery is recorded at 1153f761 (os-dev-report 7006890635).
    • On e0f8a0ea it satisfied the arm. landDogfoodGate (scripts/pm/label-write.mjs) accepts a battery sha the head reaches by a first-parent walk over merges of the base alone, and e0f8a0ea is one such merge above 1153f761.
    • On 88ea36c3 it does not. This head is a one-parent commit above that merge, and the gate refuses a commit after the battery's sha that is not a merge, whatever it changed. The changed line is one the battery does not read, but the gate fails closed and NOT MEASURED is never a pass.
    • So before --land: a full battery on 88ea36c3, and an os-dev-report on the card whose dogfood_battery opens with that sha. This is a landing prerequisite the gate itself enforces. It is not a finding on the diff, and it moves no head.
  • SQL push-down. Nothing to push down. The diff adds two calls to an in-memory registry predicate. No id materialisation, no in-app join, no extra read. Both guards remove a read the engine would have made.
  • Escalated, a sibling door, read only and not measured. packages/runtime/src/action-execution.ts, function refuseUnservedRelationTargets, serving callData's aggregate arm (and its query fallback on a host with no protocol service). It asks a relation-condition target the exposure decision only, never the package predicate, and that arm takes the engine, not the protocol. The addressed object is refused there; a relation-condition target is not. The stdio transport's twin (enforceRelationTargetExposure, packages/mcp/src/stdio-data-bridge.ts) does refuse it. The seat measures it and files a card under runtime: GET /api/v1/search returns a disabled package's records while its data routes answer 404 OBJECT_PACKAGE_DISABLED #35195 if it serves. It is outside this diff and outside the claim this changeset makes, which names the data routes.
  • Escalated, already noted by the card and L1. packages/services/service-analytics/src/api-exposure-door.ts (assertObjectsExposed, assertDefinitionExposed, servesLabelTarget) asks exposure only, by read. pkg-2 measures it and files a card under metadata-protocol: $expand and a relation condition serve a disabled package's records through an enabled object's lookup, while the data route answers 404 OBJECT_PACKAGE_DISABLED #35427 if it serves.
  • Not judged here. The PR reads as a draft; readying it is the landing seat's.

④ Design judgment

The narrowing takes no declared capability away. It makes a published refusal real on two hops that did not ask it.

  • Against the published contract on main. The error-code ledger registers OBJECT_PACKAGE_DISABLED as: the object is registered, its owning package is disabled, and the data plane refuses rather than serving rows. ADR-0070 as amended gives a disable one meaning: hidden, refused on the data plane, data kept. The deployment handbook says the same of /api/v1/data. Nothing published promises that a lookup from another object keeps serving those rows. Ruling record 6545646924 keeps in-process access served and adds no engine-side refusal, and this diff adds none: both guards are at the door.
  • One predicate, one constructor. The predicate is the data route's (isObjectOfDisabledPackage, which resolves the name the way getObject does and asks about the owner, never a contributor). The refusal is the data route's constructor. A second reading of the package state or a second envelope would be the defect, and neither exists.
  • Withheld on expand, refused on a condition: the right split. An expansion that is withheld answers exactly as an unexposed target and as a target the caller may not read: the stored id. So a disabled target is indistinguishable there from a forbidden one. A condition cannot be dropped without widening the result, so it is refused.
  • What the refusal discloses. Code, status and message are word for word what GET /data/TARGET answers any caller that reaches the door, ahead of any permission check, and the target's name is the lookup's declared target on the source's own served field map. So the refusal tells a caller nothing the direct route does not. It does distinguish a disabled target from a forbidden one on a condition, as the direct route already does.
  • No oracle before the refusal. The door's field-existence gate does not descend into a field key's value, so a nested key is never judged against the disabled object's field map before the refusal. On the engine gate the hook runs before anything of the target is judged. On expand, the entry is dropped ahead of the internal: true walk. No field name of the disabled object is confirmed or suggested.
  • No route around it inside this door. The door's site walk (relationConditionSites) is a superset of the engine's own (mapRelationConditions): it descends every $ key and takes any plain record with a non-$ key beneath a reference field, while the engine lowers only where, under $and, $or and $not. Dotted filter, sort and group-by paths across a relation are refused upstream for every target. Bulk writes address rows by id and hand the engine no caller filter. There is no GraphQL surface in the tree. Every REST read reaches findData or getData (list, POST query, by-id, export, record-page parts), and so do the dispatcher's /data door and the HTTP MCP bridge's query_records.
  • Depth. Every expand level is asked against its own target, and an entry below the walk's backstop is dropped rather than passed unjudged.
  • The cost, stated by the changeset. A stored view or report filter of an enabled package that conditions on a disabled module's field now fails its read with the 404 where it returned rows. That is the breaking change as declared, and ruling record 6545646924 already names data-plane lookups among the UI-side reads its app-side tolerance card covers.

No must-fix, no should-fix.

Nits, none affecting correctness or the contract. Each is left as a follow-up; a fix outside the prose faces would move the head.

  • N1 (nit): the class docblocks that are the contract for the changed bodies (refuseUnservedRelationTarget, servedExpand and servesExpansionTarget in protocol.ts) still describe the exposure decision alone, and EXPANSION_TARGET_OPERATION's docblock still says a lookup renders alike on the data door and the dataset door, which no longer holds for a disabled target until the analytics door asks the same predicate.
  • N2 (nit): no pin holds the precedence for a target that is both package-disabled and unexposed.
  • N3 (nit): the handbook's data-plane bullet does not say what an enabled object's lookup into a disabled module answers ($expand keeps the stored id, a condition is refused).

Implemented-by: claude/issue-35427-expand-disabled-package
Reviewed-by: isolated-l2-35444

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#5 · os-bill · session_01Utp6CbP6iSEGkWb5fn8yqd

2026-11-19T11:50Z Landing PR #35444 (card #35427) at head 88ea36c3b67886be3e0fca3c07db63be833dc896. L1-a ACCEPT 7007008749, with correction 7007031119, carried to this head: a clean main merge and the one-line Clause-② declaration fix only. Contract review PASS 7007338672 at this head (CONTRACT_REVIEW_TIER, no must-fix or should-fix). The dogfood battery ran on this exact head with 0 failures (os-dev-report 7008229794).

Probe Reading
Check-runs on 88ea36c3 39 success, 18 skipped, 0 failed
check-governed-merges.mjs --pr 35444 NOT governed; 202 changed lines ≤ 3000 · K = 9
Labels security added at landing per the seat (Security-touching: yes)

State: the area marks it ready and arms auto-merge. On MERGED, the area closes #35427 and clears its labels. Follow-ups from the L2 (N1–N3 as one p3) and two measured sibling doors (analytics; callData aggregate) are filed as cards once the maintainer OKs them.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 19, 2026 11:50
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit 819c067 Nov 19, 2026
63 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-35427-expand-disabled-package branch November 19, 2026 12:18
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…expand and relation-target checks, and pin its order (objectstack-ai#37893)

<!-- claude-projects-attribution: {"github_login":"os-tesla"} -->
_Requested by **Tesla** · [project
thread](https://claude.ai/code/project/chan_01AXsQkLFKRdQCqQ3RTr6Jao?thread=cmsg_01AXsQkLFKRdQCqQ3RTr6JaoLphuot5c2R2SFweEMeNTrP)_
Fixes objectstack-ai#35528
Clause-②: no
Metadata-protocol: none

## 维护者速读
- 用户能看到什么变化:用户无感;只改了代码注释、部署手册里"数据面"一条说明,外加一条测试。
- 为什么做:停用模块的关联展开与关联条件修好后(上一轮合并的修复),注释和手册仍只讲"接口是否开放",没讲"所属模块已停用"这一条。
- 出错会怎样:说明写错只会误导读文档的人,不影响运行;这次改动可以直接撤回。
- 要你做什么:无。

## What changes

- **N1 docblocks** (`packages/metadata-protocol/src/protocol.ts`,
`protocol-query-validation.ts`): `refuseUnservedRelationTarget`,
`servedExpand` and `servesExpansionTarget` now name the disabled-package
predicate (`isObjectPackageDisabled`) beside the exposure decision, and
say the package refusal is asked first. No code change.
- **`EXPANSION_TARGET_OPERATION`**: the card said its "alike on both
doors" sentence no longer held for a disabled target. Re-measured on
`origin/main` e69fa46: it holds again. The dataset door's label pass
now withholds a disabled package's target too (`analytics-service.ts`
~1737, wired in `service-analytics/src/plugin.ts` ~1803). So the
sentence stays, and one added sentence says the disabled case renders
the stored id on both doors.
- **N2 pin**: a top-level `describe` in the existing harness file
`protocol.expand-disabled-package-35427.test.ts`, which holds the PR
objectstack-ai#35444 pins. It covers a target that is both package-disabled and
unexposed, in two forms: `apiEnabled: false`, and an `apiMethods:
['get']` whitelist that serves `$expand` but not `list`. The relation
condition answers `404 OBJECT_PACKAGE_DISABLED` (`code` + `status` +
`object`), the engine is never called, and `$expand` withholds both
entries. A re-enable control shows each target's own exposure answer:
`OBJECT_API_DISABLED` 404, `OBJECT_API_METHOD_NOT_ALLOWED` 405, and the
whitelist target expanded. The whitelist case discriminates in both
directions.
- **N3 handbook** (`content/docs/deployment/marketplace-handbook.mdx`,
Data plane bullet): a lookup from an enabled object into a disabled
module keeps the stored id under `$expand`, and a condition on the
related object's fields is refused `404 OBJECT_PACKAGE_DISABLED`.
- Changeset: `@objectstack/metadata-protocol` patch.

## Tests

<details><summary>metadata-protocol pin files + typecheck at 224d707;
full package suite at 13b9b1b (the later commit is
docblock-only)</summary>

```
vitest run src/protocol.expand-disabled-package-35427.test.ts src/protocol.expand-target-exposure.test.ts
 Test Files  2 passed (2)
      Tests  30 passed (30)
tsc --noEmit (package typecheck; --listFiles counts the pin file: 1)
os-verify-lock: VERDICT command-exit 0
vitest run (whole @objectstack/metadata-protocol)
 Test Files  372 passed | 9 skipped (381)
      Tests  23579 passed | 45 skipped (23624)
os-verify-lock: VERDICT command-exit 0
```
</details>

## Acceptance notes

- The pin went green on `main` as written, so this PR adds no fix. The
behaviour already held.
- **Deviation from the claim's file surface:** the claim named "one new
pin test file". AGENTS.md binds a new pin for a component that already
has a shared harness file to go into that file as a top-level `describe`
(ruling record 6583487846). The PR objectstack-ai#35444 harness (`SCHEMAS` +
`makeProtocol`) is exactly what this pin needs, so the pin is in that
file under a `[objectstack-ai#35528]` describe and the harness is not copied. Two
schema rows and two lookups were added to its `SCHEMAS`.

## Verification

Read first: (1) the new `describe` at the end of
`protocol.expand-disabled-package-35427.test.ts`, (2) the
`refuseUnservedRelationTarget` docblock in `protocol.ts`, (3) the
`EXPANSION_TARGET_OPERATION` docblock.

Two-minute check: `pnpm --filter @objectstack/metadata-protocol exec
vitest run src/protocol.expand-disabled-package-35427.test.ts` should
report 15 passed, 3 of them under `[objectstack-ai#35528]`.

<details><summary>Derived gate families, local run at head
224d707</summary>

`node scripts/pm/dispatch-gates.mjs --commands` derived 104 families
from the 5 changed paths. All 104 were run after the final commit. Each
exit code was captured before any pipe, and the `--ran` reconciliation
over that record says: `104 derived famil(ies) accounted for — 103 run,
1 NOT-MEASURED (1 DERIVED from a recorded exit 3)`.

- 103 exited 0, including `pnpm check:facade-delegation-only`:
`packages/metadata-protocol/src/protocol.ts: 11705 lines, ceiling 11705
(0 left)`.
- NOT MEASURED: `node scripts/check-plugin-teardown-shape.mjs
--self-test` exited 3. The reason is a shallow clone: it cannot read its
positive-control commit `621a4876`, and this run did not deepen the
shared clone. CI runs it.
</details>

Ceiling note: the first head (13b9b1b) grew `protocol.ts` by 11 lines,
and the facade line ceiling (0 margin, ruling 6897467376) went red on
that. The second commit rewrites the docblocks so they take exactly the
lines they replace, net 0 in `protocol.ts`. The ceiling was not raised.

---

_Generated by [Claude
Code](https://claude.ai/code/session_01L9qibyBJGiLjzCtE4F6HHB)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation security size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants