Skip to content
Like what we’re building? Star on GitHub

Exact birth policy ​

Which data format and protocol a new run is born with, and who decides it. The lane that qualifies the iterion_exact build is the qualification lane; a birth's identity and publication are in run birth.

ADR-181 D2, D4 and D5a (pkg/store/birth_policy.go). store.BirthPolicyOf is token ∧ ledger state ∧ platform capability, read inside each birth's lock or transaction, never at store.New, store.Open or mongo.New. Its zero value births legacy (format 1 × protocol 0); exact is Exact × Incarnation (format 2 × protocol 1), never format 2 × protocol 0.

Ledger statePolicy
absentlegacy (the genesis row is P15a's)
censused, applying, unknownevery birth refused, ErrBirthRefused
appliedexact with the token and the platform, refused otherwise
  • Token: exact-births/1 from store.CapabilityTokens (no build) or the test grant storetest.GrantExactBirths(t). The grant is tag-only, refused outside a test binary, revoked in t.Cleanup and process-wide: a granted test is not parallel.
  • Ledger state: no store records the step before P15, so every store reads absent. Under the tag, storetest.SetExactBirthsLedger(t, s, state) sets the state of one handle.
  • Platform: atomic no-replace publication on FS (Linux, macOS); a blob store with exact-format artifacts on Mongo.

The creation boundary. store.ResolveBirth is the seam of every spec birth: FS newRunFromSpec, under the store lock in CreateRunWithValueFormat and under the per-ID reservation in a reserved Publish, and Mongo CreateRunWithValueFormat inside its transaction, which runBirth.Publish reuses and which reads the primary. It reads the policy and the parent and returns the binding the store mints. A whole-document birth (the SaveRun create branch, SaveParkedLaunchRun) calls store.RequireLegacyBirth; a stale save of a missing run is a conflict, not a birth. TestEveryBirthPathConsultsThePolicy parses the module, every build tag included, and holds its creation paths to the inventory birthPaths both ways, each down to a consult. A creation path is a declaration named as one, or one that writes a run document through a birth primitive: the FS exclusive create, a file write naming run.json, a rename or link onto it or onto the run directory, an insert or an upsert on the Mongo runs collection. Three primitive holders that birth no run are exempt by name. It reads syntax: a path held in a variable, an upsert option or insert model built in another declaration, and a write through a helper it does not name escape it.

Open windows. D2 reads the policy inside the birth's lock or transaction. Two births read it outside the lock their write holds: a reserved FS Publish, before it takes the store lock, and Mongo saveRun, before its insert-only upsert, in no transaction. The FS store lock is in-process. A ledger transition between the read and the write is therefore not excluded. Outside a tagged test every store reads the ledger absent before P15, so neither window opens; they are P15a's to close, the unit that gives the ledger its states.

Two kinds of birth. store.NewRunInvocation leaves the binding to the store. Its caller sets neither format nor protocol; a child's context carries its parent's binding, and the child shares the parent's format, protocol and observed birth (D4) or is refused. An explicit binding (the legacy creators, NewLegacyRunInvocation, the value-format suites) is honoured while the store births legacy; once it births exact, only Exact × Incarnation is born. The CreateRunWithValueFormat fallback for a store without RunValueFormatCreator births protocol 0 only and refuses any other protocol with ErrRunDataCapability.