Skip to content

Commit 94d624a

Browse files
committed
test(metadata-protocol): the lookupArtifactItem call-site pin reads the item and layered reads where their bodies now stand
Claude-Session: https://claude.ai/code/session_01ADHkmR4MjTzeUv5x6tNkbk Co-authored-by: Claude <noreply@anthropic.com>
1 parent dd1f1c8 commit 94d624a

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎packages/metadata-protocol/src/protocol.lookup-artifact-item-call-sites.test.ts‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ const BINDINGS_FILE = 'protocol-package-bindings.ts';
7171
const BINDINGS = readFileSync(fileURLToPath(new URL(`./${BINDINGS_FILE}`, import.meta.url)), 'utf8');
7272
/** [#25467 E2 cut 1a] The module the list read's body (`readFlattenedMetaItems`) moved to. */
7373
const LIST_READS_FILE = 'protocol-meta-list-reads.ts';
74+
/** [#25467 E2 cut 1b] The modules the item read's body (`readMetaItem`) and the layered read's body (`getMetaItemLayered`) moved to. */
75+
const ITEM_READS_FILE = 'protocol-meta-item-reads.ts';
76+
const LAYERED_READS_FILE = 'protocol-meta-layered-reads.ts';
7477

7578
/** A class member's header in `protocol.ts`: four spaces, optional modifiers, its name, its parameter list. */
7679
const MEMBER_HEADER = /^ {4}(?:(?:private|public|protected|static|async|override|readonly)\s+)*([A-Za-z_$][\w$]*)\s*(?:<[^>]*>)?\(|^ {4}(static) \{$/;
@@ -121,15 +124,15 @@ const SITES: ReadonlyArray<Site & { readonly noPackage: boolean; readonly dispos
121124
why: 'the definition itself: the class member\'s declared signature (its body delegates to the seam function below)' },
122125
{ file: SEAM_FILE, member: 'lookupArtifactItem', args: 'this: Pick<ArtifactLookupHost, \'engine\'>, type: string, name: string, currentPackageId?: string, member?: string', noPackage: false, disposition: 'definition',
123126
why: '[#25467 cut 15] the definition\'s body, the function the class member delegates to' },
124-
{ member: 'readMetaItem', args: 'request.type, request.name, envelopePackageId(request.packageId, item), bundleMemberOf(request.type, item)', noPackage: true, disposition: 'served-package envelope',
127+
{ file: ITEM_READS_FILE, member: 'readMetaItem', args: 'request.type, request.name, envelopePackageId(request.packageId, item), bundleMemberOf(request.type, item)', noPackage: true, disposition: 'served-package envelope',
125128
why: 'the by-name read\'s envelope: naming no package, the package of the item it serves (the list\'s rule); [#23074] at the served item\'s own bundle member' },
126129
{ file: LIST_READS_FILE, member: 'readFlattenedMetaItems', args: 'request.type, itemName, itemPackageId, bundleMemberOf(request.type, it)', noPackage: true, disposition: 'served-package envelope',
127130
why: 'the list\'s envelope: each item\'s own package, the rule the by-name read shares; [#23074] at each item\'s own bundle member' },
128-
{ member: 'readMetaItem', args: 'request.type, request.name, request.packageId', noPackage: true, disposition: 'no',
131+
{ file: ITEM_READS_FILE, member: 'readMetaItem', args: 'request.type, request.name, request.packageId', noPackage: true, disposition: 'no',
129132
why: 'the shipped-flow arm: the served body IS this artifact, and the envelope is looked up at its own package' },
130-
{ member: 'readMetaItem', args: 'request.type, request.name, request.packageId, wantedMember', noPackage: true, disposition: 'no',
133+
{ file: ITEM_READS_FILE, member: 'readMetaItem', args: 'request.type, request.name, request.packageId, wantedMember', noPackage: true, disposition: 'no',
131134
why: '[#22877] a bundled type\'s addressed member (the selector\'s, else the canonical one) when no stored row of it exists: the served body IS this artifact, and the envelope is looked up at its own package' },
132-
{ member: 'getMetaItemLayered', args: 'request.type, request.name, request.packageId, wantedMember', noPackage: true, disposition: 'no',
135+
{ file: LAYERED_READS_FILE, member: 'getMetaItemLayered', args: 'request.type, request.name, request.packageId, wantedMember', noPackage: true, disposition: 'no',
133136
why: 'the layered read\'s code LAYER: body and envelope are one artifact, and its provenance fields are read off that layer; [#26699] at the addressed member (the selector\'s, else the canonical one)' },
134137
{ member: 'packagedArtifactBase', args: 'type, name', noPackage: true, disposition: 'no',
135138
why: 'the packaged base the translators compare a served body against: nothing of it is grafted onto the body' },
@@ -230,7 +233,11 @@ describe('[#22024] every lookupArtifactItem( in protocol.ts has a recorded dispo
230233
// imports that definition rather than carrying a copy of its own.
231234
expect(BINDINGS).toMatch(/\nfunction envelopePackageId\(requestedPackageId: string \| undefined, served: unknown\): string \| undefined \{/);
232235
expect(SOURCE).not.toMatch(/\nfunction envelopePackageId\(/);
233-
expect(SOURCE).toMatch(/\nimport \{[^}]*\benvelopePackageId,[^}]*\} from '\.\/protocol-package-bindings\.js';/);
236+
// [#25467 E2 cut 1b] The item read's body moved too, so neither door stands in
237+
// protocol.ts any more: its module imports the same one definition.
238+
const itemReads = MODULE_SOURCES.get(ITEM_READS_FILE)!;
239+
expect(itemReads).not.toMatch(/\nfunction envelopePackageId\(/);
240+
expect(itemReads).toMatch(/\nimport \{[^}]*\benvelopePackageId,[^}]*\} from '\.\/protocol-package-bindings\.js';/);
234241
// [#25467 E2 cut 1a] The list read's body moved: its envelope line is read
235242
// where it now stands, and that module imports the same one definition.
236243
const listReads = MODULE_SOURCES.get(LIST_READS_FILE)!;

0 commit comments

Comments
 (0)