@sensigo/realm-testing 0.25.0 → 0.27.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 CHANGED
@@ -1,6 +1,10 @@
1
1
  export { InMemoryStore } from './store/in-memory-store.js';
2
2
  export { perRunArtifactStoreContract } from './store/per-run-artifact-store-contract.js';
3
3
  export type { ArtifactStoreLaw, ArtifactStoreContractCase, PerRunArtifactStoreContractAdapter, } from './store/per-run-artifact-store-contract.js';
4
+ export { runStoreFidelityContract } from './store/run-store-fidelity-contract.js';
5
+ export type { RunStoreFidelityLaw, RunStoreFidelityContractCase, RunStoreFidelityContractAdapter, } from './store/run-store-fidelity-contract.js';
6
+ export { fencedTraceBufferContract } from './store/fenced-trace-buffer-contract.js';
7
+ export type { FencedTraceBufferLaw, FencedTraceBufferContractCase, FencedTraceBufferContractAdapter, } from './store/fenced-trace-buffer-contract.js';
4
8
  export { loadFixtureFromFile, loadFixtureFromString, loadFixturesFromDir, } from './fixtures/fixture-loader.js';
5
9
  export type { TestFixture, MockOperations } from './fixtures/fixture-loader.js';
6
10
  export { MockServiceRecorder } from './mocks/mock-service.js';
@@ -15,5 +19,5 @@ export { runFixtureTests } from './runner/test-runner.js';
15
19
  export type { TestResult, RunFixtureTestsOptions } from './runner/test-runner.js';
16
20
  export { startGitHubMockServer } from './servers/github-mock-server.js';
17
21
  export type { GitHubMockServerHandle } from './servers/github-mock-server.js';
18
- export declare const VERSION = "0.25.0";
22
+ export declare const VERSION = "0.27.0";
19
23
  //# sourceMappingURL=index.d.ts.map
@@ -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,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AmB,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;AAGjD,OAAO,EACL,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAGhF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAG3D,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAGlC,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,YAAY,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAE9E,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
  // Store
3
3
  export { InMemoryStore } from './store/in-memory-store.js';
4
4
  export { perRunArtifactStoreContract } from './store/per-run-artifact-store-contract.js';
5
+ export { runStoreFidelityContract } from './store/run-store-fidelity-contract.js';
6
+ export { fencedTraceBufferContract } from './store/fenced-trace-buffer-contract.js';
5
7
  // Fixtures
6
8
  export { loadFixtureFromFile, loadFixtureFromString, loadFixturesFromDir, } from './fixtures/fixture-loader.js';
7
9
  // Mocks
@@ -18,5 +20,5 @@ export { testAdapter } from './helpers/test-adapter.js';
18
20
  export { runFixtureTests } from './runner/test-runner.js';
19
21
  // Servers
20
22
  export { startGitHubMockServer } from './servers/github-mock-server.js';
21
- export const VERSION = '0.25.0';
23
+ export const VERSION = '0.27.0';
22
24
  //# 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;AAOzF,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
+ {"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;AAOpF,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"}
@@ -0,0 +1,87 @@
1
+ import { type TraceBufferStore } from '@sensigo/realm';
2
+ /**
3
+ * One of the laws every fenced-trio-declaring `TraceBufferStore` must satisfy. The original five
4
+ * (issue #207) cover the fenced trio itself; the remaining five (issue #197 PR-1) cover the
5
+ * optional capability-ladder rungs a trio-declaring store MAY additionally declare (`seal` and
6
+ * `writer_nonce_carriage`) — each of those five produces an explicit, VISIBLE documented-skip case
7
+ * (never a silent omission) for a store that does not declare the relevant rung, mirroring the
8
+ * `fenceForm: 'native-predicate'` skip precedent already established for the latch-based trio
9
+ * laws below.
10
+ */
11
+ export type FencedTraceBufferLaw = 'STRUCTURAL' | 'FENCE_REFUSES' | 'CS_OCCUPANCY' | 'PER_KEY_INDEPENDENCE' | 'NO_SILENT_LOSS' | 'CARRIAGE_ROUND_TRIP' | 'SEAL' | 'SEAL_BUDGET' | 'PER_WRITER_BUDGET' | 'VERBATIM';
12
+ /**
13
+ * A single, framework-agnostic contract case. `run()` throws (rejects) on failure — any test
14
+ * framework's `await run()` (rejecting fails the test) or `expect(run()).resolves...` /
15
+ * `expect(run()).rejects...` maps directly onto this.
16
+ */
17
+ export interface FencedTraceBufferContractCase {
18
+ law: FencedTraceBufferLaw;
19
+ name: string;
20
+ run: () => Promise<void>;
21
+ }
22
+ /** Adapter a calling test file supplies to parameterize the contract against one concrete store. */
23
+ export interface FencedTraceBufferContractAdapter {
24
+ /** The store under test — already declaring the fenced trio (`appendFenced`/`deleteFenced`/
25
+ * `deleteAllForRunFenced`). For `fenceForm: 'guard-in-cs'` stores, this instance should already
26
+ * be constructed with a sufficiently generous lock-acquisition profile (see `lockProfile`
27
+ * below) so a deliberately-parked guard in the latch-based laws doesn't cause a concurrent
28
+ * caller's own acquisition attempt to give up before the law's observation window completes. */
29
+ store: TraceBufferStore;
30
+ /** Returns a fresh, never-before-used (runId, stepId) pair for one case — callers should treat
31
+ * every returned pair as belonging to a disjoint run from every other pair this returns. */
32
+ makeKey: () => {
33
+ runId: string;
34
+ stepId: string;
35
+ };
36
+ /**
37
+ * `'guard-in-cs'`: the store enforces the fence via an in-process critical section — the guard
38
+ * literally runs inside the same lock/mutex the destructive effect does. `'native-predicate'`:
39
+ * the store enforces the fence via a transaction-scoped SQL predicate instead (e.g. a future
40
+ * Postgres store) — the latch-based laws (`CS_OCCUPANCY`, `PER_KEY_INDEPENDENCE`,
41
+ * `NO_SILENT_LOSS`) do not apply to this fence form and produce an explicit, VISIBLE
42
+ * documented-skip case rather than a silent omission. **A green TCK run does NOT verify race
43
+ * closure for a native-predicate store** — that store's own in-transaction fencing suite must
44
+ * (the same posture `RunStore.claimStep`'s cross-host obligation already states for
45
+ * `CLAIM_SINGLE_OWNER`, issue #188).
46
+ */
47
+ fenceForm: 'guard-in-cs' | 'native-predicate';
48
+ /** Descriptive only (present for `'guard-in-cs'` adapters): the lock-acquisition profile the
49
+ * `store` instance above was actually constructed with, for the calling test file's own
50
+ * documentation — the TCK itself does not need to act on this value; it exists so a wiring
51
+ * test can assert (and a reader can see) that a genuinely generous profile is in use. */
52
+ lockProfile?: unknown;
53
+ /**
54
+ * Per-adapter byte oracle for `PER_WRITER_BUDGET` (issue #197 PR-1) — since the in-memory and fs
55
+ * stores compute "bytes" via genuinely different formulas (whole-array restringify vs
56
+ * JSONL-additive), this TCK can only assert exact ENTRY COUNTS store-agnostically; exact BYTE
57
+ * equality needs each adapter to supply its own oracle, computed however that concrete store's
58
+ * own `AppendResult.buffer_bytes`/`file_bytes` are actually derived. Optional — a store without
59
+ * this hook still runs every count-based `PER_WRITER_BUDGET` assertion; only the byte-exactness
60
+ * sub-assertion is skipped (visibly, never silently) for that adapter.
61
+ */
62
+ bytesOracle?: (runId: string, stepId: string, writerNonce: string | undefined) => Promise<{
63
+ count: number;
64
+ bytes: number;
65
+ }>;
66
+ /**
67
+ * fs-scoped raw on-disk byte access for `VERBATIM` (issue #197 PR-1) — reads the RAW bytes of a
68
+ * live WAL path and of one sealed artifact (`seq`), so the law can assert a seal moves bytes
69
+ * byte-for-byte (no parse/re-copy/truncation/dedup). `undefined` from either function means "no
70
+ * file at that path" (mirrors `readIfExists`'s absence convention). Optional — a store without
71
+ * this hook (e.g. the in-memory store, which has no on-disk representation at all) skips ONLY
72
+ * the raw-byte-exactness case; the shape-tolerant sibling case still runs unconditionally for
73
+ * every `seal`-declaring store.
74
+ */
75
+ rawWalAccess?: {
76
+ readLiveRaw: (runId: string, stepId: string) => Promise<string | undefined>;
77
+ readSealedRaw: (runId: string, stepId: string, seq: number) => Promise<string | undefined>;
78
+ };
79
+ }
80
+ /**
81
+ * Builds the contract cases for `adapter`. See each law's own doc above (the `build*Case`
82
+ * functions) for what it asserts. For `fenceForm: 'native-predicate'` adapters, `CS_OCCUPANCY`,
83
+ * `PER_KEY_INDEPENDENCE`, and `NO_SILENT_LOSS` are replaced with an explicit, VISIBLE
84
+ * documented-skip case each (never a silent omission) — see the adapter's own `fenceForm` doc.
85
+ */
86
+ export declare function fencedTraceBufferContract(adapter: FencedTraceBufferContractAdapter): FencedTraceBufferContractCase[];
87
+ //# sourceMappingURL=fenced-trace-buffer-contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fenced-trace-buffer-contract.d.ts","sourceRoot":"","sources":["../../src/store/fenced-trace-buffer-contract.ts"],"names":[],"mappings":"AAcA,OAAO,EAGL,KAAK,gBAAgB,EAStB,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,MAAM,oBAAoB,GAC5B,YAAY,GACZ,eAAe,GACf,cAAc,GACd,sBAAsB,GACtB,gBAAgB,GAChB,qBAAqB,GACrB,MAAM,GACN,aAAa,GACb,mBAAmB,GACnB,UAAU,CAAC;AAEf;;;;GAIG;AACH,MAAM,WAAW,6BAA6B;IAC5C,GAAG,EAAE,oBAAoB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,oGAAoG;AACpG,MAAM,WAAW,gCAAgC;IAC/C;;;;qGAIiG;IACjG,KAAK,EAAE,gBAAgB,CAAC;IACxB;iGAC6F;IAC7F,OAAO,EAAE,M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