Skip to content

Commit 7256944

Browse files
committed
test(metadata-protocol): the credentialsRef pin's find double holds the caller's bound; record its engine double in the ledger
The stub engine's `find` applies `limit` after the filter, as the ObjectQL double-limit gate asks of a new double, and the engine-double ledger records the pin's `findOne` and `update` seams (regenerated with `check-engine-double-contract.mjs --write`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016WV4cx2wNeyC4kD8R4P7Ns
1 parent 7e9b721 commit 7256944

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎packages/metadata-protocol/src/protocol.datasource-credentials-ref-own-reference.test.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ function makeStubEngine() {
7070
assertEngineFindOnePredicate(table, opts);
7171
return findRow(opts.where)?.row ?? null;
7272
},
73-
async find(_table: string, opts: { where: Record<string, unknown> }) {
74-
return Array.from(rows.values()).filter((r) => matches(r, opts.where));
73+
async find(_table: string, opts: { where: Record<string, unknown>; limit?: number }) {
74+
const hits = Array.from(rows.values()).filter((r) => matches(r, opts.where));
75+
return typeof opts?.limit === 'number' ? hits.slice(0, opts.limit) : hits;
7576
},
7677
async insert(table: string, data: Record<string, unknown>) {
7778
writes.push(`insert ${table}`);

‎scripts/engine-double-contract.pinned.json‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,16 @@
606606
"verb": "findOne",
607607
"pinned": 2
608608
},
609+
{
610+
"file": "packages/metadata-protocol/src/protocol.datasource-credentials-ref-own-reference.test.ts",
611+
"verb": "findOne",
612+
"pinned": 1
613+
},
614+
{
615+
"file": "packages/metadata-protocol/src/protocol.datasource-credentials-ref-own-reference.test.ts",
616+
"verb": "update",
617+
"pinned": 1
618+
},
609619
{
610620
"file": "packages/metadata-protocol/src/protocol.datasource-delete-prolongation.test.ts",
611621
"verb": "delete",

0 commit comments

Comments
 (0)