@sensigo/realm-testing 0.31.2 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/store/in-memory-store.d.ts +15 -1
- package/dist/store/in-memory-store.d.ts.map +1 -1
- package/dist/store/in-memory-store.js +52 -5
- package/dist/store/in-memory-store.js.map +1 -1
- package/dist/store/run-store-fidelity-contract.d.ts.map +1 -1
- package/dist/store/run-store-fidelity-contract.js +11 -0
- package/dist/store/run-store-fidelity-contract.js.map +1 -1
- package/dist/store/settlement-contract.d.ts +82 -0
- package/dist/store/settlement-contract.d.ts.map +1 -0
- package/dist/store/settlement-contract.js +2508 -0
- package/dist/store/settlement-contract.js.map +1 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ export { runStoreFidelityContract } from './store/run-store-fidelity-contract.js
|
|
|
5
5
|
export type { RunStoreFidelityLaw, RunStoreFidelityContractCase, RunStoreFidelityContractAdapter, } from './store/run-store-fidelity-contract.js';
|
|
6
6
|
export { fencedTraceBufferContract } from './store/fenced-trace-buffer-contract.js';
|
|
7
7
|
export type { FencedTraceBufferLaw, FencedTraceBufferContractCase, FencedTraceBufferContractAdapter, } from './store/fenced-trace-buffer-contract.js';
|
|
8
|
+
export { settlementContract, defaultSettlementFixture } from './store/settlement-contract.js';
|
|
9
|
+
export type { SettlementLaw, SettlementContractCase, SettlementContractAdapter, SettlementFixture, } from './store/settlement-contract.js';
|
|
8
10
|
export { loadFixtureFromFile, loadFixtureFromString, loadFixturesFromDir, } from './fixtures/fixture-loader.js';
|
|
9
11
|
export type { TestFixture, MockOperations } from './fixtures/fixture-loader.js';
|
|
10
12
|
export { MockServiceRecorder } from './mocks/mock-service.js';
|
|
@@ -19,5 +21,5 @@ export { runFixtureTests } from './runner/test-runner.js';
|
|
|
19
21
|
export type { TestResult, RunFixtureTestsOptions } from './runner/test-runner.js';
|
|
20
22
|
export { startGitHubMockServer } from './servers/github-mock-server.js';
|
|
21
23
|
export type { GitHubMockServerHandle } from './servers/github-mock-server.js';
|
|
22
|
-
export declare const VERSION = "0.
|
|
24
|
+
export declare const VERSION = "0.33.0";
|
|
23
25
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,YAAY,EACV,gBAAgB,EAChB,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AACpF,YAAY,EACV,oBAAoB,EACpB,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,YAAY,EACV,gBAAgB,EAChB,yBAAyB,EACzB,kCAAkC,GACnC,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAClF,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,+BAA+B,GAChC,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,yBAAyB,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|
4
4
|
export { perRunArtifactStoreContract } from './store/per-run-artifact-store-contract.js';
|
|
5
5
|
export { runStoreFidelityContract } from './store/run-store-fidelity-contract.js';
|
|
6
6
|
export { fencedTraceBufferContract } from './store/fenced-trace-buffer-contract.js';
|
|
7
|
+
export { settlementContract, defaultSettlementFixture } from './store/settlement-contract.js';
|
|
7
8
|
// Fixtures
|
|
8
9
|
export { loadFixtureFromFile, loadFixtureFromString, loadFixturesFromDir, } from './fixtures/fixture-loader.js';
|
|
9
10
|
// Mocks
|
|
@@ -20,5 +21,5 @@ export { testAdapter } from './helpers/test-adapter.js';
|
|
|
20
21
|
export { runFixtureTests } from './runner/test-runner.js';
|
|
21
22
|
// Servers
|
|
22
23
|
export { startGitHubMockServer } from './servers/github-mock-server.js';
|
|
23
|
-
export const VERSION = '0.
|
|
24
|
+
export const VERSION = '0.33.0';
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,QAAQ;AACR,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAMzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAMlF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,iEAAiE;AAEjE,QAAQ;AACR,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AAMzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAMlF,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAMpF,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAQ9F,WAAW;AACX,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAGtC,QAAQ;AACR,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,aAAa;AACb,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAElC,oBAAoB;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,SAAS;AACT,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1D,UAAU;AACV,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAGxE,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type RunStore, type RunRecord, type CreateRunOptions, type WorkflowDefinition, type LoadBearingRunRecordField } from '@sensigo/realm';
|
|
1
|
+
import { type RunStore, type RunRecord, type CreateRunOptions, type WorkflowDefinition, type LoadBearingRunRecordField, type SettlementDelta, type SettlementResult } from '@sensigo/realm';
|
|
2
2
|
/** In-memory implementation of RunStore. Uses a Map keyed by run ID. No I/O, no locking. */
|
|
3
3
|
export declare class InMemoryStore implements RunStore {
|
|
4
4
|
private readonly runs;
|
|
@@ -16,6 +16,20 @@ export declare class InMemoryStore implements RunStore {
|
|
|
16
16
|
get(runId: string): Promise<RunRecord>;
|
|
17
17
|
update(record: RunRecord): Promise<RunRecord>;
|
|
18
18
|
claimStep(runId: string, stepName: string, definition: WorkflowDefinition): Promise<RunRecord>;
|
|
19
|
+
/**
|
|
20
|
+
* Atomically applies one `SettlementDelta` to this run's fresh state (issue #279, increment 1).
|
|
21
|
+
* DORMANT until PR-B — see `RunStore.settleStep`'s own JSDoc for the full contract.
|
|
22
|
+
*
|
|
23
|
+
* NO `await` between the read (`this.runs.get`) and the write (`this.runs.set`) — mirrors
|
|
24
|
+
* `claimStep`'s own documented no-await stretch above (issue #188's single-owner discipline):
|
|
25
|
+
* `applySettlement` is itself pure/synchronous, so calling it here does not introduce a
|
|
26
|
+
* microtask-yield point between the fresh read and the committing write. A behavioral overlap
|
|
27
|
+
* test (this package's own conformance suite) pins this directly: two disjoint concurrent
|
|
28
|
+
* settles via `Promise.all` both land, proving no interleaving window exists.
|
|
29
|
+
*/
|
|
30
|
+
settleStep(runId: string, delta: SettlementDelta, definition: WorkflowDefinition, options?: {
|
|
31
|
+
now?: Date;
|
|
32
|
+
}): Promise<SettlementResult>;
|
|
19
33
|
list(workflowId?: string): Promise<RunRecord[]>;
|
|
20
34
|
}
|
|
21
35
|
//# sourceMappingURL=in-memory-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-store.d.ts","sourceRoot":"","sources":["../../src/store/in-memory-store.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"in-memory-store.d.ts","sourceRoot":"","sources":["../../src/store/in-memory-store.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,gBAAgB,CAAC;AAExB,4FAA4F;AAC5F,qBAAa,aAAc,YAAW,QAAQ;IAC5C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAgC;IACrD,sGAAsG;IACtG,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAA6B;IAEtD,iGAAiG;IACjG,QAAQ,CAAC,cAAc,QAAQ;IAE/B;wGACoG;IACpG,QAAQ,CAAC,wBAAwB,EAAE,WAAW,CAAC,yBAAyB,CAAC,CAStE;IAEG,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,SAAS,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAmDhF,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAatC,MAAM,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IA6B7C,SAAS,CACb,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,kBAAkB,GAC7B,OAAO,CAAC,SAAS,CAAC;IA8DrB;;;;;;;;;;OAUG;IACG,UAAU,CACd,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,eAAe,EACtB,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,IAAI,CAAA;KAAE,GACvB,OAAO,CAAC,gBAAgB,CAAC;IAwBtB,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC;CAOtD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// InMemoryStore — in-memory implementation of RunStore for use in tests.
|
|
2
|
-
import { WorkflowError, findEligibleSteps, deriveRunPhase, decideIdempotencyPolicy, computeClaimDeadline, isStepSettledOrInFlight, } from '@sensigo/realm';
|
|
2
|
+
import { WorkflowError, findEligibleSteps, deriveRunPhase, decideIdempotencyPolicy, computeClaimDeadline, isStepSettledOrInFlight, applySettlement, } from '@sensigo/realm';
|
|
3
3
|
/** In-memory implementation of RunStore. Uses a Map keyed by run ID. No I/O, no locking. */
|
|
4
4
|
export class InMemoryStore {
|
|
5
5
|
runs = new Map();
|
|
@@ -15,6 +15,9 @@ export class InMemoryStore {
|
|
|
15
15
|
'extension_identity',
|
|
16
16
|
'validation_rejections',
|
|
17
17
|
'defaulted_steps',
|
|
18
|
+
// issue #279 (increment 1, PR-A): declared alongside settleStep — declaration-coherence.
|
|
19
|
+
'settled',
|
|
20
|
+
'finalizer_ledger',
|
|
18
21
|
]);
|
|
19
22
|
async create(options) {
|
|
20
23
|
// Idempotency: a key match applies the re-encounter policy, like JsonFileStore.
|
|
@@ -25,8 +28,10 @@ export class InMemoryStore {
|
|
|
25
28
|
const existing = this.runs.get(existingId);
|
|
26
29
|
if (existing !== undefined) {
|
|
27
30
|
// `reuse` → return the existing run; `supersede` → fall through to a fresh create
|
|
28
|
-
// (which overwrites the keyIndex entry below). `fail`/`reject` throw.
|
|
29
|
-
|
|
31
|
+
// (which overwrites the keyIndex entry below). `fail`/`reject` throw. Derives (issue
|
|
32
|
+
// #279, increment 2, PR-C — D-3 leg v), matching JsonFileStore's own call-site derive —
|
|
33
|
+
// decideIdempotencyPolicy's own exported `Pick<>` signature stays untouched.
|
|
34
|
+
if (decideIdempotencyPolicy({ ...existing, run_phase: deriveRunPhase(existing) }, options) === 'reuse') {
|
|
30
35
|
return { run: existing, created: false };
|
|
31
36
|
}
|
|
32
37
|
}
|
|
@@ -140,17 +145,59 @@ export class InMemoryStore {
|
|
|
140
145
|
// Per-claim liveness clock (issue #101) — mirrors JsonFileStore.claimStep: stamp claims[S]
|
|
141
146
|
// atomically with the in_progress add (OVERWRITE, so a missed settle-site delete self-heals).
|
|
142
147
|
const deadline = computeClaimDeadline(definition, stepName, new Date());
|
|
148
|
+
// issue #279 (increment 1, PR-A): mint an acquirer-minted fencing token alongside the
|
|
149
|
+
// deadline, in the SAME synchronous stretch — dormant until PR-B's settleStep migration.
|
|
150
|
+
const token = crypto.randomUUID();
|
|
151
|
+
// issue #279 (increment 2, PR-C — D-3 leg vii): derive instead of hardcoding 'running' —
|
|
152
|
+
// parity with JsonFileStore.claimStep, which derives off the PRE-claim `run` (claiming a step
|
|
153
|
+
// touches none of deriveRunPhase's own inputs, so `deriveRunPhase(run)` and
|
|
154
|
+
// `deriveRunPhase(updated)` are always identical; derived off `run` for consistency with that
|
|
155
|
+
// precedent, not because it matters here).
|
|
143
156
|
const updated = {
|
|
144
157
|
...run,
|
|
145
158
|
in_progress_steps: [...run.in_progress_steps, stepName],
|
|
146
|
-
claims: { ...run.claims, [stepName]: { deadline } },
|
|
147
|
-
run_phase:
|
|
159
|
+
claims: { ...run.claims, [stepName]: { deadline, token } },
|
|
160
|
+
run_phase: deriveRunPhase(run),
|
|
148
161
|
version: run.version + 1,
|
|
149
162
|
updated_at: new Date().toISOString(),
|
|
150
163
|
};
|
|
151
164
|
this.runs.set(updated.id, updated);
|
|
152
165
|
return updated;
|
|
153
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Atomically applies one `SettlementDelta` to this run's fresh state (issue #279, increment 1).
|
|
169
|
+
* DORMANT until PR-B — see `RunStore.settleStep`'s own JSDoc for the full contract.
|
|
170
|
+
*
|
|
171
|
+
* NO `await` between the read (`this.runs.get`) and the write (`this.runs.set`) — mirrors
|
|
172
|
+
* `claimStep`'s own documented no-await stretch above (issue #188's single-owner discipline):
|
|
173
|
+
* `applySettlement` is itself pure/synchronous, so calling it here does not introduce a
|
|
174
|
+
* microtask-yield point between the fresh read and the committing write. A behavioral overlap
|
|
175
|
+
* test (this package's own conformance suite) pins this directly: two disjoint concurrent
|
|
176
|
+
* settles via `Promise.all` both land, proving no interleaving window exists.
|
|
177
|
+
*/
|
|
178
|
+
async settleStep(runId, delta, definition, options) {
|
|
179
|
+
const fresh = this.runs.get(runId);
|
|
180
|
+
if (fresh === undefined) {
|
|
181
|
+
throw new WorkflowError(`Run '${runId}' not found`, {
|
|
182
|
+
code: 'STATE_RUN_NOT_FOUND',
|
|
183
|
+
category: 'STATE',
|
|
184
|
+
agentAction: 'report_to_user',
|
|
185
|
+
retryable: false,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
const outcome = applySettlement(fresh, delta, definition, options);
|
|
189
|
+
if (!outcome.applied) {
|
|
190
|
+
return outcome; // refusal/noop — fresh state, NO write (version unchanged)
|
|
191
|
+
}
|
|
192
|
+
const updated = {
|
|
193
|
+
...outcome.run,
|
|
194
|
+
run_phase: deriveRunPhase(outcome.run),
|
|
195
|
+
version: fresh.version + 1,
|
|
196
|
+
updated_at: new Date().toISOString(),
|
|
197
|
+
};
|
|
198
|
+
this.runs.set(updated.id, updated);
|
|
199
|
+
return { ...outcome, run: updated };
|
|
200
|
+
}
|
|
154
201
|
async list(workflowId) {
|
|
155
202
|
const all = [...this.runs.values()];
|
|
156
203
|
if (workflowId !== undefined) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"in-memory-store.js","sourceRoot":"","sources":["../../src/store/in-memory-store.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"in-memory-store.js","sourceRoot":"","sources":["../../src/store/in-memory-store.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,eAAe,GAQhB,MAAM,gBAAgB,CAAC;AAExB,4FAA4F;AAC5F,MAAM,OAAO,aAAa;IACP,IAAI,GAAG,IAAI,GAAG,EAAqB,CAAC;IACrD,sGAAsG;IACrF,QAAQ,GAAG,IAAI,GAAG,EAAkB,CAAC;IAEtD,iGAAiG;IACxF,cAAc,GAAG,IAAI,CAAC;IAE/B;wGACoG;IAC3F,wBAAwB,GAA2C,IAAI,GAAG,CAAC;QAClF,mBAAmB;QACnB,4BAA4B;QAC5B,oBAAoB;QACpB,uBAAuB;QACvB,iBAAiB;QACj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AAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACnC,OAAO,EAAE,GAAG,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IACtC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,UAAmB;QAC5B,MAAM,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;QACpC,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,KAAK,UAAU,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-store-fidelity-contract.d.ts","sourceRoot":"","sources":["../../src/store/run-store-fidelity-contract.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"run-store-fidelity-contract.d.ts","sourceRoot":"","sources":["../../src/store/run-store-fidelity-contract.ts"],"names":[],"mappings":"AAcA,OAAO,EAEL,KAAK,QAAQ,EAGb,KAAK,kBAAkB,EACxB,MAAM,gBAAgB,CAAC;AAExB,8FAA8F;AAC9F,MAAM,MAAM,mBAAmB,GAAG,kBAAkB,GAAG,oBAAoB,CAAC;AAE5E;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,mBAAmB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,MAAM,WAAW,+BAA+B;IAC9C,4BAA4B;IAC5B,KAAK,EAAE,QAAQ,CAAC;IAChB;;;;OAIG;IACH,UAAU,EAAE,kBAAkB,CAAC;IAC/B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAwDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,+BAA+B,GACvC,4BAA4B,EAAE,CAoEhC"}
|
|
@@ -18,6 +18,13 @@ import { WorkflowError, } from '@sensigo/realm';
|
|
|
18
18
|
* FIDELITY_HONESTY to actually exercise a round-trip. Deliberately real shapes (not `{}` or
|
|
19
19
|
* `null`), since a store that only round-trips empty/degenerate values would not actually prove
|
|
20
20
|
* fidelity for the shapes the engine truly writes.
|
|
21
|
+
*
|
|
22
|
+
* The type annotation is CLOSED over every key of `LoadBearingRunRecordField` — issue #279
|
|
23
|
+
* (increment 1) relies on this: widening that union to add `settled`/`finalizer_ledger` forced a
|
|
24
|
+
* compile error here until both got a sample value, which is deliberate (a store declaring
|
|
25
|
+
* `settleStep` gets these two FIDELITY_HONESTY cases automatically, everywhere
|
|
26
|
+
* `runStoreFidelityContract` already runs — including the byte-untouched CLI contract test file;
|
|
27
|
+
* see that file's own header for why it needs no edit).
|
|
21
28
|
*/
|
|
22
29
|
const SAMPLE_VALUES = {
|
|
23
30
|
capability_blocks: {
|
|
@@ -52,6 +59,10 @@ const SAMPLE_VALUES = {
|
|
|
52
59
|
],
|
|
53
60
|
validation_rejections: { 'tck-step': 3 },
|
|
54
61
|
defaulted_steps: ['tck-step'],
|
|
62
|
+
// issue #279 (increment 1): sample values for the two settlement fields — dormant data shapes
|
|
63
|
+
// (nothing writes these until PR-B), but real/valid ones per their own RunRecord doc.
|
|
64
|
+
settled: { 'tck-step': { token: 'tck-fidelity-token', outcome: 'complete' } },
|
|
65
|
+
finalizer_ledger: { 'tck-finalizer': { status: 'pending', rank: 0 } },
|
|
55
66
|
};
|
|
56
67
|
/**
|
|
57
68
|
* Builds the contract cases for `adapter`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-store-fidelity-contract.js","sourceRoot":"","sources":["../../src/store/run-store-fidelity-contract.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,kFAAkF;AAClF,EAAE;AACF,+FAA+F;AAC/F,8FAA8F;AAC9F,6FAA6F;AAC7F,kGAAkG;AAClG,aAAa;AACb,EAAE;AACF,6FAA6F;AAC7F,8FAA8F;AAC9F,kGAAkG;AAClG,+FAA+F;AAC/F,wFAAwF;AACxF,OAAO,EACL,aAAa,
|
|
1
|
+
{"version":3,"file":"run-store-fidelity-contract.js","sourceRoot":"","sources":["../../src/store/run-store-fidelity-contract.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,kFAAkF;AAClF,EAAE;AACF,+FAA+F;AAC/F,8FAA8F;AAC9F,6FAA6F;AAC7F,kGAAkG;AAClG,aAAa;AACb,EAAE;AACF,6FAA6F;AAC7F,8FAA8F;AAC9F,kGAAkG;AAClG,+FAA+F;AAC/F,wFAAwF;AACxF,OAAO,EACL,aAAa,GAKd,MAAM,gBAAgB,CAAC;AA6BxB;;;;;;;;;;;;GAYG;AACH,MAAM,aAAa,GAEf;IACF,iBAAiB,EAAE;QACjB,UAAU,EAAE;YACV,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE;YACrD,IAAI,EAAE,+BAA+B;YACrC,EAAE,EAAE,0BAA0B;SAC/B;KACF;IACD,0BAA0B,EAAE;QAC1B,SAAS,EAAE;YACT,WAAW,EAAE,gBAAgB;YAC7B,OAAO,EAAE,OAAO;YAChB,YAAY,EAAE,kEAAkE;YAChF,SAAS,EAAE,0BAA0B;SACtC;KACF;IACD,kBAAkB,EAAE;QAClB;YACE,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,EAAE;YACX,IAAI,EAAE;gBACJ,KAAK,EAAE,EAAE;gBACT,KAAK,EAAE,WAAW;gBAClB,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,CAAC;gBACd,SAAS,EAAE,kEAAkE;gBAC7E,SAAS,EAAE,KAAK;aACjB;YACD,QAAQ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CAAC,CAAC,EAA8B,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;YAC5F,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,KAAK,CACb,uFAAuF;oBACrF,gBAAgB,SAAS,CAAC,MAAM,oDAAoD;oBACpF,6FAA6F,CAChG,CAAC;YACJ,CAAC;YACD,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;gBACzB,MAAM,GAAG,GAAY,CAAC,CAAC,MAAM,CAAC;gBAC9B,IAAI,CAAC,CAAC,GAAG,YAAY,aAAa,CAAC,IAAI,GAAG,CAAC,IAAI,KAAK,4BAA4B,EAAE,CAAC;oBACjF,MAAM,SAAS,GAAG,GAAG,YAAY,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;oBACxE,MAAM,IAAI,KAAK,CACb,kFAAkF;wBAChF,oCAAoC,SAAS,EAAE,CAClD,CAAC;gBACJ,CAAC;YACH,CAAC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { type RunStore, type WorkflowDefinition, type StepDefinition } from '@sensigo/realm';
|
|
2
|
+
/** One of the PR-A-runnable settlement laws (design record §8, narrowed to the PR-A subset named
|
|
3
|
+
* in the hand-off prompt's D4 section — see this module's own header). */
|
|
4
|
+
export type SettlementLaw = 'FRESH_APPLICATION' | 'CONDITIONAL_NOOP' | 'CONDITIONAL_NOOP_GRANDFATHERED' | 'OWNERSHIP_REFUSAL' | 'LEDGER_MINT_ATOMICITY' | 'DRAIN_MARK_DEDUP' | 'TERMINAL_REFUSAL' | 'TERMINAL_STATE_ONLY' | 'CS_PURITY' | 'NEVER_DOWNGRADE' | 'SETTLE_OUTCOME_INTEGRITY' | 'SETTLED_ORPHAN_OVERWRITE' | 'TRANSFORM_FIDELITY' | 'RESULT_AS_APPLIED' | 'MARK_MEMBERSHIP' | 'REFUSAL_SWEEP' | 'MINT_FRESH' | 'SELF_IMAGE_IDEMPOTENCE' | 'TERMINAL_GATE_EXCLUSION' | 'COMPLETE_SEAL_PHASE' | 'WHEN_ROUTED_TERMINALIZATION' | 'G1_GATE_COEXISTENCE' | 'GATE_OPEN_IDEMPOTENT' | 'GATE_RESOLUTION_CONFLICT' | 'GATE_MISMATCH' | 'GUARD_OUTCOME_DIVERGENCE' | 'GUARD_WAITS_ON_OPEN_GATE' | 'GUARD_PASS_COMPLETE_OUTCOME' | 'GUARD_ABORT_CASCADE' | 'GUARD_NO_ENTRY' | 'RELEASE_IDEMPOTENT'
|
|
5
|
+
/** A NEW universal TCK law (lane-C steal 1 — the PG "generated columns cannot be written to
|
|
6
|
+
* directly" invariant, quantified): after EVERY store mutation op, persisted `run_phase ≡
|
|
7
|
+
* deriveRunPhase(record)`. */
|
|
8
|
+
| 'PHASE_IS_GENERATED'
|
|
9
|
+
/** Not a real settlement law — a wiring-gap sentinel (see `settlementContract`'s own doc: a
|
|
10
|
+
* store declaring `settleStep` with no `settlementFixture` supplied gets ONE failing case
|
|
11
|
+
* tagged with this, never a silent zero-cases pass). */
|
|
12
|
+
| 'ADAPTER_WIRING';
|
|
13
|
+
/**
|
|
14
|
+
* A single, framework-agnostic contract case. `run()` throws (rejects) on failure — any test
|
|
15
|
+
* framework's `await run()` (rejecting fails the test) or `expect(run()).resolves...` maps
|
|
16
|
+
* directly onto this.
|
|
17
|
+
*/
|
|
18
|
+
export interface SettlementContractCase {
|
|
19
|
+
law: SettlementLaw;
|
|
20
|
+
name: string;
|
|
21
|
+
run: () => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Definition-building hook a calling test file supplies so the store-exercising cases below never
|
|
25
|
+
* hand-roll their own `WorkflowDefinition`s inline — a concrete, named type (not a structural
|
|
26
|
+
* `Pick<>`/intersection), mirroring `runStoreFidelityContract`'s own adapter-supplied
|
|
27
|
+
* `definition`/`stepName` precedent, generalized to a factory since this TCK needs many distinct
|
|
28
|
+
* shapes (fan-out pairs, finalizer-bearing definitions, ranked finalizer pairs).
|
|
29
|
+
*/
|
|
30
|
+
export interface SettlementFixture {
|
|
31
|
+
/** A definition with the named agent steps, all immediately eligible (no `depends_on`). */
|
|
32
|
+
minimalDefinition(stepNames: string[]): WorkflowDefinition;
|
|
33
|
+
/** Adds one finalizer step (`execution: 'finalizer'`) to a definition built above. */
|
|
34
|
+
withFinalizer(def: WorkflowDefinition, finalizerName: string, onOutcome: NonNullable<StepDefinition['on_outcome']>): WorkflowDefinition;
|
|
35
|
+
/**
|
|
36
|
+
* Adds one guard step (issue #279, increment 2, PR-C — design record §8 fixture mechanics).
|
|
37
|
+
* OPTIONAL on this published interface (never a required-member widening): a store's own
|
|
38
|
+
* `SettlementFixture` that omits this triggers the `ADAPTER_WIRING`-style failing-case idiom
|
|
39
|
+
* for guard cases specifically, rather than a silent skip (see `guardOutcomeDivergenceCases`
|
|
40
|
+
* and friends, below). `opts.dependents` (optional) names steps that get `depends_on:
|
|
41
|
+
* [guardName]` — needed by `GUARD_ABORT_CASCADE`'s propagateSkips-cascade case.
|
|
42
|
+
*/
|
|
43
|
+
withGuard?(def: WorkflowDefinition, guardName: string, abortUnless: string | string[], opts?: {
|
|
44
|
+
dependents?: string[];
|
|
45
|
+
}): WorkflowDefinition;
|
|
46
|
+
}
|
|
47
|
+
/** Adapter a calling test file supplies to parameterize the contract against one concrete store. */
|
|
48
|
+
export interface SettlementContractAdapter {
|
|
49
|
+
/** The store under test. A store that does not declare `settleStep` gets zero cases (vacuous
|
|
50
|
+
* pass — mirrors the established optional-capability idiom, e.g.
|
|
51
|
+
* `runStoreFidelityContract`'s zero-cases-on-no-declaration). */
|
|
52
|
+
store: RunStore;
|
|
53
|
+
/** Descriptive label for case names (e.g. `'JsonFileStore'`, `'InMemoryStore'`). */
|
|
54
|
+
storeName: string;
|
|
55
|
+
/**
|
|
56
|
+
* Required for a store that DOES declare `settleStep` — the contract's own store-exercising
|
|
57
|
+
* cases are built from this. Omitting it (while the store declares `settleStep`) is a WIRING
|
|
58
|
+
* GAP, not a vacuous pass: `settlementContract` returns one explicit `ADAPTER_WIRING` failing
|
|
59
|
+
* case rather than silently skipping real conformance coverage. Both calling test files in this
|
|
60
|
+
* package pass `defaultSettlementFixture` (exported below) — a store needing bespoke definition
|
|
61
|
+
* shapes may supply its own.
|
|
62
|
+
*/
|
|
63
|
+
settlementFixture?: SettlementFixture;
|
|
64
|
+
}
|
|
65
|
+
/** Default settlement fixture — builds minimal agent-step / finalizer-step / guard-step
|
|
66
|
+
* definitions with no store-specific requirements beyond `RunStore.create` never validating
|
|
67
|
+
* `workflowId` against an external registry. Suitable for JsonFileStore and InMemoryStore; both
|
|
68
|
+
* this package's own conformance test files wire this in directly. */
|
|
69
|
+
export declare const defaultSettlementFixture: SettlementFixture;
|
|
70
|
+
/**
|
|
71
|
+
* Builds every PR-A-runnable settlement contract case for `adapter`.
|
|
72
|
+
*
|
|
73
|
+
* - `adapter.store.settleStep` undeclared ⇒ **zero cases** (vacuous pass — mirrors the
|
|
74
|
+
* established optional-capability idiom, e.g. `runStoreFidelityContract`'s own
|
|
75
|
+
* zero-cases-on-no-declaration precedent for a store that opts out entirely).
|
|
76
|
+
* - `settleStep` declared but `adapter.settlementFixture` absent ⇒ **one `ADAPTER_WIRING`
|
|
77
|
+
* failing case**, never a silent zero-cases pass — a store that opts INTO settlement
|
|
78
|
+
* conformance must not be able to pass this TCK by accident of an unwired adapter.
|
|
79
|
+
* - Both present ⇒ the full law set below.
|
|
80
|
+
*/
|
|
81
|
+
export declare function settlementContract(adapter: SettlementContractAdapter): SettlementContractCase[];
|
|
82
|
+
//# sourceMappingURL=settlement-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settlement-contract.d.ts","sourceRoot":"","sources":["../../src/store/settlement-contract.ts"],"names":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