Repository navigation
fix(metadata-protocol)!: $expand and a relation condition stop serving a disabled package's object - #35444
Conversation
…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>
📓 Docs Drift Check2 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
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # 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 |
…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>
|
repo:objectstack#5 · os-bill · session_01Utp6CbP6iSEGkWb5fn8yqd 2026-11-19T10:50Z Final head for review: Area notes for the reviewer:
|
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 维护者速读
席位核对 — ACCEPT (L1-a) · repo:objectstack#5 · head
|
|
repo:objectstack#5 · os-bill · session_01Utp6CXsZsKmgG1EcKp5bY4 席位核对 — correction to ACCEPT 7007008749 (L1-a) · head
|
Claude-Session: https://claude.ai/code/session_01Utp6CbP6iSEGkWb5fn8yqd Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#5 · os-bill · session_01Utp6CbUb7TcZK1XUAddUmQ Contract reviewServed-tier: ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentThe narrowing takes no declared capability away. It makes a published refusal real on two hops that did not ask it.
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.
Implemented-by: VERDICT: PASS |
|
repo:objectstack#5 · os-bill · session_01Utp6CbP6iSEGkWb5fn8yqd 2026-11-19T11:50Z Landing PR #35444 (card #35427) at head
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. |
…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>
Requested by Bill · project thread
Fixes #35427
Clause-②: no (narrowing:
$expandwithholds 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
$expandserves; the change moves a runtime answer, not anything an author writes维护者速读
席位核对
packages/metadata-protocol/src/protocol-query-validation.ts(the two guards inservesExpansionTargetandrefuseUnservedRelationTarget),packages/metadata-protocol/src/protocol.expand-disabled-package-35427.test.ts,.changeset/35427-expand-disabled-package.md.pnpm --filter @objectstack/metadata-protocol exec vitest run --maxWorkers=2 src/protocol.expand-disabled-package-35427.test.ts— 12 tests green (head 1153f76).isObjectOfDisabledPackage), expand withheld (bare id), relation condition refused withobjectPackageDisabledError.What changes
servesExpansionTargetnow also asksisObjectOfDisabledPackage(registry, target): an$expandentry (comma list, POST relation map, by-idexpand, any nesting level) whose target belongs to a disabled package is withheld exactly as anapiEnabled: falsetarget already is. The lookup keeps its stored id; the engine reads nothing of the target.referenceNameVisibletitles are produced inside the engine's expansion loop over the handed map (expandRelatedRecords→serveReferenceNames), so a withheld entry gets no title either.refuseUnservedRelationTargetfirst asks the same predicate: a nested-relation condition on such a target throwsobjectPackageDisabledError(target)(404OBJECT_PACKAGE_DISABLED,objectset) withparamset 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.protocol.tsdocblocks untouched (fence).Tests
New
protocol.expand-disabled-package-35427.test.ts(fake engine, theprotocol.expand-target-exposureharness shape): 6 pins + 6 CONTROLs at head 1153f76. The by-id unit pin was dropped in 1153f76: agetDatadouble needs afindOnedouble, whichcheck:engine-double-contractwants recorded in a ledger outside the fence. By-id is covered at the real door below and runs through the sameservedExpandas 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_ref200 withb_ref= full row incl.secret_note;GET /data/alpha_obj/:id?expand=b_ref200, same; relation$filterhit 1 row / miss 0 rows (oracle).At d18331a (metadata-protocol rebuilt): list
$expandand by-idexpand200 withb_refthe bare id; relation$filterhit and miss both 404OBJECT_PACKAGE_DISABLED;GET /data/beta_obj404 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)
&& true: 4 failed | 9 passed (the four$expandpins).if (false): 3 failed | 10 passed (the three relation-condition pins).;, 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.typecheckexit 0.Acceptance notes
service-analyticsobject gate has no disabled-package check.test:repois 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