Open a branch
ctx.branch({ from?, until, upTo? }) is a grave act in a
mutation at the head. It begins a writable world over from (the head when
omitted), ends it at until, and fixes its label span [L_W, U] where L_W
is the creating frame’s under and U = upTo ?? L_W (L_W ⊑ U). Every call
staged in the branch must commit within [L_W, U] (BranchLabelSpan
otherwise, refused immediately at call time). Omitting under fixes U = L_W
for single-label branches, which land with zero release. It returns the
Branch, a t.branch value you can store.
bijection/adjustments.ts
pin option keeps the branch a fact names readable for lifetime after
each write of the fact, at most quota live pins. sys.branches(branch) reads
the branch’s facts: { id, from, until }.
Call functions in the branch
A client selects the branch withclient.in(branch). Every call through that
client reads and writes the branch, with the branch’s program and the
caller’s own grants. A branch’s program is fixed when it is created: the
candidate deployed into it, or else the code the deployment had installed at
that moment. A deploy at the head never changes the code a branch runs.
A branch lands by validation: a call whose reads still hold at the head
lands the writes it made in the branch, and any other call runs again at the
head. The program a call ran under is one of its reads, so after any deploy
at the head since the branch was created every call runs again under the
head’s code. A call whose function changed its arguments or result since
then refuses the land with ProgramContractChanged.
<Bijection client={client.in(branch)}> around the part of the
page that works in the branch.
Inside a function:
ctx.frame.inis theBranch, ornullat the head;- an address reads another world with
.in(branch):ctx.get(invoices(id).in(branch)); ctx.call(query, args, { in: branch })runs a query in another world.
Deploy a candidate program into a branch
bijection deploy --branch <branch> prepares the program in your workspace as
a deploy does, then installs it into the open branch as the branch’s
candidate program instead of activating it at head. It works the same on a
self-hosted and a managed hosted deployment: a branch deploy creates no
release and leaves the release track as it is. The deploy key’s principal
needs deployment authority.
- Every call in the branch runs the candidate: its functions, tables, guards and code. A head redeploy does not change what the branch runs.
- A table whose layout the candidate changes is migrated in the branch, as a
deploy at head migrates it: its facts, a timeline’s whole valid-time
history, its legal holds, and its sealed columns re-sealed under their
labels (a value whose erasure unit is erased stays erased) all move to the
candidate’s layout, and an aggregate the candidate adds or redefines is
counted anew. The deploy is refused with
DeclarationBreaksFactswhen facts break the new declaration, and withDeclarationNeedsMigrationwhen a non-empty table would change its valid-time kind or store a sealed column unsealed. - A role the candidate drops is revoked when it lands: every grant naming it
ends, each revocation is recorded in
sys.grantTransitions, and, like any revocation, it holds before the land answers, so no later restore brings the grant back. - The deploy moves the branch’s version, so a review of an earlier version no longer lands. Approve the new version.
- Landing installs the candidate at head in the landing’s one append, with
the replayed calls and the head migration. It is refused with
LandConsentwhen the lander holds no deployment authority, and withLandSchemawhen the candidate’s tables don’t admit head’s facts.
What a branch does not do
- Performers act only at the head. A task submitted in a branch is recorded there, and landing submits it at the head.
- A branch grants nothing: every call in it is admitted as at the head.
- Each write in the branch moves its version. A review is of one version,
seen;ctx.landrefusesConflictif the branch already moved past it, and the landing settlesConflictif it moves before it lands.
End a branch
ctx.land(branch, { seen, then?, within?, release? }) applies it atomically to
the head in one store append under ctx.frame.under ⊒ U (LandClearance
otherwise); name release (listed in releases:) whenever any written place
lies below or incomparable with ctx.frame.under; see
the branch workflow.
ctx.discard(branch) ends it without landing. A branch nobody keeps ends at
its until.
A landed branch is done for everyone who can see the landing: a frame whose
ctx.frame.under clears the branch’s under ceiling can no longer call into
it, land it again or hold it in a pin field (WorldUnavailable).
When the landing also writes at the branch’s own label (the lander is at that
label, or the landing’s release covers it), the branch ends there too, in
the landing’s append. Otherwise frames at the branch’s own label still see it
open until it ends, since anything else would tell them about a landing they
cannot see; their calls in it can never land. A fact of the landed branch’s
own calls that clears or deletes a pin field holding the branch releases it
when the branch lands, so that holder no longer keeps it alive.