Skip to main content
A version identifies the data cut of a commit. A pin keeps the cut within each table’s history. Reads still apply current access and erasure closures.

Read at a version

ctx.frame.version is the version a transaction reads. Store it, or a mutation’s commit version from its client Result, in a t.version field. Read at it later:
A client reads a whole call at a version with client.in(version), and ctx.call(query, args, { in: version }) runs a query there. A read at a version no longer kept refuses Expired. A nested query at a narrower label can read a Root cut visible to its caller. Inside that query, ctx.frame.version names the last commit visible at the query’s own label at that cut. .in(world) chooses the world (system time). .at(instant) and .over({ from, to }) choose the valid instant or interval of a series or timeline. They combine: certifications(supplier).at(effectiveAt).in(version) is the certificate in force at effectiveAt, as the world held it at version.

Keep a version

  • A table’s pin: { field, lifetime, quota } option keeps the version (or branch) a fact’s field names readable for lifetime from the version’s commit (or the branch’s parent commit). The supplier example pins each decision’s version for 30 days.
  • ctx.pin(version, { until }) keeps one version readable until an instant, and ctx.unpin(pin) lets it go. Both are grave acts. The version also keeps the Program installed there.

Compare two versions

Run the same reads at both and compare in code. A change log gives the facts that changed between them: table.changes.since(version) lists every change after version, each { key, before, after, version }, and a point’s orders(id).changes its own. A page of the log reports gone once history no longer holds it.

Replay a function

A query can call another query at another version of the code and the data:
The supplier example replays each affected approval this way: the original program over the original data, then over the corrected data. Both are queries, so the original record stays intact. Replay follows the caller’s current access and the history still kept.

Replay the exact code

To run the code that made a decision, record its version and keep that version within retention. A branch can also supply the code installed there.
A query can read through its tables’ forward history lenses. It refuses Expired with reason SchemaChanged when a table’s data is in a later schema generation than its code can read. A version beyond retention refuses Expired with reason BeyondHistory. The decisions helpers of @bijectionhq/library-decisions keep the original Program, version and result digest with the decision. Declare query({ replays: kept.replays }) and give every table the query reaches that much history. Deploy checks the read and call sites and refuses ReplayHistory when the required history is missing. kept.replay(ctx, decide, decision) runs at the original version under current admission and custody. kept.reevaluate(ctx, decide, decision, through) compares against an explicit world under the identity migration. The compared world must have the same Program and table generations. touches and branch impact use this same comparison.