Skip to content

Commit e86bf99

Browse files
fix(service-record-context): a related object the stack does not define states nothing (#37751)
<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} --> _Requested by **Elon** · [project thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DLCo5F2y7fgbM8tstGoyyUn)_ Fixes #37486 Clause-②: no Metadata-protocol: none ## 维护者速读 - 用户能看到什么变化:资料包里关联了一个系统中根本不存在的对象(作者写错名字)时,AI 工具不再对任何人说「部分资料对你不可见」,只是不给这一节;真有权限限制的对象照旧提示。 - 为什么做:属于「记录范围的 AI 问询」这一组后续,让工具行为与设计一致:作者写错由校验报给作者,不伪装成权限问题。 - 出错会怎样:最坏是某个确实存在、只是此人看不到的对象漏了「不可见」提示;两种情况都有真实内核测试守着,可直接撤回此改动。 - 要你做的:无。设计文档里对应的那一句已先行合入(随另一项设计文档修订),本改动不再欠设计文档。 ## What changes `executeGetRecordContext` step 4a (`packages/services/service-record-context/src/record-context-tools.ts`): a `related` child that passes the read guard and API exposure and that this caller is not served is still left out and never read again. The `not_visible` statement now fires only when the door's **published** definition of the object exists (`door.publishedObjectDefinitionOf`). A name the published definitions lack is an author defect (ADR-0160 D1, `os validate` reports it as `ai-context-object-unknown`) and states nothing (D3: "A name the published definition lacks is an author defect ([D1](#d1)) and fires nothing."). Why this fact: it is the same for every caller. Both door implementations were read on `origin/main` 579b857: - HTTP (`packages/runtime/src/domains/mcp.ts`, `publishedObjectDefinitionOf` → `readServedObject`): the protocol's merged `getMetaItems({ type: 'object' })` listing, with no caller argument, or the metadata service's `getObject`. No masker. An absent name answers `undefined` → `null`, no throw. - stdio (`packages/mcp/src/stdio-data-bridge.ts`, `readObjectDeclaration`): `getMetaItemForExecution` / `getMetaItem` by name, falling back to the metadata service's copy; no principal. An absent name answers `undefined` → `null`. Its one rethrow is `OBJECT_PACKAGE_DISABLED`, which API exposure has already refused one step earlier. - `assertApiExposed` on the HTTP door is `refuseUnexposedDataAction(..., 'refuse')`: on no declaration it falls open to schema defaults (`apiEnabled` true), so an undefined object reaches step 4a's served read on both doors, as the card said. A throw from the new read is judged the way every other step-4a read is: a coded refusal refuses the call unnamed, any other throw fails it `INTERNAL_ERROR` 500 naming nothing (`refusedOrFailed`). The definition is used as a boolean only; nothing of it is carried. Comments in the same file that said a left-out child's definition is never read are corrected to say what the code now does. ## ADR-0160 amendment The ADR text this change implements has landed first, as ruling B on this card ordered (record 7208943876): PR #37785 (merge commit `031a19dc`) amended ADR-0160 a sixth time. D3 "Object level", the bullet "A `related` child that this caller is not served is left out.", now reads: > Nothing of the child is read except its published definition, which is asked once, for whether the stack defines the object at all (sixth amendment, 2026-11-27): a name the published definitions lack is an author defect ([D1](#d1)), left out with no statement for every caller. The published definition is the same for every caller, so whether the statement fires depends on this caller's served schema alone, and nothing of the definition is carried. That is the replacement this PR had proposed, with the amendment's date added. The amendment record names this PR and says `main` reads nothing of such a child until it merges. `docs/adr/**` is not touched here; this branch carries the amended text by merging `origin/main` at `29804839` (merge commit `3e30d721`). ## Tests <details><summary>Measured first: the real-kernel case red on main (both doors agree, both carry the note)</summary> `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-record-context-tools-bridge.test.ts` at 7adbe2d (tests only, `src/` = main 579b857): ``` × [ADR-0160 D1/D3] a related entry naming an object the stack does not define leaves its section out and states nothing: the same bytes for both callers, on both doors AssertionError: expected [ { kind: 'not_visible', …(1) } ] to deeply equal [] + "kind": "not_visible", + "text": "Some of the material this pack covers is not visible to you, so it is not given. Do not treat it as empty or absent, and do not guess it.", Tests 1 failed | 29 passed (30) ``` The `/mcp`-vs-stdio byte equality held before the note assertion, so the defect was on both doors. The two-caller defined-but-unserved case passed on main, as it should. </details> <details><summary>Green after the fix, and the ablation</summary> - `@objectstack/runtime` `src/mcp-record-context-tools-bridge.test.ts`: Tests 30 passed (30). - `@objectstack/service-record-context` `pnpm test`: Test Files 3 passed (3), Tests 180 passed (180). - Ablation (`scripts/ablation-replace.mjs`, fix committed first): `if (published) hidden = true;` → `hidden = Boolean('ABLATION_37486');`; `ablation-dist-preflight` found the marker in 2 built files; the runtime case and the new unit case each went red (1 failed | 29 passed; 1 failed | 132 passed); restore leg: marker absent from all 6 built files, working tree clean against HEAD. A first attempt used a comment marker, which the build strips: its dist reading failed, so that attempt counts for nothing. </details> <details><summary>Merge round: re-measured on head 3e30d72 (origin/main 2980483 merged, no conflict)</summary> - The merge brought no change to this PR's four files: `git diff --stat cb1a47e..3e30d72` over them is empty, and the branch delta against `origin/main` is still the same four files (+130 / -11). The two door implementations read above (`packages/runtime/src/domains/mcp.ts`, `packages/mcp/src/stdio-data-bridge.ts`) are unchanged between 579b857 and 2980483. - `@objectstack/service-record-context` `pnpm test`: Test Files 3 passed (3), Tests 180 passed (180); `typecheck`: exit 0 (test layer 0 errors). - `@objectstack/runtime` `src/mcp-record-context-tools-bridge.test.ts`: Tests 30 passed (30); `typecheck`: exit 0 (test layer at its ledger: 27 files / 183 errors / 66 pinned signatures). - `dispatch-gates --commands` for this head: 66 of 67 derived families exit 0; `check:dual-build-cjs-loads` not measured locally (it reads every package's `dist/`, and only the closure was built); CI's `Lint & Repo Gates` carries it. - `overlap-check`: merges cleanly with `origin/main` 2980483; no open PR shares a file. </details> New cases: - Real kernel, both doors, `packages/runtime/src/mcp-record-context-tools-bridge.test.ts` (shared harness extended with object `rc_partner`, served to `usr_member` through `rc_unmasker` and not to `usr_plain`, and packs `rc_misspelt_child` / `rc_role_child`): - an undefined `related` object (`rc_ghost`): no section, `notes` `[]`, the name nowhere, for `usr_member` and `usr_plain`, and the two callers' answers byte-identical; - a defined child served to one caller and not the other: its section for `usr_member` with no note; for `usr_plain` no section, one `not_visible` note, `rc_partner` named nowhere. - Unit, `src/__tests__/record-context-tools.test.ts`: the undefined child states nothing while a hidden field or an unserved defined child beside it still states; a left-out child's published read that throws refuses unnamed (coded) or fails `INTERNAL_ERROR` (uncoded). Two pins that said a left-out child's published definition is never asked now pin the new order: guard, exposure, served read, published read, then nothing. ## Acceptance notes - The card's Acceptance asks to state the `Clause-②` line because the tool's answer changes; the claim binds `Clause-②: no`, which is what this PR and its changeset carry. Flagged in the report, not re-ruled here. - The card cites ADR-0160 point 20 (fields); the governing text for an unknown object is D1 and D3. ## Verification Read first (by risk): 1. `packages/services/service-record-context/src/record-context-tools.ts`, the `if (!served)` hunk of step 4a. 2. `packages/runtime/src/mcp-record-context-tools-bridge.test.ts`, the two new cases and the fixture's `rc_partner` permissions. 3. `packages/services/service-record-context/src/__tests__/record-context-tools.test.ts`, the two re-pinned order assertions. Two-minute check: `pnpm --filter @objectstack/runtime exec vitest run --maxWorkers=2 src/mcp-record-context-tools-bridge.test.ts` after building the closure: expect 30 passed, including "a related entry naming an object the stack does not define …". --- _Generated by [Claude Code](https://claude.ai/code/session_016WV4cxBECSPtHxQMZDHSie)_ <!-- signed: repo:objectstack#1 · os-elon-musk · session_016WV4cxBECSPtHxQMZDHSie --> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent 37425b3 commit e86bf99

4 files changed

Lines changed: 130 additions & 11 deletions

File tree

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
'@objectstack/service-record-context': patch
3+
---
4+
5+
fix(service-record-context): `get_record_context` states nothing for a `related` object the stack does not define
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A context pack whose `related` entry names an object no package and no environment defines (a misspelt name, or a package removed after the pack was written) is an author defect: `os validate` reports it (`ai-context-object-unknown`), and ADR-0160 D1 says the tool answer says nothing about it. Until now the section was left out and every caller was told "Some of the material this pack covers is not visible to you", which reads as a permission narrowing nobody configured.
11+
12+
The section is still left out. The not-visible statement now fires only when the stack publishes the object and this caller is not served it, as it did before for a defined child. The judgement reads the published definition, which is the same for every caller, so the answer for one caller reveals nothing about another caller's access: two callers get the same bytes for a pack with an undefined `related` object, on the `/mcp` door and the stdio door alike. Nothing of the published definition is carried in the answer.

‎packages/runtime/src/mcp-record-context-tools-bridge.test.ts‎

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ describe('[ADR-0149 D7 · ADR-0160 D4] get_record_context over one real kernel:
453453
},
454454
child('rc_closed', 'Closed', { enable: { apiEnabled: false } }),
455455
child('rc_hidden', 'Hidden'),
456+
// Served to `usr_member` alone (its `rc_unmasker` grant), not to `usr_plain`.
457+
child('rc_partner', 'Partner'),
456458
{
457459
name: 'rc_vault', label: 'Vault', sharingModel: 'public_read_write', enable: { apiEnabled: false },
458460
fields: { label: { name: 'label', type: 'text', label: 'Label' } },
@@ -494,6 +496,15 @@ describe('[ADR-0149 D7 · ADR-0160 D4] get_record_context over one real kernel:
494496
},
495497
{ name: 'rc_exposure_child', label: 'Exposure child', object: 'rc_policy', fields: ['title'], related: [{ object: 'rc_closed', fields: ['version'] }] },
496498
{ name: 'rc_disabled_child', label: 'Disabled child', object: 'rc_policy', fields: ['title'], related: [{ object: 'rc_off', fields: ['version'] }] },
499+
// [ADR-0160 D1] An author defect: `rc_ghost` is an object the stack does not define.
500+
{
501+
name: 'rc_misspelt_child', label: 'Misspelt child', object: 'rc_policy', fields: ['title'],
502+
related: [{ object: 'rc_ghost', fields: ['version'] }, { object: 'rc_step', fields: ['label'], orderBy: [{ field: 'rank', order: 'asc' }] }],
503+
},
504+
{
505+
name: 'rc_role_child', label: 'Role child', object: 'rc_policy', fields: ['title'],
506+
related: [{ object: 'rc_partner', fields: ['version'] }, { object: 'rc_step', fields: ['label'], orderBy: [{ field: 'rank', order: 'asc' }] }],
507+
},
497508
],
498509
} as never);
499510
engine.registerApp({
@@ -516,6 +527,7 @@ describe('[ADR-0149 D7 · ADR-0160 D4] get_record_context over one real kernel:
516527
await engine.insert('rc_revision', { id: 'r1', version: 'v1', policy: 'p1', owner_id: 'usr_member', organization_id: 'org_1' }, sys);
517528
await engine.insert('rc_revision', { id: 'r2', version: 'v2', policy: 'p1', owner_id: 'usr_other', organization_id: 'org_1' }, sys);
518529
await engine.insert('rc_hidden', { id: 'h1', version: 'h', policy: 'p1', organization_id: 'org_1' }, sys);
530+
await engine.insert('rc_partner', { id: 'pt1', version: 'pt', policy: 'p1', organization_id: 'org_1' }, sys);
519531
for (const [id, stage, rank, at] of [
520532
['s1', 'open', 1, '2026-11-01T00:00:00.000Z'],
521533
['s2', 'open', 3, '2026-11-02T00:00:00.000Z'],
@@ -530,12 +542,12 @@ describe('[ADR-0149 D7 · ADR-0160 D4] get_record_context over one real kernel:
530542

531543
const sets = [PermissionSetSchema.parse({
532544
name: 'rc_member', label: 'Member', isDefault: true,
533-
objects: { '*': READ_ALL, rc_hidden: READ_NONE },
545+
objects: { '*': READ_ALL, rc_hidden: READ_NONE, rc_partner: READ_NONE },
534546
fields: { 'rc_policy.secret_note': { readable: false, editable: false } },
535547
rowLevelSecurity: [{ name: 'rc_own_revisions', object: 'rc_revision', operation: 'select', using: 'owner_id == current_user.id' }],
536548
}), PermissionSetSchema.parse({
537549
// Granted to `usr_member` alone (its `sys_user_permission_set` row below).
538-
name: 'rc_unmasker', label: 'Unmasker', systemPermissions: ['rc_unmask'], objects: {},
550+
name: 'rc_unmasker', label: 'Unmasker', systemPermissions: ['rc_unmask'], objects: { rc_partner: READ_ALL },
539551
})];
540552
const services: Record<string, any> = {
541553
manifest: { register: vi.fn() },
@@ -763,6 +775,38 @@ describe('[ADR-0149 D7 · ADR-0160 D4] get_record_context over one real kernel:
763775
expect(answer.text).not.toContain('Hidden');
764776
});
765777

778+
it('[ADR-0160 D1/D3] a related entry naming an object the stack does not define leaves its section out and states nothing: the same bytes for both callers, on both doors', async () => {
779+
// Precondition: no package and no environment defines it, so it is an author defect (`os validate`).
780+
expect(engine.getSchema('rc_ghost')).toBeUndefined();
781+
expect(await protocol.getMetaItems({ type: 'object' } as never)).not.toContainEqual(expect.objectContaining({ name: 'rc_ghost' }));
782+
const member = await both({ objectName: 'rc_policy', recordId: 'p1', context: 'rc_misspelt_child' });
783+
const plain = await bothAsPlain({ objectName: 'rc_policy', recordId: 'p1', context: 'rc_misspelt_child' });
784+
for (const answer of [member, plain]) {
785+
expect(answer.isError).toBe(false);
786+
// The other entry still answers; the undefined one has no section, no name and no statement.
787+
expect(answer.payload.data.related.map((l: { object: string }) => l.object)).toEqual(['rc_step']);
788+
expect(answer.payload.data.related[0].rows.map((r: { id: string }) => r.id)).toEqual(['s1', 's3', 's2', 's4']);
789+
expect(answer.payload.notes).toEqual([]);
790+
expect(answer.text).not.toContain('rc_ghost');
791+
}
792+
// Who asks changes nothing: one answer, byte for byte.
793+
expect(plain.text).toBe(member.text);
794+
});
795+
796+
it('[ADR-0160 D3 as amended] a defined child served to one caller and not the other: its section for the one, the not-visible statement for the other, on both doors', async () => {
797+
const member = await both({ objectName: 'rc_policy', recordId: 'p1', context: 'rc_role_child' });
798+
expect(member.isError).toBe(false);
799+
expect(member.payload.data.related.map((l: { object: string }) => l.object)).toEqual(['rc_partner', 'rc_step']);
800+
expect(member.payload.data.related[0].rows.map((r: { id: string }) => r.id)).toEqual(['pt1']);
801+
expect(member.payload.notes).toEqual([]);
802+
const plain = await bothAsPlain({ objectName: 'rc_policy', recordId: 'p1', context: 'rc_role_child' });
803+
expect(plain.isError).toBe(false);
804+
expect(plain.payload.data.related.map((l: { object: string }) => l.object)).toEqual(['rc_step']);
805+
expect(plain.payload.notes.map((n: { kind: string }) => n.kind)).toEqual(['not_visible']);
806+
expect(plain.payload.notes[0]).not.toHaveProperty('object');
807+
for (const word of ['rc_partner', 'Partner', 'pt1']) expect(plain.text).not.toContain(word);
808+
});
809+
766810
it('a related child its API exposure refuses refuses the call, named (the caller\'s schema shows it)', async () => {
767811
const answer = await both({ objectName: 'rc_policy', recordId: 'p1', context: 'rc_exposure_child' });
768812
expect(answer.isError).toBe(true);

‎packages/services/service-record-context/src/__tests__/record-context-tools.test.ts‎

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,15 +273,60 @@ describe('get_record_context — object level: a gate that refuses everyone refu
273273
const text = JSON.stringify(out);
274274
expect(text).not.toContain('policy_revision');
275275
expect(text).not.toContain('Policy revision');
276-
// Nothing of the child is read after its object-level judgement, its published definition included.
276+
// Nothing of the child is read after its object-level judgement, which asks its published
277+
// definition once, last, for whether the stack defines it at all (ADR-0160 D1).
277278
expect(door.asked.filter((a) => a.object === 'policy_revision').map((a) => a.member))
278-
.toEqual(['readGuard', 'assertApiExposed', 'servedObjectDefinitionOf']);
279+
.toEqual(['readGuard', 'assertApiExposed', 'servedObjectDefinitionOf', 'publishedObjectDefinitionOf']);
279280
// Control: served, both children answer and nothing is stated.
280281
const control = await run(twoChildren());
281282
expect(control.data.related!.map((l) => l.object)).toEqual(['policy_revision', 'claim']);
282283
expect(control.notes).toEqual([]);
283284
});
284285

286+
it('[ADR-0160 D1/D3] a child the stack does not define is left out stating nothing, the same answer whoever asks', async () => {
287+
// `policy_ghost` has no published definition: an author defect, reported by `os validate`.
288+
const ghost = (overrides: Partial<FakeApp> = {}): FakeApp => {
289+
const app = twoChildren(overrides);
290+
(app.packs[0] as { related: Array<Record<string, unknown>> }).related[0] = { object: 'policy_ghost', field: 'policy', fields: ['version'] };
291+
return app;
292+
};
293+
const door = fakeDoor(ghost());
294+
const out = await executeGetRecordContext(CALL, door);
295+
expect(out.data.related!.map((l) => l.object)).toEqual(['claim']);
296+
expect(out.notes).toEqual([]);
297+
expect(JSON.stringify(out)).not.toContain('policy_ghost');
298+
expect(door.asked.filter((a) => a.object === 'policy_ghost').map((a) => a.member))
299+
.toEqual(['readGuard', 'assertApiExposed', 'servedObjectDefinitionOf', 'publishedObjectDefinitionOf']);
300+
// A second caller, one the root's other child is hidden from, gets the same answer for the ghost:
301+
// whether it states anything is the stack's published definitions, never the caller's schema.
302+
const other = await run(ghost({ hiddenFields: { claim: ['number'] } }));
303+
expect(other.data.related!.map((l) => l.object)).toEqual(['claim']);
304+
expect(other.notes).toEqual([{ kind: 'not_visible', text: sentencesFor([]).notVisible }]);
305+
const alone = await run(ghost({ unservedObjects: ['claim'] }));
306+
expect(alone.data.related ?? []).toEqual([]);
307+
// Only the defined child the caller is not served is stated.
308+
expect(alone.notes).toEqual([{ kind: 'not_visible', text: sentencesFor([]).notVisible }]);
309+
const withoutClaim = ghost();
310+
(withoutClaim.packs[0] as { related: unknown[] }).related.pop();
311+
expect((await run(withoutClaim)).notes).toEqual([]);
312+
});
313+
314+
it('[ADR-0160 D1/D3] a left-out child\'s published-definition read that throws: a coded refusal refuses unnamed, a failure fails, never stated or dropped', async () => {
315+
const coded = fakeDoor(twoChildren({ unservedObjects: ['policy_revision'], unpublishedObjects: ['policy_revision'] }));
316+
const refused = await refusalOf(executeGetRecordContext(CALL, coded));
317+
expect(refused).toMatchObject({ code: 'PERMISSION_DENIED', status: 403 });
318+
expect(refused.message).not.toContain('policy_revision');
319+
expect(coded.reads).toEqual([]);
320+
const failing = fakeDoor(twoChildren({ unservedObjects: ['policy_revision'] }));
321+
const publishedOf = failing.publishedObjectDefinitionOf.bind(failing);
322+
const thrown = new Error('store down: policy_revision');
323+
failing.publishedObjectDefinitionOf = async (object) => {
324+
if (object === 'policy_revision') throw thrown;
325+
return publishedOf(object);
326+
};
327+
await expect(executeGetRecordContext(CALL, failing)).rejects.toMatchObject({ code: 'INTERNAL_ERROR', status: 500, cause: thrown });
328+
});
329+
285330
it('[as amended] a lookup target reached only through a left-out child is not judged: it refuses nothing', async () => {
286331
const app = twoChildren({ unservedObjects: ['policy_revision'], guardedObjects: ['account'] });
287332
(app.packs[0] as { related: Array<{ fields: string[] }> }).related[0].fields = ['version', 'reviewer'];
@@ -358,10 +403,13 @@ describe('get_record_context — object level: a gate that refuses everyone refu
358403
await refusalOf(executeGetRecordContext(CALL, door));
359404
expect(door.asked).not.toContainEqual({ member: 'publishedObjectDefinitionOf', object: 'policy_revision' });
360405
}
361-
// [as amended] A child left out for this caller is not read either.
406+
// [as amended] A child left out for this caller is asked its published definition once, after
407+
// its gates and its served read, and nothing of it is read after that.
362408
const leftOut = fakeDoor(policyApp({ unservedObjects: ['policy_revision'] }));
363409
await executeGetRecordContext(CALL, leftOut);
364-
expect(leftOut.asked).not.toContainEqual({ member: 'publishedObjectDefinitionOf', object: 'policy_revision' });
410+
expect(leftOut.asked.filter((a) => a.object === 'policy_revision').map((a) => a.member))
411+
.toEqual(['readGuard', 'assertApiExposed', 'servedObjectDefinitionOf', 'publishedObjectDefinitionOf']);
412+
expect(leftOut.reads.map((r) => r.object)).not.toContain('policy_revision');
365413
const door = fakeDoor(policyApp());
366414
await executeGetRecordContext(CALL, door);
367415
const at = (member: string) => door.asked.findIndex((a) => a.member === member && a.object === 'policy_revision');

‎packages/services/service-record-context/src/record-context-tools.ts‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ import { sentencesFor, type Sentences } from './sentences.js';
6969
* the caller's served schema shows it (the naming bound). A related child
7070
* that passes both and that THIS caller is not served is left out: nothing of
7171
* it is read again, its section is not named, and the notes carry the one
72-
* not-visible statement. A field the caller's served schema hides is not
72+
* not-visible statement, when the stack publishes the object; a child the
73+
* published definitions lack is left out stating nothing (D1). A field the caller's served schema hides is not
7374
* named: the entry, a related section whose link it is, or the body, is left
7475
* out, and the notes carry the same statement. A field the served
7576
* schema shows and field-level security withholds keeps its name and label,
@@ -494,7 +495,9 @@ export async function executeGetRecordContext(input: unknown, door: RecordContex
494495
// to anyone either, so judging exposure after the served definition
495496
// would read it as this caller's narrowing). A child that passes both
496497
// and that THIS caller is not served is left out: never named, never
497-
// read again, with the one not-visible statement.
498+
// read again, with the one not-visible statement when its published
499+
// definition exists, and with none when it does not (an author defect,
500+
// D1): the one fact asked of the published definition here.
498501
const childServed = new Map<string, Record<string, unknown>>();
499502
const leftOut = new Set<string>();
500503
for (const entry of pack.related ?? []) {
@@ -525,8 +528,20 @@ export async function executeGetRecordContext(input: unknown, door: RecordContex
525528
return refusedOrFailed(err, () => refuseObject(entry.object, false));
526529
}
527530
if (!served) {
531+
// [ADR-0160 D1/D3] Left out either way, and never read again. Stated
532+
// only when the stack publishes the object: a name the published
533+
// definitions lack is an author defect (`os validate`), which states
534+
// nothing. The published definition is the same for every caller, so
535+
// the statement depends on this caller's served schema alone, and the
536+
// definition is asked for that one fact: nothing of it is carried.
537+
let published: Record<string, unknown> | null;
538+
try {
539+
published = await door.publishedObjectDefinitionOf(entry.object);
540+
} catch (err) {
541+
return refusedOrFailed(err, () => refuseObject(entry.object, false));
542+
}
528543
leftOut.add(entry.object);
529-
hidden = true;
544+
if (published) hidden = true;
530545
continue;
531546
}
532547
childServed.set(entry.object, served);
@@ -536,8 +551,8 @@ export async function executeGetRecordContext(input: unknown, door: RecordContex
536551
// already passed; one that still throws a coded refusal refuses the call
537552
// unnamed, and one that fails fails it, naming nothing, so no door's own
538553
// rendering of either can name what the caller is not shown. A child left
539-
// out for this caller is never read, its definition included: the plan
540-
// reads it as having no published definition.
554+
// out for this caller is never read again, its definition included: the
555+
// plan reads it as having no published definition.
541556
const publishedOf = async (name: string): Promise<Record<string, unknown> | null> => {
542557
if (leftOut.has(name)) return null;
543558
try {

0 commit comments

Comments
 (0)