Skip to content

Change-Set Document

llms.txt lists every page for an agent

A run that plans several members gets one change set (#3181). Each planner’s output becomes the same typed document. That covers chant’s lifecycle plan and the terraform, tofu and choudoufu plans, along with a warden’s reconcile plan. It also covers SQL plans, which are a product’s versioned migrations and the sql lexicon’s migration Ops. A reader asks one question of all of them, and the run’s gate approves the document as a whole.

The document is part of the workspace read contract, version 1. Its schema ships in @intentius/chant at src/workspace/change-set.schema.json, exported as @intentius/chant/workspace/change-set.schema.json, with the $id https://intentius.io/chant/schemas/workspace/change-set/v1/change-set.schema.json. Within the version, fields are only added.

FieldHolds
$schemathe schema’s $id
contract1
chantthe chant that composed it, when known
digestwhat a gate over the whole run binds, described below
membersone per member, sorted by name
entriesone per resource change, sorted by member, address, deposed key and action
sideEffectsthe Terraform actions an apply runs, { member, address, type, trigger, event }; absent when none
summarycounts and the named deletes and replacements
graphon a stored change set, the graph the entries’ node ids come from: { member, at }, or null when none could be read
releaseDigest, environmenton a release gate’s change set, the release and the environment it was planned for (#4045); absent on every other
FieldHolds
memberthe workspace member, or the root a choudoufu set plan names
lexiconthe lexicon its entries belong to
plannerterraform, tofu, choudoufu, chant, warden, sql or pulumi
scopethe estate, environment or org it plans into
statusplanned, or failed with error
planDigestwhat a gate on this member alone binds, or null when it failed
nativeDigestthe planner’s own hash of the same plan, such as choudoufu’s per-root value
holeswhat the planner could not read, each { address, type, reason }
provisionaltrue for a preview planned before what it reads applied, such as a Terragrunt dependent planned on mock_outputs; absent otherwise
placeholdersthe inputs a Terraform root was previewed with stand-in values for, as var.<name>, sorted (#4463); every attribute they drive is marked unknown in its entries. Absent otherwise. Written by chant 0.124.54 and newer
groupon a member a capability planned with others as one group (ws-107): { digest, reads }, the group digest folded into planDigest and the <component>.<output> values it reads from the group that the plan does not know. Part of the digest when present. Written by chant 0.124.54 and newer
outputsthe outputs the member’s plan changes, by name, sorted (#4849). A member with any is a change even when every entry is a no-op, so the change set is not empty. Its planDigest covers them, so they are not hashed again. Absent when none changes. Written by chant 0.124.79 and newer

A member with holes has an incomplete plan. Its entries say nothing about the addresses listed there.

A provisional member is left out of the document’s digest, so approving the document never approves it. A wave’s set digest refuses it, and the grouped summary never puts it in a group with real plans.

A change set in which any member has group.reads is never treated as empty, so a gate that passes an empty change set without an approval still waits for one.

FieldHolds
member, lexicon, planneras on the member
addressthe planner’s address. With deposed, it is unique within the member
typethe resource type
name, index, modulethe parts of a terraform address, so a reader need not parse it
deposeda deposed object’s key
idthe provider’s id, when the planner reports one
actioncreate, update, replace, delete, read, no-op or forget
importingtrue when an import block also brings the object into state; action is what else the plan does to it
disruptionon update, replace and delete: in-place, rolling, replace, destroy or unknown
region, scopewhere the change lands
attributesthe top-level attributes the change writes
nodeon a stored change set, the graph node the change is made to, or null when the graph has none for the address. An instance of a count or for_each block gets its instance node, <block node>[0] (#4454)
instanceOfon a stored change set, when node is an instance node: the block node it is an instance of, which is the rollup
mayAppeartrue when the planner could not enumerate what the entry stands for: a Pulumi resource registered inside an apply() that preview could not run. See Pulumi plans. Part of the digest, and a change set with one is never empty

Each attribute is { path, before, after }. unknown: true replaces after when the value is known only after apply. sensitive: true replaces both values when the planner marked either side sensitive. forcesReplacement: true marks the attributes that force a replace. Redaction follows the planner’s marks. A value the planner leaves unmarked is carried as the plan JSON carries it.

FieldHolds
members, entriesthe counts
actionsevery action with its count, zero included
typesper resource type, the count of each action it has
byMemberper member, the count of each action it has
deletes, replacementsevery delete and every replace, each { member, address, type, deposed, disruption }
failedthe members that failed to plan
holesthe number of holes across members

A reviewer reads a large document through chant change-set summary, which groups the members that take the same change and names every destroy.

Each member carries the value a gate on that member alone binds (#2300).

PlannerMember planDigest
terraform, tofu, choudoufuterraformPlanDigest over the show -json plan, as TerraformApplyOp binds. A value the plan marks in after_unknown is left out of after, and the mark stays in
chantcomputePlanDigest("lifecycle-plan", plan) over the lifecycle plan --json document
wardencomputePlanDigest("reconcile-plan", …) over each change set’s org and entries, sorted
sql, versioned planthe product’s own gate digest when the plan carries digest (SQL Yodeler’s), else computePlanDigest("sql-versioned-plan", …) over the dialect, environment and pending steps
sql, migration Opthe Op’s plan step planDigest, taken before the verification (not the swap or switch gate’s value); a swapped or finished Op gets computePlanDigest("sql-op-plan", …) over its state
chant, a component with no step that has plancomponentPlanDigest over the environment, the composition and its vars, plus inputs, the content digest of each local file its steps deploy from (#4155), when any exists
pulumicomputePlanDigest("pulumi-preview", …) over each step’s op, URN, provider, id, inputs before and after, diffReasons, replaceReasons and detailedDiff, sorted by URN and op. An input the engine made up while planning a create or a replacement, such as an autoname (events-3f45941), reads as a fixed marker, so two previews of one create agree. Every other input is kept (plywood#56)
chant, <component>#inputscomputePlanDigest("component-inputs", …) over the environment, the component and the content digests of the files its steps without plan deploy from
any, a member of a groupcomputePlanDigest("capability-group-member", { plan, group }) over the member’s own digest and the group digest, which is computePlanDigest("capability-group", { kind, members, composition }) over the capability’s kind, each member’s component, member and own digest, and the capability’s digest of the composition

A component member’s holes include each step whose content the digest can’t name, with a reason that starts unbound:. Plan previews lists the fields read.

A capability also answers resourceDigests: the digest of each resource its plan changes, by URN on Pulumi and plunge (pulumiResourceDigests) and by address on tofu and terraform (terraformResourceDigests). A same, read or no-op resource is not in it. They are not part of any digest above. approvals.preview compares them resource by resource (plywood#55).

The set digest is computePlanDigest("change-set", pairs), where pairs is { member, planDigest } for every member that is not provisional, sorted by member. changeSetDigest(members) computes it. A wave of gated waves is a subset of members, and the wave’s gate value is the set digest over that subset.

The document’s digest is computePlanDigest("change-set-document", { set, members, entries, sideEffects }), with planned: { releaseDigest, environment } added for a release gate’s document. It covers the set digest and the entries and side effects, leaving out each entry’s node. For each member it also covers the member name, status and holes, and group when the member has one. Provisional members and their entries are left out. changeSetDocumentDigest(doc) computes it. Members are sorted by name, each member’s holes by address, type and reason, and entries and side effects as the document sorts them, so order makes no difference. Earlier chant releases hashed holes in the order the document lists them, and verifyChangeSetDigest accepts a stored document’s digest in that form too. The digest has the jcs1-sha256 prefix plans carry since #2547. It changes when any member’s planDigest changes. A changed entry, hole or side effect changes it too. A set that names a member twice is refused. A release gate’s document hashes the release and the environment it was planned for, so two releases whose plans read the same still have two digests, and an approval of one is never an approval of the other. A document without them hashes as before.

An approval of the document therefore binds what the document says about each plan, so a resumed pull-request apply checks a re-planned member against entries the approval covers (#3555). The summary is computed from the entries and is not hashed. A change to how chant projects a plan into entries moves the digest, so an approval given under one chant release can need giving again under the next. verifyChangeSetDigest(doc) recomputes the value from the document.

A gate that binds the document’s digest stores the document on chant/lifecycle at _change-sets/<digest>.json (#4022). chant components pr-apply stores it before deciding the pull request’s gate, and chant components promote --release stores its release gate’s before deciding that gate (#4045). Before storing, chant maps each entry onto the member’s graph and sets node to the id chant workspace graph gives the node, <member>/<id> in a workspace. node and graph are left out of the digest, so the stored document verifies against the value its gate bound. chant change-set show reads it back, and the read contract gives the mapping rules.

PlannerAdapterReads
terraform, tofu, choudoufuterraformChangeSetPart in @intentius/chant-lexicon-terraform/change-setshow -json of a saved plan
choudoufu set planchoudoufuSetPlanParts in the same modulechoudoufu live-plan-set -json, one part per root
chantlifecyclePlanPart in @intentius/chant/change-setchant lifecycle plan <env> --json
wardenreconcilePlanPart in the same modulethe reconcile ChangeSet from @intentius/chant/reconcile, or an array of them; github-warden reconcile --plan-json <file> writes that array
sql, versioned plansqlVersionedPlanPart in @intentius/chant-lexicon-sql/change-seta versioned plan, below; SQL Yodeler’s VersionedPlan as it stands
sql, ClickHouseRebuildOpclickhouseRebuildPart in the same moduleclickhouseRebuildPlan’s result; the step also returns the part as part
sql, PostgresMigrationOppostgresMigrationPart in the same modulepostgresMigrationPlan’s result; the step also returns the part as part
pulumipulumiPreviewPart in @intentius/chant-lexicon-pulumi/change-set; previewPulumiMember in @intentius/chant-lexicon-pulumi/run runs the previewpulumi preview --json, with the member’s checked-in pulumi stack export as the last deployment
any part written as JSONreadChangeSetPartFile in @intentius/chant/change-seta part another process wrote; readChangeSetPart with planner: "sql" or "pulumi" uses it

Each adapter returns a part: { member, entries }. composeChangeSet(parts) joins them. It refuses two parts for one member.

The chant adapter maps create, update, delete and noop across. An update whose lexicon classifies it replace or destroy becomes a replace. An effect entry becomes the receipt write its effect step makes: a create when the receipt is absent, else an update. An unobserved entry becomes a hole. adopt and runtime entries propose nothing and are left out.

For a warden plan, each entry’s address is the one the warden set on it, or <resourceType>.<key> when it set none. A warden whose kind draws a graph sets its graph node id, repo/<org>/<name>, on a change to that node, and <node id>#<resourceType>[<key>] on a change under it, such as a repo’s secret (#5089). Such an entry sits on that node, the same node as the member’s drift records, and two orgs with a repo of the same name keep apart. Without that address, a warden entry lands on no node.

The pulumi adapter (#4453) keeps one entry per URN, at the URN. A replace is one replace entry, with disruption destroy when the delete comes first. The recorded previews print a replace as one replace step; the adapter also folds create-replacement and delete-replaced steps on the same URN into that entry, should a preview print them. The other ops map as follows, and an op outside this table is a hole.

Pulumi opEntry
sameno-op
read, refreshread
importno-op that is importing
discardforget

An input that holds Pulumi’s unknown value is unknown: true, so a resource that reads an output of one being created shows that input as unknown. A name the engine drew for a create or a replacement, the input the member’s planDigest reads as a fixed marker, is unknown: true too: the apply draws another, so the preview’s name is not the one that gets created, and two previews of one change get one document digest (#5563). A secret is sensitive: true. Each entry is on its graph node by the URN rule of @intentius/chant/pulumi-urn.

At preview, an apply() whose input is unknown does not run, so resources the program registers inside it are not in the steps. The adapter marks them mayAppear in the cases below. The paragraph after them gives the two it cannot detect.

  • A component whose subtree holds an unknown value, a create or a replace gets one entry at its URN with $* after its type and /* after its name, such as urn:pulumi:dev::site::my:web:Site$*::site/*. Its action is create and its type unknown, and it is on the component’s node.
  • With the member’s stack export, a resource the export holds and the preview has no step for gets an update entry with disruption unknown. A preview narrowed with --target, or one that failed, does not do this.

A delete under a component the first rule marks keeps its delete and is marked too, since the apply() may register the resource again.

A resource registered inside an apply() directly under the stack has no component to stand under. When no export holds it yet, it is not in the change set at all. When the export holds it and its apply() waits on an unknown value, the preview prints a delete for it, and the entry is a plain delete with no mayAppear, although the apply may register the resource again. Nothing in a Pulumi preview tells that case apart from a real removal, so this is a documented limitation (#4497). The recorded fixtures hold one: the plunge corpus’s vpc-id SSM parameter.

chant runs pulumi preview --json --show-sames. Without --show-sames the preview lists no unchanged resource, and the second rule would read every one as may-appear. The fixtures behind the adapter’s tests are recorded from pulumi 3.272.0 and plunge against the plunge corpus on the floci emulator (#4475). In them a replace is one replace step and a secret is the blinded "[secret]", with no planned outputs on the stack’s step.

The member’s planDigest and the document’s digest are taken over what the preview shows. A preview does not show everything an apply does, so an approval of a digest does not vouch for these:

  • A secret. chant previews without showing secrets, so each one prints as "[secret]" and its entry is sensitive: true. A change from one secret value to another has the same digest whatever the new value is.
  • A value known only after apply. Pulumi prints it as one fixed string and the entry marks it unknown: true, so the digest holds that the value is unknown, not what it will be.
  • A stack output. The preview plans none, so a change that only moves an output does not move the digest. The preview’s config block is left out too; a config value a resource input reads is in the digest through that input.
  • A resource registered inside an apply() the preview could not run. Where the adapter marks one mayAppear, the mark is in the document’s digest but not in the member’s planDigest, which covers the preview’s steps. The two cases the adapter cannot detect, above, are in neither.

A name the engine draws for a create or a replacement is left out of both digests: the member’s reads it as a fixed marker, and its entry is unknown: true. A value the engine draws that is not listed in the step’s __defaults, or does not read as the logical name and seven hex characters, is kept, so two previews of one change can still differ in it.

After the gate, a stock Pulumi apply runs pulumi up, which previews once more, and holds the steps it ran to the approved plan’s shape: resources, actions, types, the names of the inputs written and replacement. Values are not compared there, so a value that moves between the apply’s preview and up without changing the shape, such as a stack reference output or a data source read, is applied. A plunge apply runs the plan it saved with the preview.

A versioned plan is the migrations a product would apply to one environment, in order:

FieldHolds
dialectclickhouse or postgres
environmentthe member’s and every entry’s scope
migrations{ id, steps } each, in order; pending is read when migrations is absent
digestthe product’s own gate digest, used as the member’s planDigest
refusalwhy the product would refuse to apply, a string or { message }: the member is failed with no plan digest
holeswhat the product could not read

A step is a MigrationStep as chant sql diff --statements --json writes it (statement, op or manual, each with object, type and name). It may come wrapped as { step, done }, as SQL Yodeler’s plan view holds it. A step may also carry done: true, when an earlier partial run applied it, which leaves it out. It may name an action the product knows better than the classes, and a statement may carry the changes it makes.

The adapter writes one entry per object the pending steps touch, however many steps and migrations touch it. The entry sits at the object’s server name (database.name or schema.name). The action and disruption come from the steps’ change classes, priced as the dialects’ classifiers price them:

ClassesActionDisruption
dropdeletedestroy
createcreatenone
rebuild, expand, or a step an Op makesreplacereplace
anything elseupdatethe worst of metadata (in-place) and validate, concurrently or rewrite (rolling); unknown for a class neither dialect has

A destructive step such as a column drop makes the disruption destroy and leaves the action as it is. A named action wins over the classes.

Each change a step names becomes an attribute at its field (orderBy, columns.region), with before, after, and forcesReplacement for a rebuild or expand change. Three more attributes say how the change is made: sql, the statements in order; op, the migration Ops that make it; and manual, why a step has neither.

A migration Op’s plan part is one replace of the table while the Op has work to do (rebuild or migrate). A Postgres migration’s address is the table, schema.table. In the part the plan step returns, the member is the ClickHouse table (database.name) or the Postgres migration (schema.table.column). Once the Op has swapped, switched or finished, the part has no entries.

To hand a part from another process, write the part as JSON and read it with readChangeSetPart({ member, planner: "sql", file }). The reader checks that the member and every entry name planner sql, renames them to member, and recomputes nothing.

import { writeFileSync } from "node:fs";
import { sqlVersionedPlanPart } from "@intentius/chant-lexicon-sql/change-set";
// plan: `yodel plan prod --json`, parsed
writeFileSync("warehouse.part.json", JSON.stringify(sqlVersionedPlanPart({ member: "warehouse", plan })));

A terraform plan that stock marks errored is a failed member that keeps its entries. A choudoufu set plan root that did not plan is a failed member with no entries and no plan digest.

A combined run plans each member in its own step, composes the parts and gates on the digest.

import { Op, phase, gate, composeChangeSet, lifecyclePlanChangeSet, readChangeSetPart } from "@intentius/chant/op";
import { terraformPlan, terraformApply } from "@intentius/chant-lexicon-terraform";
const estate = terraformPlan("estate", { id: "estate" });
const delivery = lifecyclePlanChangeSet({ member: "delivery", env: "prod", cwd: "delivery", id: "delivery" });
const warden = readChangeSetPart({ member: "warden", planner: "warden", file: "warden.plan.json", id: "warden" });
const changeSet = composeChangeSet({ parts: [estate.out.changeSet, delivery.out.part, warden.out.part], id: "change-set" });
export default Op({
name: "release",
overview: "Plan every member, approve one change set, apply.",
phases: [
phase("Plan", [estate, delivery, warden, changeSet]),
phase("Approve", [gate("approve-release", { plan: changeSet.out.digest })]),
phase("Apply", [terraformApply("estate", { planFile: estate.out.planFile })]),
],
});
ActivityReturns
terraformPlanchangeSet, the root’s part, beside planDigest. The root’s name is the member
lifecyclePlanChangeSetpart, from chant lifecycle plan <env> --json in cwd
readChangeSetPartpart, from a plan file a chant or warden run wrote, or a part a sql adapter wrote
composeChangeSetdocument, digest and summary

All four only read. Approve with chant approve release approve-release --plan <digest>. When a re-run composes a document with another value, the run stops at the gate and names both values.

@intentius/chant/change-set, @intentius/chant-lexicon-terraform/change-set and @intentius/chant-lexicon-sql/change-set import chant’s plan hashing code and nothing else. Bundled with esbuild for node, the two come to about 19 KB. change-set-bundle.test.ts lists every module in that bundle and fails when TypeScript or chant’s lint code joins it. The sql lexicon’s change-set.test.ts holds its adapter to the same list, about 8 KB bundled. A tool that runs them in CI from one bundled file, such as terragucci, needs no TypeScript toolchain.

chant