@jam-overture/ loom/ testing/ contracts
The suites that tell you whether your own store, hold store or journal keeps its promises.
Everything below is exported from that import. The names, the signatures and the sentences are read from the package itself rather than written here, so this page says what the copy of Loom in your node_modules says — and it changes in the same pull request the code does.
17 exports, in 5 modules. Generated from ./dist/testing/contracts.d.ts, which is the declaration file this package publishes for @jam-overture/loom/testing/contracts.
Install these first. @jam-overture/loom/testing/contracts loads them the moment the import runs. Without them, the import itself fails — before any of your own code has run.
drizzle-orm^0.45.2optional peer dependencyvitest^3.0.5optional peer dependency
pnpm add drizzle-orm vitest
No import here has everything behind it. @jam-overture/loom/testing/contracts publishes 17 of the 1,298 names this package publishes. The other 1,281 are behind one of the 16 other imports, and not one of those imports publishes a single name this one does. The imports do not nest: a name that is not on this page is not a name that does not exist, and the search at the top of the page says which import it comes from.
Hold contract
testing/hold-contract
One suite, run against every HoldStore.
heldProposalFixturefunction
A hold against a real tree.
const heldProposalFixture: (options?: {
readonly heldAt?: string;
readonly treeId?: TreeId;
readonly actor?: string;
readonly policyFingerprint?: string;
}) => HeldProposaldescribeHoldStoreContractfunction
const describeHoldStoreContract: (name: string, makeStore: () => HoldStore | Promise<HoldStore>) => void
Journal contract
testing/journal-contract
One suite, run against every TelemetryJournal.
sampleEpisodefunction
A whole episode, narrated: an intent, the proposal it produced, the Gate accepting it, and the change landing. Built through recordOf rather than by hand so the suite exercises the narrowing every host will use.
const sampleEpisode: (namespace?: string) => readonly TelemetryRecord[]
describeTelemetryJournalContractfunction
const describeTelemetryJournalContract: (name: string, makeJournal: () => Promise<TelemetryJournal> | TelemetryJournal) => void
Model contract
testing/model-contract
One suite, run against every ModelClient.
ModelSituationtype
What happened, in terms every vendor has rather than one vendor's.
type ModelSituation = /** The service answered, with this text, served by this model. */ "answers" /** The service answered, and there was nothing in the reply that was text. */ | "answers-without-text" /** The answer stopped at the output ceiling, mid-sentence. */ | "truncates" /** The model declined to answer this content. */ | "refuses" /** A credential, entitlement or billing problem: 401, 402, 403. */ | "refuses-the-caller" /** The request itself is wrong and would fail again unchanged: 400, 404, 413, 422. */ | "refuses-the-request" /** Busy now, fine later: 408, 409, 429, 500, 503. */ | "asks-for-later" /** No response at all — a closed socket, a DNS failure, a TLS error. */ | "never-answers";
MODEL_SITUATIONSvalue
const MODEL_SITUATIONS: readonly ModelSituation[]
CONTRACT_REPLYvalue
The text this suite sends through, and the model it says served it.
const CONTRACT_REPLY: string
CONTRACT_SERVED_BYvalue
const CONTRACT_SERVED_BY = "a-model-that-served-it"
ModelSituationClienttype
A client wired to behave as one situation does, or a statement that this vendor has no such situation.
type ModelSituationClient = (() => ModelClient | Promise<ModelClient>) | "not-expressible";
ModelClientContracttype
type ModelClientContract = Readonly<Record<ModelSituation, ModelSituationClient>>;
contractRequestfunction
The request every case sends. Fixed, because none of these turn on its content.
const contractRequest: () => ModelRequest
describeModelClientContractfunction
const describeModelClientContract: (name: string, contract: ModelClientContract) => void
Row security
testing/row-security
Asking Postgres whether a table really is protected.
rowSecurityOnfunction
Whether Postgres has row level security on a table, read from the catalogue rather than inferred from having run the statement.
const rowSecurityOn: (db: LoomDatabase, table: string) => Promise<boolean>
Store contract
testing/store-contract
One suite, run against every TreeStore.
appendOffunction
const appendOf: (delta: TreeDelta, proposal?: string) => AppendRequest
removalOffunction
const removalOf: (tree: LoomTree, nodeId: string, baseRevision?: number) => TreeDelta
treeNamedfunction
const treeNamed: (namespace: string) => LoomTree
describeTreeStoreContractfunction
makeStore returns a store with nothing in it. Each test gets its own, so the suite never depends on the order it runs in.
const describeTreeStoreContract: (name: string, makeStore: () => Promise<TreeStore> | TreeStore) => void