Template versions and migrations

How a code-owned template declares numbered versions, and how publishing a version moves every one of its processes, live and finished, onto it in one transaction (issue #103).

The invariant: every process of a versioned template is on the template's latest version. Always. Publishing a version is a transaction: the application publishes version N together with its migration from N−1, and the platform applies it to every process of the template. If every process migrates, N becomes latest and every process is on it. If anything fails, nothing changes: N is not published, no process is touched, and every blocking process is named with its reason. A version number is taken only when a publication commits. Mixed versions would make every later operation over a process (bulk actions, reports, history, the next migration) branch on version, so there are none: no "keep on version", no "new instances only", no process left behind.

Templates without a lineage are unversioned: their processes stay pinned to the execution they started on, as before.

The model

  • The version number is the identity; the digest is the integrity check. The name is templateVersion, distinct from the authoring document's version, the aggregate's revision and schemaVersion. A version can compile to several digests: up to v5, spell-request's execution-date dropdown listed the next cycles when the module loaded, so a 14-day window roll plus a restart built a new digest of the same version. From v6 that list is a recipe (choice lists): the digest covers the rule, not the dates, so a version compiles to one digest whatever the day. Another build of the version already published is still published at startup as before (no process moves, and its number is recorded with it).
  • Recorded at publish, stamped on processes. The publication records the version number with the published execution in the registration store (templateVersion(key, executionId), write-once). A process records its execution's number in its binding (binding.templateVersion) when it starts or is migrated. The platform stores an opaque positive integer supplied by the host and never interprets it; the number never enters the compiled ExecutionDefinition, so no digest changes.
  • Routed by number. Planning takes a process's source version from its stamp, else from its execution's record. Every source must agree (the stamp, the record and, for listed digests, the lineage's map), and the number must be declared in the lineage; otherwise the publication fails (version-conflict, unknown-version). The completeness and target checks use the process's actual stored execution.
  • Legacy data and the digest map. Executions published and processes started before numbers were recorded carry no number. A version's executionIds lists its legacy digests, reconstructed from git with templates:lineage. An execution the map does not place fails the publication (unknown-digest): fail safe.
  • Lineages live with the template's owner. spell-request's is applications/spell-review/src/versions.ts, exported as @processos/spell-review/versions. The declaration types (TemplateLineage, MigrationOp) are in @processos/app-authoring. Main collects lineages in applications/main/src/templates/versions.ts.
  • Every version after the first declares its migration from the previous one. migrate: "new-instances-only" is gone.

Who does what

The application owns its lineage and the meaning of each op: the planner (applications/main/src/services/template-migrations.ts, step-level ops in applications/main/src/templates/declarative/migrations.ts) turns each process into a migration request. The platform (platform/runtime/src/application-service.ts) owns the transaction and its rules: publishTemplateVersion re-checks the version order and that every process of the template is either already on the version or migrated by this publication, runs every process's migration, enforces the required-value rule, and has the store commit the registration, the version record and every process together (commitTemplateVersion), or nothing. previewTemplateVersion is the same without the commit. New processes are created only on the latest (createOnLatest; see creation at the commit instant). The platform never depends on the application.

What a migration sees

Migrations operate on a process's step-level state, never on compiled continuation paths:

PartMeaning
currentStepThe step a live process waits at (the active visit, the innermost named frame and the pending input form must agree); null for a finished process.
dataThe per-step memory buckets, memory[stepKey][field].
completedThe steps with a completed visit.

Per process, exactly two outcomes

  1. Migrated. A live process re-enters the new program at its (possibly moved) step: every compiled step graph is a loop that dispatches on the step key, so re-entry is cursor: { input: <step key>, path: "root" } with no frames and no pending effect. A finished process (completed or failed) is migrated data-only: data ops and the new binding and stamp; no re-entry, no step moves; its status and outcome are unchanged and it keeps its last-updated time. Both get a migration audit entry.
  2. Closed by the migration: close(when, reason) finishes a live process for which when is true, as superseded by this version (completed, outcome { superseded: { reason, templateVersion } }, its open visit abandoned). It is for a process whose process changed too much to continue. Later ops and versions still migrate its data, as for any finished process.

Anything else fails the publication.

Operations

OpEffect on a process
addStep(step)None; declares that the step is new.
renameStep(from, to)Moves data[from], the current step and completion, and rewrites the step's visit history, field audit and state audit keys. The originals stay in the migration audit.
removeStep(step, moveTo?)Drops the bucket (kept in the audit). A live process at step needs moveTo, or the publication fails.
addField(step, field, default?)For a completed step (live and finished processes alike) whose field has no value, applies the default. "No value" is the platform's completion rule (hasRequiredValue); the not-recorded marker counts as a value. The step a live process waits at is never pre-filled. A mandatory field with no default fails the publication: NOT NULL without a default. A default that evaluates to null means no default for that process. note (optional) is recorded with each value it fills, in the migration audit.
renameField(step, from, to)Moves the value, and rewrites the field's key in the step's field audit (originals in the migration audit).
removeField(step, field)Drops the value (kept in the audit).
changeField(step, field, existing)The field's type or dropdown choices changed: its fixed values, its choice recipe, or one kind of list to the other. existing: "validate" fails a process whose stored value fails the new contract; "keep" leaves stored values as the platform does for a compatible input. "keep" is accepted only when the choices changed, and is the only option when the new choices are a recipe (a recipe is checked when a value is written, never against stored values).
resolveChoice(step, field, source, note?)Phase 4: the field's choices became a data source (choices: { source }, declared with changeField(..., "keep")): each stored name that is exactly one live entry's name (case-insensitive) becomes the reference { id, name } (the stored name kept as the snapshot), live and finished processes alike, recorded in the migration audit with note. A reference, an empty value or the not-recorded marker is kept. Fail closed: a name the source does not hold exactly once refuses the process (choice-unresolved), and any process with a name to resolve is refused when the source cannot be read (choice-source-unavailable), so the publication commits nothing. The completeness check requires it whenever a field's choices become a source. The release step reads the source through the deployment's own binding (MigrationContext.choiceSources).
moveCurrentStep(from, to) or moveCurrentStep(expression)Repositions a live process. The expression returns a step key, or null to stay.
keepCurrentStep(at, despite)None; records the decision that processes waiting at at stay there although the new step despite was inserted immediately before it.
completeStep(step, when, values, moveTo, note?)For a live process waiting at step where when is true: writes values (an object expression of the step's fields) into the step, counts the step as completed and moves the process to moveTo. Its open visit closes as completed by the migration's actor (completeOpenVisit on the rebind), not abandoned. Every value is recorded in the migration audit with note. For a decision made outside the step that the step should carry (spell-request v18).
close(when, reason)Finishes a matching live process as superseded (see above). Never applies to a finished one.
transform(expression)Escape hatch. A pure closed expression from {currentStep, data, completed} to the same shape. It may not finish a live process (that is close) or revive a finished one.

Defaults and expressions are closed platform expressions evaluated over the step-level state (and, during a publication, the process's read-only processId, for a migration that must name particular processes).

Completeness is checked, not trusted. Before anything is applied, each migration on the path is compared with the real structural difference of the two executions: steps added or gone, fields added or gone, fields that became mandatory, fields whose type or choices changed (a recipe is compared by its digest, never by its output), and new steps inserted immediately before an existing step. An undeclared difference fails the publication with migration-incomplete, naming what is missing. The verify gate applies the same check to the current version against its frozen previous shape.

An insertion before an existing step is a decision. When a new step leads straight into a step that already existed, processes already waiting at the existing step would never run the new one. Each such pair needs moveCurrentStep({ from: existing, to }) or keepCurrentStep({ at: existing, despite: new }).

Migrated data must satisfy the target's input contracts. Values the migration wrote or moved, fields declared changeField(..., "validate"), and every stored value of a strict interaction are checked with the rule a strict submission uses (fieldValueProblem). A completed step must not lose a mandatory value it had. Failures are target-invalid, naming every bad field.

Auto-generation. generateMigration emits the unambiguous ops (added steps, added optional fields) and reports everything else for the author to decide. It never guesses.

Values for new or newly required fields

The migration decides; the platform has one rule. After a migration, every mandatory, visible input field of every step the process has completed (other than the step it now waits at) has a value, or the publication fails (required-value-missing, naming each step.field). This is checked by the platform for every process (requiredValueProblems), whatever the application's planner did.

For each such field the author chooses an addField default: a value, an expression over the process's data, or the platform's not-recorded marker, default: { notRecorded: true }. The marker is a tool, not a policy:

  • it is the stored value { "processos:not-recorded": "predates-field" } (@processos/contracts/not-recorded): never a string, number, bool, list or file, so never confusable with a real answer and never one of a dropdown's choices;
  • it satisfies the required-value rule only on a step the process had already completed; the platform refuses it anywhere else;
  • a live completion never accepts it (a person completing a step now must answer), and a submission can never write it; a submission may only send it back unchanged;
  • every presentation renders it as "Not recorded (predates this field)": the generic runner and process pages, the spell-review runner and item pages (including the pre-risk review fields), the master table and review queue, records, exports and the audit view; forms load it as an empty input with that note.

Renames apply to history

renameStep and renameField rewrite the process's history so every later reader sees one shape: visit keys, field audit step keys and field keys, and state audit keys (a state audit entry's before/after values stay the raw snapshots they recorded). The migration audit entry keeps every original it rewrote (history: the renames, and the original key of each visit, each field audit entry and each state audit key). A renamed value is the same value: the migration records no data change for it.

Publishing: the release step

The release step (npm run release, which runs templates:publish) runs before a new deployment takes traffic.

First, the presentation check (Adam, 2026-11-17). Every read of a process also applies the read rules of the presentations it was on before (each migration audit entry's fromPresentationId / toPresentationId; permissions). Before anything is published, the release step looks up every presentation id named in any process's migration audit, for every template, in the registration store. If one is missing, the release step publishes nothing and exits non-zero, naming each process and the presentation ids it is missing (applications/main/src/services/earlier-presentations.ts); the dry run reports the same as a failure (non-zero exit) and goes on previewing the rest. The read-time behaviour stays as the backstop (a single read fails closed, a list row is served with every undeclared field withheld and an alarm).

Then, for each versioned template:

  1. Forward-only. If the published version is newer than the code's, nothing is published or migrated (a warning is logged; the old code keeps serving existing processes). Rolling a form back means publishing a new version that reverses it.
  2. Up to date? If the published latest is exactly this build, recorded as the code's version, and every process is on it, there is nothing to do. If only the registration changes (a first publication, or another build of the published version after its date window rolled) and no process has to move, it commits at once, without an upgrade window.
  3. Quiesce. It opens the template's upgrade window (a durable record with an expiry, quiesce). While it is open, no new work starts on the template's processes: new processes and every person command (edit, complete, reopen, abandon, sharing, delete) are refused with 503 template-upgrading, a spawned child of the template is not created (its parent's spawn is not dispatched, and the step worker retries it later), and the step worker does not wake a process sleeping on a timer. Work already in progress (a running continuation, an effect being delivered) continues to its next rest point.
  4. Settle. It waits up to TEMPLATE_PUBLISH_SETTLE_MS (default 60 s, at most 150 s; one budget for the whole step, stragglers after a commit included) for in-flight work to settle. A process that cannot settle fails the publication at once, named: held for reconciliation, delivery in doubt, a parent with child receipts, a spawned child, or a timer in a step that is not safe to restart. One still in flight when the wait ends fails it too ("did not settle").
  5. Plan and commit. It plans every process and asks the platform to publish. Every failure is printed and the step exits non-zero, having changed nothing for that template. A commit conflict (something moved after planning) is re-planned, up to three attempts. After a commit it re-plans, waits for anything else that appeared meanwhile to settle, and converges it (a start or spawned child cannot be left on the old version, see below; a process written by trusted import tooling can). If such a straggler still cannot be moved, the version stays published (the new build matches it, so the step exits 0) with a warning naming the processes; the next release step moves them.
  6. It always closes the window, which also expires on its own if the step dies.

Creation at the commit instant

A process can be created at the very moment a publication commits: a start that passed the upgrade-window check just before the window opened, or a spawned child. Each one reads the latest, builds the process on it, and then asks the store to create it with createOnLatest, which writes only if that execution is still the template's latest, atomically with commitTemplateVersion:

  • the publication commits first: the creation writes nothing (latest-moved), and the start or child re-binds to the new latest, exactly like a fresh start (up to five attempts with a short pause between them, then 503 template-upgrading; a child's withdrawn reservation is replaced by one for the new latest). Like a fresh start, the re-bound one checks the upgrade window again, so while the release step still holds it open it is usually refused with 503 template-upgrading instead (a child: its spawn is retried later);
  • the creation commits first: the process is in the publication's instance set, so the commit conflicts and the release step re-plans, migrating it with the others.

Either way, no process is ever created on a version a publication has just replaced. The stores make the check and the write atomic with the commit in their own way: the memory store does both without yielding; the file store holds the template's lock, as the commit does; the Mongo store writes a per-template head document (template-heads-v2) in the creation's transaction, as every publication transaction does. MongoDB transactions are snapshot-isolated and a read never conflicts, so without that common write a creation that read the old latest and a publication that did not see the new process could both commit; with it, whichever writes second gets a write conflict and is retried on a snapshot that sees the other. A concurrency test races starts against publication commits on every store (MongoDB as a real single-node replica set) and checks that every process ends on the new version; removing either head write, or the check, makes it fail.

Only commits that can move processes take part. A startup publish of another build of the published version (a registration-only compare-and-set of the latest pointer, with no transaction) does not: a process created as it lands may be bound to the previous build, which is the same version, so the invariant holds. Unversioned templates keep their rule (processes stay on the execution they started on); their starts still create only on the latest they read, re-binding if it moved.

A process sleeping on a timer is at rest when the step it sleeps in is safe to restart (restartSafeStep): the compiled step contains no effect other than local computation and state, time, reads, and HTTP declared repeat: "safe". A polling watcher (spell-request's s13, s19 and s20 watchers) qualifies: re-entry restarts the watch (and its window) from the start.

Each template is its own transaction: with several versioned templates, one can commit while another fails. The step then exits non-zero (the deployment fails) with the first template published; the old build keeps serving it, as versions only move forward.

Deploy: release step and readiness

  • The release step runs once, on one service. On Railway, the process-platform web service's start command is npm run release && npm start (not a pre-deploy command: Railway does not mount volumes there, and the release step reads the access policy from the volume). A non-zero exit means the server never starts and never passes /health, so the deployment fails and the old deployment keeps serving the old version. No other service runs it. See deployment for every service's settings.
  • Readiness: the platform has this build's version. At startup each service still publishes what it safely can (a key never published, a presentation-only change, another build of the published version) and then checks that the published latest of every versioned template it serves is recorded at its declared version (or newer: forward-only). Until then readiness fails and is retried: the web's GET /health returns 503 with the reason and every API route waits. A web service can never go live ahead of the publication. The step worker is not gated: it runs stored programs, whatever version its build declares, so in-flight work keeps moving and can settle during a release step; it logs that the versions are not published yet. Startup never publishes a new version of a versioned template, and its own publishes are a compare-and-set on the latest pointer, so they never overwrite a newer publication.
  • Atomicity needs MongoDB transactions. The Mongo store commits a publication in one multi-document transaction, which needs a replica set; on a standalone the release step fails before doing anything, naming the conversion (MongoDB as a single-node replica set). Creating a process is a (small) transaction too; on a standalone, where no publication that moves processes can commit, it is a plain insert after the latest check. The memory store commits all checks and writes in one synchronous step; the file store (local development) takes the template's and every process's lock and writes a journal that a crash replays before the store serves anything.

Operator commands

Each command reads MONGO_URL (or the file store) exactly as the app does.

npm run templates:publish -- --dry-run                     # the release step's plan and the platform's preview; writes nothing
npm run templates:publish                                  # the release step (normally run at the start of the process-platform start command)
npm run migrations:status                                  # lineages, recorded versions, processes per execution, unknown digests
npm run migrations:dry-run -- --template spell-request     # same plan and preview as --dry-run, one template
npm run migrations:dry-run -- --id <processId> --json      # one process's plan and preview
npm run migrations:backfill -- --template spell-request [--yes] [--actor <name>]

migrations:apply was removed: a migration is applied only by publishing its version, to every process at once. templates:seed --force no longer overwrites a published versioned template.

Reconstructing a lineage from git

Executions published before version numbers were recorded carry no number and no timestamp.

npm run templates:lineage -- --template spell-request --digests d1,d2,...   # or --from-store
npm run templates:lineage -- --template spell-request --digests ... --diff d1,d2,d3

The tool walks every commit that touched the template source (following renames) and evaluates the file as it was, with the clock pinned at each day from the commit onward. It reports exact digest matches with their commits and everything else as unmatched. --diff prints the auto-generated migration between consecutive digests.

Adding a version

  1. Change the template. The verify gate (applications/main/src/templates/versions.test.ts) recompiles each versioned template with the clock pinned to its current fingerprint and fails if the execution changed.
  2. In the lineage, turn the current entry into a historical one (keep its fingerprint and any legacy executionIds). Add a new current entry with fingerprint: { at, executionId }.
  3. Declare its migration, starting from templates:lineage -- --diff or generateMigration. Resolve every required item: each insertion before an existing step (moveCurrentStep or keepCurrentStep), each new or newly mandatory field on a completed step (a value, an expression, or { notRecorded: true }), and any process to close. Remember that finished processes migrate too.
  4. Freeze the outgoing version's shape for the verify gate: npm run templates:lineage -- --template <key> --digests <outgoing digest> --emit-shape <outgoing digest> --out <file> (spell-request: applications/spell-review/src/versions-previous.ts), and set it as the new entry's previous.
  5. Run npm run templates:publish -- --dry-run against a copy of real data and review every process before deploying. The deploy's release step then publishes it.

Recorded decisions

  • The 12 past-cycle items without pre-risk verdicts (the nine Sept 24 items waiting at s19 and the three Sept 10 items waiting at s10, all CC-tracker backfills): the v2→v3 migration gives s07a_pre_risk_review_write.verdict, s07b_pre_risk_review_confirm.verdict and s07b_pre_risk_review_confirm.notes the not-recorded marker where a completed step has no value (approved by Adam, 2026-10-01). They migrate with every other process; the nine Sept 24 items also move back to the vote watcher (the v5 decision below).

  • spell-request v4 defaults (approved by Adam, 2026-10-01): items that had already filed s01 get the Summary "Not recorded: this item was filed before the intake asked for a summary.", and the item type moves from s04 with "Prime Action" → "Prime Spell" and "Sky Core" → "Sky Core Spell"; an item with no s04 answer gets "Prime Spell".

  • spell-request v5 insertions (approved by Adam, 2026-10-01): items waiting at s19_executive_vote move back to s19_watch_executive_vote; items waiting at s13_publish_technical_scope and s20_execute_spell stay there (keepCurrentStep).

  • The two leftover test items, closed by the v6 migration (#104), the first version published through this transaction (approved by Adam, 2026-10-01). Each close matches conservatively on fields taken from the 2026-09-30 snapshot; if any was edited since, nothing closes and the item simply migrates:

    • the 2026-09-16 test item named in issue #103 ("this is. test", Spark, Oct 8 cycle): the trimmed title, the Prime and the cycle all match; reason "Test item filed on 2026-09-16, not a real spell request (#103).";
    • the cutover write-test draft (started 2026-09-16, renamed "Cutover write test 2026-09-24", Spark, no cycle chosen, still at s01): the exact trimmed title, the Prime and an empty cycle all match; reason "Cutover write test (2026-09-24), not a real spell request.".

    Before deploying v6, run npm run templates:publish -- --dry-run against a fresh copy of production data and confirm exactly two close outcomes (these two items), every other process migrating, and nothing failing. Done on a read-only export of 2026-10-02T00:46Z (63 spell-request processes, all on v5 df4703d2): 34 migrated live, 27 migrated data-only (finished), exactly these 2 closed, 0 failing; committing that local copy left all 63 on v6 42aa2625.

  • spell-request v6 (#104): the s01 execution-date dropdown's choices become a recipe (EXEC_DATE_RECIPE in applications/spell-review/src/template.ts: the next 10 cadence Thursdays from 2026-07-30, every 14 days, at least 22 days out, skipping 2026-12-31). Declared changeField(s01_deal_registration, execDate, keep): every stored date stays as it is. New dates are checked against the recipe when written. The Stars list stays a fixed list: no suitable data source exists yet (choice lists).

  • spell-request v7 (#129): the three cycle watchers (s13, s19, s20) declare manual entry, so the people who complete the step a watcher pre-fills can stop it and enter the value by hand. No step or field changes: the migration is empty. Live items re-enter at the step they wait at; an item asleep in a watcher restarts that watch (and its window), repeating only reads declared safe to repeat. Like v6, an older build refuses the new registration (it does not know manualEntry) until the new build takes traffic. Before deploying v7, run npm run templates:publish -- --dry-run against a fresh copy of production data and confirm every process migrates and nothing fails.

  • Finished spell-request items (27 in the 2026-09-30 snapshot) migrate data-only through v1→v5; every migration on the lineage is valid for them (dry run of that snapshot: 36 live processes migrated, 27 finished processes migrated data-only, none closed, none failing).


Known gaps

  • Parents with child receipts and spawned children are not migrated yet: carrying a child's lineage with its parent (rewriting the receipts and the child's origin digests together) is not built. Such a process fails the publication, named (child-receipts, spawned-child). No versioned template spawns children today.
  • A held process (reconciliation, operator or resource-limit hold) or one whose delivery is in doubt fails the publication, named; it must be resolved first.
  • A process sleeping on a timer in a step that is not safe to restart fails the publication. Restart safety is a static, whole-step check: one unsafe effect anywhere in the step disqualifies it, and local state updates are re-run on restart.
  • A process written by trusted import tooling with a plain create-only compareAndSet (migrations apply, the backfill) is not checked against the latest: such tools bind processes on purpose. One written during a release step is converged by its post-commit re-plan, or else by the next release step.
  • The first deploy of this change still has the old gap: its release step runs while the previous build serves, and that build creates processes without the check (and spawns children without the window). Its post-commit re-plan converges what lands on the old version, as before; the next release step catches anything later.
  • templates:seed --force and the platform's internal register replace the latest with a plain publish, with no check and no serialization. They are operator and test paths; templates:seed --force already leaves a published versioned template alone.
  • Creations of one template serialize with each other as well as with publications (on the Mongo head document, or the file store's template lock): concurrent starts of the same template may retry a write conflict. This is invisible at today's volumes.
  • The upgrade window is enforced by code that knows about it: during the first deploy of this change the previous build ignores it. Correctness does not depend on it (every process write is revision-guarded inside the transaction, and a conflict re-plans), but a busy template may need a retry.
  • The file store's commit is crash-atomic but not isolated: a reader in another OS process may briefly see a commit being applied. A creation that crashes while holding the template lock leaves it behind (as a crashed change leaves a process lock): later creations and publications of that template wait ten seconds and then fail until it is removed. It is for local development only.
  • The /health readiness route belongs to the main application: the independent-backend topology (a packed backend consumer with peer frontends) has none, so point its health check elsewhere or add one there.
  • An extra template (loadExtraTemplates) replacing a versioned key declares no version: that service never becomes ready.
  • spell-request's review home computes its cycle rail with upcomingSpellDates(), a TypeScript twin of the v6 execution-date recipe; a test pins the two to the same dates for every day and hour across two years, so a change to one must be made in both.
  • spell-request's own expressions read the pre-risk fields as text (the s07b completion trims notes; the s07b verdict defaults to the s07a verdict). They run only when a migrated past-cycle item is reopened to those steps; the person must then answer them (a live completion never accepts the marker), and the s07b verdict's default may not render cleanly. Changing them changes the template, so it waits for its next version.
  • A form re-sends a not-recorded bool that is left unchecked as the marker: on an already-completed step, "unchecked" cannot be told apart from "not answered".
  • If a new version compiles to a digest already recorded under another number, the publication fails with version-conflict; give the code a distinct execution or declare the version it really is.
  • The completeness check for historical transitions needs their executions in the registration store; the verify gate checks the current version against its frozen previous shape only.
  • A build older than #104 cannot read spell-request v6. v6 is the first published registration with a field older code does not know (choices on execDate), and registration validation refuses unknown properties (invalid-registration). Once the release step commits v6, the previous build still serving refuses spell-request starts, and a restart of it fails to initialize, until the new build takes traffic (the release step runs in the new service's start command, so this lasts about as long as its start-up). Measured locally (2026-10-01): a running pre-#104 build refused every spell-request start after the commit, and could not start again. Rolling the code back below #104 after v6 is published therefore needs a release that accepts the field; deploy v6 when a short spell-review interruption is acceptable.
  • spell-request v8 (EPL three outcomes; Adam 2026-09-25, approved 2026-10-06): s09's completion becomes s08_prepare_strategic_review.holdBack === true || s09_strategic_decision.decision === "yes". An item the EPL holds back from the strategic package (routine, or already approved) passes the strategic decision as "not required", with no decision recorded, instead of a laundered "yes"; s09 shows a "Strategic approval not required" header and hides the decision for it. Only s09's rule and presentation change: the migration is empty.
  • spell-request v9 (#154, #155): the EPL-assigned cycle with a Backlog, and link fields.
    • Cycle (#154). s01 gains assignedCycle (hidden dropdown, writable only with spell:manage, choices a recipe: "backlog" or the next 12 cadence votes from tomorrow, ASSIGNED_CYCLE_RECIPE). The item's cycle is assignedCycle when set, none for "backlog" (the Backlog: the "undefined future"), otherwise the Prime's execDate, which is never rewritten and stays recorded as what they asked for. The EPL moves an item from Triage or the item page (moveSpellCycle); the server checks the value against the recipe and the field audit records who moved it, when, and to what. A vote inside the 23-day intake lead is allowed for the EPL as an override, after an explicit warning (decision for Adam: allow-with-warning, or refuse). The s13, s19 and s20 watchers follow the same cycle rule and finish at once with reason: "no-cycle" for a Backlog item (still safe to restart).
    • Links (#155). Optional string fields: s10.slackLink (slack.com), s15.atlasEditLink (github.com), s17.primeSpellPr (github.com; shown for Prime Spell items), s19.voteUrl (vote.sky.money; pre-filled from the vote watcher's url); the existing s15.pollUrl is now checked too (vote.sky.money, snapshot.org, snapshot.box) while a poll is required. The template language has no URL type, so each check is part of its step's completion rule (linkFits in applications/spell-review/src/template.ts): empty, or https:// on an accepted host or a subdomain of one; a link that does not fit holds the step with the reason "Change “<field>”". Completion rules are not re-checked on steps an item already completed, so a stored link never fails the migration.
    • Migration. Every new field is optional: TO_V9 only declares them (addField, no defaults). No item moves, nothing is filled, and every item keeps its cycle (an empty assignedCycle reads as the requested vote, exactly as before). Items asleep in a watcher restart that watch, as in v7.
    • Chain: X-Layer (prod dry-run, 2026-10-06). s04_spell_item_intake.chain gains "X-Layer" (changeField … existing: 'keep': additive, stored chains stay). The Spark X-Layer item imported from the CC tracker after v8 (cb7be310…, at s17) completed s04 with an empty chain because X-Layer was not a choice, which refused the publication (required-value-missing). addField(s04, chain, { notRecorded: true }) gives a completed s04 with no chain the not-recorded marker (a recorded chain is never touched); the EPL sets X-Layer by hand after the deploy. Dry-run of a fresh prod copy before this fix: 83 instances, 41 migrate, 41 data-only, 0 close, 1 refused (this item).
    • Before deploying v9, run npm run templates:publish -- --dry-run against a fresh copy of production data (as for v6: a read-only export restored into a local replica-set Mongo, MONGO_URL pointing at it) and confirm every spell-request process plans migrate (live) or data-only (finished), none close, and the failure list is empty; npm run migrations:dry-run -- --template spell-request --json gives the same plan per process.
  • spell-request v10: "not included", the technical scope PR, and the Executive Sheet link.
    • Not included. s01 gains five hidden fields, writable only with spell:manage: notIncluded (the reason: "Withdrawn by Prime", "Not approved", "Deferred" or "Removed from spell"; its choices are a rule, NOT_INCLUDED_RECIPE, so the server checks a written reason; "" clears it), notIncludedCycle, notIncludedStep (the step it was at), notIncludedNote and notIncludedLink. Who and when come from the field audit. The EPL takes an item out at any open step from the item page's Cycle card ("Take out of cycle"), and puts it back ("Put back in cycle"); a move to another cycle or the Backlog clears it in the same write. While a reason is recorded the item is held: every completion rule of a step a person completes (all but s02) starts with !s01_deal_registration.notIncluded && (…) (heldWhileNotIncluded), so no step completes, and the s13, s19 and s20 watchers finish at once with reason: "not-included" (a watcher already looking keeps looking; the step it fills stays held). Clearing the reason resumes the item at the step it stopped at. The item stays listed in its cycle, marked, and is left out of every count (cycle status, member counts, Prime counts and complexity totals, Waiting on you, the strategic package, bulk actions).
    • Technical scope PR. s11_draft_technical_scope.scopeLink ("Technical scope PR") must be an https:// github.com link (linkFits, LINK_HOSTS.technicalScope): the Prime's pull request on its fork of the technical-scope submissions template. s13's forumUrl stays the forum post.
    • Executive Sheet. s16_assemble_executive_vote_scope gains sheetLink ("Executive Sheet", https:// docs.google.com, LINK_HOSTS.executiveSheet), which its completion rule requires; agenda stays, optional ("Agenda entry (optional)"). sheetLink is not marked mandatory, so no completed s16 needs a value; the batched screen records one link on every chosen item. Links for items already past s16 are filled in by hand after the deploy.
    • Migration. TO_V10 declares the six new fields (addField, no defaults). No item is held, moves, or changes: completion rules are not re-checked on completed steps, so a completed s11 holding a forum link and a completed s16 with no Sheet link migrate untouched (tested). Items asleep in a watcher restart that watch.
    • Before deploying v10, as for v9: restore a fresh read-only export of production into a local replica-set Mongo (npm run data:pull, read-only), point MONGO_URL at it, run npm run templates:publish -- --dry-run and confirm every spell-request process plans migrate (live) or data-only (finished), none close, and the failure list is empty (npm run migrations:dry-run -- --template spell-request --json per process).
  • spell-request v11 ("slim the template", the EPL's walkthrough of 2026-10-07: record only what is used).
    • Validate (s05) is automatic. It is a template step that records { outcome: "validated" } and moves on to triage; nobody clicks it. The EPL flags an exception at triage: s06 gains an optional Flagged (s06.flagged), and s06's rule becomes confirm === true && flagged !== true, so a flagged request stays at triage (marked "Flagged" on its page and row) until the flag is cleared. The bulk Validate requests action and the MCP bulk_complete validate action are gone.

    • Two separate risk reviews, by different people (Adam, 2026-10-07). BA Labs' Financial pre-risk review (s07a, spell:review-risk): verdict and review text; "Next steps" is gone; it is what the strategic package leads with, and it leads straight to Prepare strategic review (s08). Kohla's Technical risk review (optional) (s07b, spell:manage-tech, with spell:manage so the EPL can record it for Kohla): verdict and notes only. The item page shows them as two sections with their owners, under a "Risk reviews" tab; the strategic decision's "Financial risk conditions" / "Technical risk conditions" keep their names. Step keys are unchanged, so the data maps as it is: s07a is the financial review, s07b's verdict and notes the technical one.

    • Technical risk review (s07b): its next-step checks (confirm, onTechRiskBoard) are gone, and its verdict and notes are optional (its rule is the "not included" guard alone). The engine has no parallel branches (template-language.md), so it does not block the strategic review by coming after it: s10 → c07b_technical_review_recorded → s07b → s11. The condition passes an item that already recorded a verdict (every item that did s07b under v10) straight on to s11, so nobody is asked twice.

    • Strategic review: BA Labs' pre-risk review (verbatim, as stored rich text) is each item's main content on the screen, in the Word package (preRiskLabel "Financial pre-risk review · BA Labs · <verdict>", preRiskHtml; the EPL's entry follows as "EPL summary", hasBody/bodyHtml) and in the MCP package; s08 shows it read-only (_view_preRisk) and the EPL's summary is optional (s08 completes unless held back without a reason).

    • The spell: Craft & review (s17, was "Craft & audit"; reviewer/reviewed labels, field keys unchanged) now precedes the Executive Sheet (s16), which records the spell's payload: s15 → s17 → c16_sheet_recorded → s16 → s19 watcher. The condition passes an item whose Sheet link is already recorded (every item crafted under v10) straight on to the vote. Review & verify spell (s18) is gone (the aligned delegates verify the spell). The agenda entry (s16) and the duplicate Prime spell PR (s17) are gone; the technical scope PR (s11) is optional. "Star's Proposed Changes" reads "Prime's proposed changes".

    • Migration (TO_V11). removeField s05 confirm/notes, s07a nextSteps, s07b confirm/onTechRiskBoard, s16 agenda, s17 primeSpellPr; removeStep s18 (moveTo: s19_watch_executive_vote). Removed values leave the step data and stay on the record in its migration audit (detail.removed), as v4 retired s04's item type; the field audit still holds every original write. addField s06 flagged (optional, no default). addStep for both conditions; each leads into steps that already existed, so each pair is decided: items at s07b move to s08 (moveCurrentStep) and reach s07b again after the decision; items at s11 stay (keepCurrentStep despite c07b); items at s16 move back to s17 (moveCurrentStep: not crafted yet); items at the vote watcher stay (keepCurrentStep despite c16). Items at s05 move to s06. A field that stops being mandatory (s07b verdict and notes, s11 scope link) needs no op.

      v10 step an item waits atv11 landing
      s05 Validates06 Triage (validated, no click)
      s06 Triages06
      s07a Pre-risk review — writes07a Financial pre-risk review, then s08
      s07b Pre-risk review — confirm next stepss08 Prepare strategic review; s07b Technical risk review (optional) after s10 (no verdict yet)
      s08, s09, s10same step; c07b skips s07b (verdict recorded under v10)
      s11–s15 (and the s13 watcher)same step
      s16 Executive Sheets17 Craft & review, then s16
      s17 Craft & audits17; c16 skips s16 (Sheet link recorded under v10)
      s18 Review & verify (removed)s19 vote watcher (restarts its watch)
      s19–s21 (and the watchers)same step
      finisheddata-only
    • Prod dry run (2026-10-07, read-only mongodump of production at 19:58Z restored into a local replica-set Mongo, templates:publish --dry-run): 83 spell-request instances, all on v10 47681f81: 39 migrate (8 at s05 → s06, 1 s06, 1 s08, 1 s10, 2 s11, 17 s17, 9 s21), 44 data-only, 0 closed, 0 refused. Committing that local copy left all 83 on v11 3e3f9f93. Values moved to the migration audit: 62 Validate ticks and 1 Validate note (a backfill note), 61 "Next steps" (all placeholders: "Not recorded", "None outstanding…", "N/A"), 61 pairs of next-step ticks, 9 agenda entries, 10 Review & verify records. The 17 items at Craft & review (the Oct 8 cycle) all have a Sheet link, so none is asked for the Sheet again.

    • Final dry run before publishing (2026-10-07 23:07Z, after reverting walkthrough test values on three live items): 83 instances on v10: 40 migrate (9 at s05 → s06, 1 s06, 2 s07a, 1 s10, 2 s11, 16 s17, 9 s21), 43 data-only, 0 closed, 0 refused; every item at s17 has a Sheet link and every item at s10/s11 a technical verdict, so none is asked again. Committing that local copy left all 83 on v11 3e3f9f93. The same dump is the pre-publish backup (sha256 4a568194c5cdcb6d…, restore-tested against live collection counts).

    • Before deploying v11, as for v9 and v10: a fresh read-only export restored into a local replica-set Mongo, templates:publish -- --dry-run, every process migrate or data-only, none close, no failures.

  • spell-request v12 ("record only what is used", continued; agreed with Adam 2026-10-07).
    • No Triage. s06_triage_and_prioritize and v11's Flag are gone: Validate (s05, automatic) leads straight to BA Labs' Financial pre-risk review (s07a), so BA Labs starts as soon as the Prime submits. Every filed item is a member of its cycle from submission (TRIAGE_INDEX is -1). The review phase is renamed Intake review (was "Intake, triage & prioritization").

    • Not validated: back to the Prime. Validate stays automatic. The EPL can override it at any point in the review before the strategic decision (s07a, s08, s09) with a reason: three hidden routing fields, written through the ordinary loose-mode update like "not included" (v10): notValidated (the reason) and notValidatedRound (1, 2, …), both spell:manage; and resubmittedRound (spell:write), which the Prime writes back to resubmit. Every completion rule now starts with both guards, heldWhileStopped = INCLUDED && ((WITH_REVIEW) && (rule)), where WITH_REVIEW is "no round opened, or the latest round written back". So the item is held at its step (the engine has no command that moves a live process backwards, and none is needed): BA Labs cannot complete its review, the Prime sees the reason at the top of the item page with Edit submission and Resubmit, and resubmitting validates it again with no click and lets it carry on from that step. Two fields so a Prime can end a round but never open one, and the EPL can open another after a resubmission. Who and when come from the field audit; the item page's Validate row lists every round. The "before the strategic decision" limit is the screen's (the server accepts the write at any step; holding a later step is harmless).

    • The technical risk review is a note (like the EPL's notes, #153): technicalRiskReview, written by spell:manage-tech and spell:manage, read by EPL_COMMENTARY_READERS (Sky Core and BA Labs through processes:read_all/processes:audit, the EPL, the tech coordinator), never a Prime, as the item page treated v11's s07b. s07b_pre_risk_review_confirm and c07b_technical_review_recorded are gone; s10 leads to s11.

    • Migration (TO_V12). addField the three routing fields (no values); removeStep s06 (moveTo: s07a), c07b and s07b (moveTo: s11, where c07b would have taken them). Removed steps' data stays on the record in the migration audit (detail.removed) and the field audit. A migration cannot write a process note (notes are not program memory), so v11's recorded technical review verdicts and notes are not copied into the new note; the item page shows the last one written through the step (from the field audit) in the note's row, "Recorded as a step before v12".

      v11 step an item waits atv12 landing
      s06 Triage (flagged or not)s07a Financial pre-risk review
      s07b Technical risk reviews11 Draft technical scope
      every other stepsame step
      finisheddata-only
    • Prod dry run (2026-10-08 03:11Z, read-only mongodump restored into a local replica-set Mongo, templates:publish -- --dry-run and migrations:dry-run): 83 spell-request instances, all on v11 3e3f9f93: 40 migrate (10 at s06 → s07a, 2 s07a, 1 s10, 2 s11, 16 s17, 9 s21; none at s07b), 43 data-only, 0 closed, 0 failing. No item at triage is flagged. Values moved to the migration audit: 60 triage records and 58 technical review records (55 of them placeholders: the not-recorded marker, "None" or "Not recorded").

    • Before deploying v12, as for v11: a fresh read-only export restored into a local replica-set Mongo, templates:publish -- --dry-run, every process migrate or data-only, none close, no failures, and no item at s06 flagged (report any by id: they need Adam's decision).

  • spell-request v13 (the external-link scorer; agreed with Adam 2026-10-08).
    • What changed. Only the forum watcher's body (s13_watch_forum_thread). v5–v12 required the title to start [<Month D, YYYY>] and contain proposed changes to <Prime>, and read only the first page (30 topics) of the Prime's category, so it missed e.g. Pattern's "Technical scope for the October 22, 2026 Pattern Prime spell" and Grove's "[April 9th, 2026] …". v13 reads the category newest first (order=created) and stops at the first page that reaches topics created more than FORUM_LOOKBACK_DAYS (60) before the vote (at most FORUM_MAX_PAGES = 40; Spark's look for an upcoming cycle: 1 request, not 10), and scores each topic with the external-link scorer (applications/spell-review/src/external-links.ts, forum-thread-link.ts): the cycle's date in any common form (whole-word, via the new generic stringWordIndex operation), "Proposed Changes" / "Technical scope", the Prime's own category (the listing now carries each topic's categoryId), and three ranking-only features. Found (exactly one topic has the date, the wording and the category): the watcher fills the link, as before. Unsure (two such topics, or only topics with the date): nothing is filled; the candidates are recorded and shown. Not found yet: no candidate. The outcome (status, candidates with features and scores, the rule) is the watcher's output; while it keeps looking it also records it in its own bucket after each look (modify-state, so the field audit records only changes), and manual entry keeps it there. No step, field or completion rule changes.

    • Migration (TO_V13): empty. Live items re-enter at the step they wait at. An item asleep in the forum watcher restarts its watch (and its 21-day window) under the new rule; the watcher is still safe to restart (reads declared repeat: "safe", local state). Items past the watcher keep what v5–v12 recorded ({found, url?, …}); the item page reads that as found or not found. Finished items migrate data-only.

      v12 step an item waits atv13 landing
      s13_watch_forum_thread (asleep between looks)same step; the watch restarts and looks at once
      every other stepsame step
      finisheddata-only
    • Before deploying v13, as for v12: a fresh read-only export restored into a local replica-set Mongo (npm run data:pull), then npm run templates:publish -- --dry-run and npm run migrations:dry-run -- --template spell-request --json. Expect every process migrate or data-only, none close, no failures (in particular no not-at-rest for an item asleep in the forum watcher: it must be reported restart-safe). List the items at s13_watch_forum_thread: after the deploy each looks at once, and any whose thread the old rule missed (Pattern's October 22 item) should move to Publish technical scope with the link filled.

  • spell-request v14 and the batch templates (#183, batch records; Adam 2026-10-08). Design and read contract: applications/spell-review/docs/batch-records.md, applications/spell-review/src/batches/contract.ts.
    • What changed. Two new versioned templates, spell-vote-batch and spell-prime-batch (v1), carry the shared steps of an executive vote, recorded once. spell-request keeps its own steps through the governance poll (s15) and then waits at the new s22_in_executive_vote (completed for every counted member when the vote batch's Atlas step is recorded). The release step publishes the two batch templates before spell-request.

    • Migration (TO_V14). removeStep s17, c16, s16, the s19 watcher, s19, the s20 watcher, s20 and s21, each moveTo: s22_in_executive_vote; addStep s22; addField s01 movedInFlags (optional, hidden). Removed values stay on each item in its migration audit (detail.removed).

      v13 step an item waits atv14 landing
      s17, c16, s16, the s19 watcher, s19, the s20 watcher, s20, s21s22_in_executive_vote
      every other stepsame step
      finisheddata-only
    • Batch records for every cycle. After the publications the release step builds the missing batch records (applications/main/src/services/batch-records.ts, pure rules in applications/spell-review/src/batches/build.ts): one vote batch per vote with members and one Prime spell batch per Prime with Prime Spell members, each at the furthest state all ready members share (conflicts listed), with deterministic ids (vote-<date>, prime-<date>-<prime>), so a re-run creates nothing twice. It is not inside the spell-request transaction (a publication only replaces its own template's instances); it reads only data the migration keeps on the items, so a failed build is repaired by running the release step again. A build refusal fails the release step.

    • Before deploying v14: (1) v13 is published; (2) the deployment access policy (access.json on the volume) lists spell-vote-batch and spell-prime-batch in the spell application's templateKeys (no new permission: until other seats hold spell:facilitate / spell:craft / spell:verify-spell, the EPL's spell:manage records every batch step); (3) a fresh read-only export restored into a local replica-set Mongo, then npm run templates:publish -- --dry-run: every spell-request process migrate or data-only, none close, no failures, and the batch records table with no refusals (review its conflicts). (4) Stage 2's screens ship with it: the Spell review screens still read the per-item vote steps until then.

  • spell-request v15 (record the strategic team's decisions on the strategic review page; Lex, 2026-10-19).
    • What changed. The strategic decision (s09) gains two optional fields, shown unless the item is held back: strategicComment ("Strategic team's comments (internal)", string-multiline) and strategicSourceLink ("Link to the strategic team's comments (optional)", string, the commented Google Doc). Both declare readPermissions: EPL_COMMENTARY_READERS, exactly as s08's eplComment (#137): the server withholds their values, their field history and the form fields from every read by a seat without one of those permissions (a Prime). No completion rule changes and no field key changes: Approved / Approved subject to… / Not approved are the existing decision and condition fields.
    • Migration (TO_V15). addField for each, no default: no item is asked for anything, nothing is filled, no item moves (tested over items at Prepare, at the decision undecided and Not approved, and at Communicate). The frozen v14 shape (c2a7d11a) is applications/spell-review/src/versions-previous.ts.
    • Before deploying v15, as for v9: npm run templates:publish -- --dry-run against a fresh read-only copy of production data; every spell-request process plans migrate or data-only, none close, no failures.
  • spell-request v16 (Unichain and OP Mainnet chain choices; the Nov 19 tracker sync, 2026-10-27).
    • What changed. s04_spell_item_intake.chain gains "Unichain" and "OP Mainnet" (changeField … existing: 'keep': additive, stored chains stay). Two Spark items imported from the CC tracker that morning (b28a2c3d…, 97f6462a…, at s07a) completed s04 with an empty chain because neither was a choice: v9's X-Layer case again, and without a default the publication would refuse them (required-value-missing).
    • Migration (TO_V16). changeField keep and addField(s04, chain, { notRecorded: true }): a completed s04 with no chain gets the not-recorded marker (a recorded chain is never touched; an item still at the intake answers itself), and the EPL sets the chain by hand after the deploy, through the item page or the application service. No item moves. The frozen v15 shape (be506458) is applications/spell-review/src/versions-previous.ts.
    • Before deploying v16, as for v9: npm run templates:publish -- --dry-run against a fresh read-only copy of production data; every spell-request process plans migrate or data-only, none close, no failures.
  • spell-request v17, spell-vote-batch v4 and spell-prime-batch v4: Not recorded (Adam, 2026-10-29). Design: applications/spell-review/docs/batch-records.md section 8. The app follows reality: a step that happened outside the app (or was bypassed) with no evidence is completed honestly as "Not recorded" by the EPL, with a reason, instead of a ticked box that states something false.
    • What changed. Each step the EPL acts on (spell-request s08–s15; every batch step a person records after the identity step) gains notRecordedReason (hidden, optional, string-multiline, writable only with spell:manage). The completion rule becomes, for each top-level part of its own rule, reason of 10+ characters || (no reason && <part>) (part by part, so a refusal still explains each requirement on its own), inside the item's holds (not included, back with the Prime), and each mandatory field there is asked for only while no reason is written. The watchers, identity steps, the Prime's forms, BA Labs' review and an item's In the executive vote are unchanged. The reason is locked once its step is completed (lockExpression: currentProcess.currentStep !== "<step>", Adam 2026-10-29): it is written only while the process waits at that step, so it changes again only after a reopen.
    • Platform. Authoring fields gain lockExpression, the one server-enforced write rule a field declares (compiled into the field contract's readOnlyWhen; readOnlyExpression stays presentation only), and the expression environment's currentProcess gains currentStep (the step the process waits at, "" when none). No other template declares a lock, so no other digest changes.
    • Migration (TO_V17, VOTE_BATCH_TO_V4, PRIME_BATCH_TO_V4). addField notRecordedReason on each of those steps (optional, no value): no process moves, closes or is given a value; finished ones migrate data-only. Frozen shapes: v16 d6d0efeb (applications/spell-review/src/versions-previous.ts), vote v3 fee68ea1 and prime v3 d86c8913 (applications/spell-review/src/batches/*-versions-previous.ts). Fingerprints: spell-request v17 c9609572, spell-vote-batch v4 cbdb1716, spell-prime-batch v4 f0e37be2 (2026-10-29T12:00Z).
    • Before deploying, as for v9: npm run templates:publish -- --dry-run against a fresh read-only copy of production data; every spell-request, spell-vote-batch and spell-prime-batch process plans migrate or data-only, none close, no failures.
  • spell-request v18: a decision before Communicate, and a No stops there (Adam, 2026-11-04, from the EPL session of 2026-11-03; the held-back outcomes and their attribution, Adam 15:53 and 15:57).
    • What changed. Prepare strategic review (s08) gains holdBackOutcome ("Approved", "Rejected" or "TBD"), shown and asked for (by the completion rule, not mandatory, like the reason) whenever the item is held back. Approval is approval by the relevant authority to go forward into the Executive Vote, the EPL or the strategic team; three outcomes only ("Routine — strategic approval not required" is Approved). Every item goes on to the strategic decision (s09), as in v17. s09 gains decidedBy ("EPL" or "Strategic team", hidden, written with the decision): the EPL's own Approved or Rejected completes s09 at once with the matching Yes or No and decidedBy "EPL" (the app: completeEplDecision / setHoldBack in applications/spell-review/src/ui/hold-back.ts, after Prepare on the item page, from the strategic review's rows, and over MCP), so the decision is completed, never skipped, and "by the EPL" and "by the strategic team" read apart. TBD and every item in the package wait at s09 for the strategic team's Yes or No (decidedBy "Strategic team"). s09 completes on her outcome or a recorded Yes or No, nothing else: v8's "not required" and v17's "Not recorded" are gone from it (NOT_RECORDABLE_EXCEPT; its notRecordedReason is removed); the conditions ask only about the strategic team's Yes. Her outcome prevails over anything left on s09 (APPROVED, and decisionOf / strategicLabel in applications/spell-review/src/ui/spell-items.ts: "Decision: Approved · EPL", "Decision: Rejected · Strategic team"). A No completes s09 and goes on to Communicate. Communicate (s10) sits behind the APPROVED gate (STEP_GATES in applications/spell-review/src/template.ts), in front of its own rule and of "Not recorded", so a No is conveyed there and goes no further; the app then takes it out of its cycle as "Not approved" (recordNotApproved in applications/spell-review/src/ui/spell-bulk.ts: the Communicate visit's update, then the routing step's v10 disposition), on the per-Prime communicate screen or the item page.

    • Migration (TO_V18). The pre-v18 held-back items in production all went forward on the EPL's recorded reason (read-only read, 2026-11-04 15:5x PT), except two still open (HELD_BACK_STILL_OPEN, by process id: the Spark SF/SAF December grants and the X Layer SLL + Morpho vault). So, deliberately relaxing v8's rule that a migration never writes a decision, for these items only (Adam's call): addField s08 holdBackOutcome with "Approved" for a completed s08 held back, "TBD" for the two (HELD_BACK_OUTCOME_DEFAULT, over processId, which migration expressions now see); addField s09 decision ("yes") and addField s09 decidedBy ("EPL") for a completed s09 of a held-back Approved item, decidedBy "Strategic team" for a completed s09 with a recorded Yes or No; removeField s09 notRecordedReason (to the migration audit; the item page reads a pre-v18 "Not recorded" decision from the field audit); the new completeStep op completes s09 for a held-back Approved item waiting there ("yes", "EPL") and moves it to s10, its open visit closing as completed by the migration (completeOpenVisit on the rebind), not abandoned; moveCurrentStep by expression (V18_LANDING). Every value written carries a note in the migration audit (HELD_BACK_OUTCOME_NOTE, DECISION_NOTE). No Yes or No is written for an item nobody decided. The frozen v17 shape (c9609572) is applications/spell-review/src/versions-previous.ts; fingerprint 5deee91e (2026-11-04T12:00Z).

      v17 state of an itemv18 landing
      at s08, in the package or held back (no outcome yet)s08; held back, Prepare now asks for the outcome
      at s09, not held back, undecided (or a Yes its conditions refused)s09
      at s09, not held back, a No recorded (parked there under v8–v17)s10 Communicate, where it is conveyed and stops
      at s09, held back (passed under v8 on Submit)Approved: s09 completed as the EPL's ("yes", "EPL"), then s10; TBD (the two): s09, for the strategic team's Yes or No
      at s10, held back ("not required" under v8)Approved: s10 (s09 gets "yes", "EPL"); TBD: back to s09, for a Yes or No by hand
      at s10, not held back, no Yes or No on s09 ("Not recorded" under v17)back to s09, for a Yes or No by hand
      at s10, not held back, a Yes or No on s09s10, decidedBy "Strategic team" (a No: conveyed, then taken out as Not approved)
      past s10 (s11 on), anysame step; a held-back s08 gets Approved (TBD for the two) and its s09 "yes", "EPL"; completed steps are never re-checked
      finisheddata-only (as past s10)

      Expected in production (read 2026-11-04): 15 held-back items past Communicate → Approved; at s10 the BUIDL-I instance and the OP Mainnet and Avalanche deprecations → Approved, stay; the Spark grants → TBD, back to s09; at s09 Claim SparkLend reserves → Approved, s09 completed, s10; X Layer → TBD, stays; the 13 at s08 are untouched.

    • Before deploying v18, as for v9: npm run templates:publish -- --dry-run against a fresh read-only copy of production data, and npm run migrations:dry-run -- --template spell-request --json: every process migrate or data-only, none close, no failures. Review every item whose currentStep is s09 or s10 against the table (its landing), and that the two TBD ids are still the open ones.

  • spell-request v20, spell-vote-batch v5 and spell-prime-batch v5: record only what someone waits on (Adam and Lex, 2026-11-16, walking through the 19 Nov and 3 Dec spells). Design: applications/spell-review/docs/batch-records.md section 9.
    • spell-request v20. Prepare strategic review's holdBackOutcome gains "Approved with modification" (Approved, Approved with modification, Rejected, TBD): the EPL approves an item on condition that it changes, written in the new holdBackModification, which the rules require for it to count (Prepare's completion, EPL_DECIDED, APPROVED; cleared by a send-back and by the app whenever another outcome is chosen). It is an approval everywhere: the strategic decision's Yes recorded as the EPL's, the Communicate gate (APPROVED), every reader (outcome "Approved with modification · by EPL", the route select, the journey, the communicate screen, MCP route / outcome). Migration TO_V20: changeField(s08, holdBackOutcome, keep) and addField(s08, holdBackModification) (optional, no value); no process moves, closes or is given a value.
    • spell-vote-batch v5. "Request to schedule" (v01), "Link items" (v02) and "Sky Core spell ready" (v05) are removed; "Executive Sheet confirmed" (v05_sheet_confirmed) is added after "Executive Sheet created": one step for the spell, with a toggle per Prime (confirmed<Prime>), a toggle for the Sky Core rows (confirmedSkyCore; Adam, 2026-11-17) and a hidden list of the parts with rows in the Sheet (primes: "Sky Core" when the spell has a Sky Core Spell item, then each Prime with items; written by the app when it opens the step: a rule cannot read other processes). Its rule asks for the list and every listed part's toggle, Sky Core's like the Primes'. A Core-only spell has exactly the Sky Core toggle; "none" is left for a spell with neither. Migration VOTE_BATCH_TO_V5: removeStep v01 and v02 moveTo v03 (the GovOps meeting); removeStep v05 moveTo the new step (a vote waiting there has its Sheet); addStep the new step, and moveCurrentStep(v06_watch_published → v05_sheet_confirmed): a vote already watching for its executive goes back to the new step (v4 never waited for each Prime's Sheet confirmation; the watcher is restart-safe and has recorded nothing). So does a vote waiting at Published with nothing recorded of the publication (the watcher gave up or was stopped, no vote page entered, no backfill note or "Not recorded" reason: UNPUBLISHED_AT_PUBLISHED, an expression moveCurrentStep; independent review, 2026-11-17). A vote at Published whose executive the watcher found or whose page was entered, or later, or finished, stays and never records the new step; the read model shows it "Not recorded", saying why, and reads each Prime spell's own record. The prime migration first records on each Prime spell's last step whether it completed "Sheet confirmed" (sheetConfirmedBeforeV5: not unticked, not "Not recorded", not backfill-closed; nothing for one closed or abandoned there). The release step then ticks, once per vote, on each vote the migration sent to the new step, those Primes (carrySheetConfirmations; one-shot: never after anyone wrote a toggle; its dry run reads the v4 records). The Sky Core toggle is never carried (Sky Core had no confirmation of its own before v5). A person submits the step. A vote past the step before v5 counts its Prime spells only.
    • Platform: read rules of earlier versions. v5 removes two internal fields (the request's note, the linked item list) whose values stay in each vote's field audit. project (every read) and the audit evidence now also apply the read rules of the presentations a process was on before (its migration audit's from/to presentations) to fields the pinned and latest presentations no longer declare, and fail closed when one is missing (a single read; a list row withholds every undeclared field instead, with an alarm, so one row never fails a list or the release step); a migration that would declare such a field again without a rule, or rename an internal field without one, is refused. The spell audit report's external filter does the same and its external mode fails closed (503) when the history cannot be read (reference/permissions.md). Without it a Prime's team would read those fields' history after the migration.
    • spell-prime-batch v5. "Sheet confirmed" (p03) is removed; External review + deployed is the last step, and its "External reviewer" (reviewer, optional until v4) is required (Lex; Adam, 2026-11-17: who externally reviewed the Prime spell, e.g. "Manuel" for Grove, "Sidestream" for Osero): mandatory, asked for only while no history-backfill note or "Not recorded" reason is written, and in the step's rule. addField(p02, reviewer, { notRecorded: true }): every Prime spell that completed the step without one (live, closed or finished) keeps its data and stays as it is, the field reading "Not recorded (predates this field)"; one waiting at the step is asked for it; a recorded name is kept. The batch build marks it too on a step it builds as done. Migration PRIME_BATCH_TO_V5: a Prime spell waiting at Sheet confirmed is finished (close, outcome superseded, every v5 step done, as v2 did for StarGuard executed); removeStep p03. The per-Prime confirmations already recorded stay in each Prime spell's migration audit; they are not copied to the vote (a migration reads one process only), so a vote moved to the new step starts with every toggle off.
    • Frozen shapes and fingerprints. v19 e1347a2b, vote v4 cbdb1716, prime v4 f0e37be2 frozen in applications/spell-review/src/versions-previous.ts and src/batches/*-versions-previous.ts; fingerprints spell-request v20 9db82a2d, spell-vote-batch v5 bfdc0eaf, spell-prime-batch v5 d1bbcca9 (2026-11-16T12:00Z; the two batch fingerprints taken again on 2026-11-17 for the Sky Core toggle and the required reviewer: v5 was never published, so it is amended in place, not renumbered).
    • Before deploying, as for v18: npm run templates:publish -- --dry-run against a fresh read-only copy of production data; every spell-request process migrate or data-only; every spell-vote-batch process migrate or data-only (check each vote's landing: v01/v02 → v03, Sky Core spell ready or the published watcher → Executive Sheet confirmed, anything else stays); every spell-prime-batch process migrate, data-only, or close only where it waits at Sheet confirmed; the carry pass's list of Primes per vote; the presentation check "all found"; no failures. Deploy process-platform (its start command runs the release step) before the spell-review frontend; if the release step fails, nothing changed for the failed template: fix and run it again promptly (the old build keeps serving until then).
  • spell-prime-batch v2 (#204; Adam 2026-10-08): "StarGuard executed" (p04_starguard_executed) is removed from the Prime spell batch; Sheet confirmed (p03) is its last step. Design: applications/spell-review/docs/batch-records.md section 3. Lineage: applications/spell-review/src/batches/versions.ts (v1 keeps its fingerprint 450abfea; the frozen v1 shape is prime-batch-versions-previous.ts).
    • Migration (PRIME_BATCH_TO_V2). close when the batch waits at p04_starguard_executed (every v2 step is done there, so it finishes: completed, outcome superseded with the reason), then removeStep p04_starguard_executed (its values go to the migration audit). No moveTo: nothing can still wait there after the close.

      v1 step a Prime batch waits atv2 landing
      p04_starguard_executedfinished (close)
      p01, p02, p03same step (Sheet confirmed now finishes it)
      finisheddata-only (StarGuard values to the audit)
    • Prime batch sharing (#202). After the batch build the release step shares every Prime spell batch with its member items' people and filers, and no one else (reconcileBatchSharing, through changeSharing as the release step with processes:read_all; idempotent; a refusal after three tries fails the step). The internal seats' writes that change membership keep it in step between releases (batch-records.md section 3). No access policy change.

    • Before deploying: a fresh read-only export restored into a local replica-set Mongo, then npm run templates:publish -- --dry-run: every spell-prime-batch process migrate, close (only those at StarGuard executed) or data-only, no failures; spell-request and spell-vote-batch up to date; the batch records all exists; and review the "Prime spell sharing (dry run)" lines.

    • Dry run (2026-10-08, the pre-v14 prod export of 21:56Z restored into a local replica-set Mongo; the v14 release from main 438bb655 applied to it first, which built the same 23 batch records as production with 0 refused and 0 conflicts): spell-prime-batch 16 instances on v1 450abfea: 7 migrate live (3 at p03_sheet_confirmed, 4 at p01_crafted, each landing where it was), 9 data-only (finished; the 3 Sept 24 batches move their implied StarGuard step to the audit), 0 closed (no batch waited at StarGuard executed in that copy), 0 failing; spell-request (83) and spell-vote-batch (7) up to date; batch records 23 exists, 0 refused, 0 conflicts; Prime spell sharing 0 changes (the v14 build already shared each Prime batch with its items' people). With one copied batch advanced to StarGuard executed by hand first: 6 migrate, 9 data-only, 1 close, 0 failing; committing that copy left all 16 on v2 a317ca3e, and a second run planned nothing. A Prime batch unshared on the copy was re-shared by the next run (1 change), then 0.

  • spell-vote-batch v2 (#206; Adam 2026-10-08): every Prime's team reads the vote's public part. Design: applications/spell-review/docs/batch-records.md section 3 ("The vote's public part"); the whitelist is on #206.
    • What changed. v00_vote gains publicView (hidden, optional): the in-vote items and Prime spells, whitelisted. Its history, and the values of v01.note, v02.itemIds, v03.notes and v04.sheetLink, are read by the internal seats only (presentation read rules: no execution change). The new field is the version's only execution change.
    • Migration (VOTE_BATCH_TO_V2). addField v00_vote publicView (optional, no value). Running batches stay where they are; finished ones migrate data-only. The release step's sharing pass then shares every vote batch with every Prime's team and writes the public view of every running one (a finished batch is not written: it keeps no view).
    • Platform. historyReadPermissions on presentation inputs (#206, reference/permissions.md). As with v6's choices, a build that predates it refuses the new registration: the previous build serving during the release step cannot read vote batches until the new build takes traffic (seconds to minutes; the vote page shows no record meanwhile).
    • Before deploying: as for spell-prime-batch v2, a dry run on a fresh copy: every spell-vote-batch process migrate or data-only, no failures, and review the "Vote batches" lines (sharing and public view per vote).
  • Withdrawn by Prime closes the item (Adam, 2026-10-12). No template version: the reason and its fields are v10's. The app closes an item when the EPL records "Withdrawn by Prime" (the platform's abandon, right after the reason is written). After the publications the release step closes any spell item still running with that reason recorded (closeWithdrawnItems in applications/main/src/services/withdrawn-items.ts, through abandon as the release step with processes:read_all, processes:write and processes:manage_all; idempotent; a refusal fails the step).
    • Before deploying: npm run templates:publish -- --dry-run on a fresh copy and review the "Withdrawn by Prime (dry run)" lines: each item it would close, with its cycle, step and who recorded the reason.
  • spell-vote-batch v3 and spell-prime-batch v3: the one-time history backfill (Adam, 2026-10-16). Design: applications/spell-review/docs/batch-records.md section 7. The records of the votes before 2026-10-15 that stopped short of their end although the vote executed (the 24 Sep record at Atlas updated; the 8 Oct record at Sky Core spell ready and its three Prime spells at Sheet confirmed) are closed once, honestly. Going forward a record that stops means someone skipped their step: it stays visible and is never closed this way.
    • What changed. Every person's step (v01–v05, v09; p01–p03) and every step vote.sky.money proves (v06, v07, v08 human steps) gains historyBackfill (hidden, optional, writable only with spell:history-backfill, a permission no deployment role grants). On a person's step a note is the completion rule's alternative (the step is closed without a record), and a mandatory field there (v04.sheetLink, p02.address) is asked for only while there is no note. The steps vote.sky.money proves keep their own rules (vote page, result: "passed", executed: true).
    • Migration (VOTE_BATCH_TO_V3, PRIME_BATCH_TO_V3). addField historyBackfill on each of those steps (optional, no value): every running batch stays where it is, every finished one migrates data-only; none closes.
    • The pass. After the publications and BEFORE the past-vote items pass, the release step closes them (finishPastVoteRecords in applications/main/src/services/past-vote-records.ts, planned by @processos/spell-review/extensions/past-vote-records) as the ProcessOS account (holding the backfill's grant for this pass), through enterManually (each watcher) and completeStep (each step), re-reading the record before each. The items pass then completes the vote's items in the same release.
    • Platform. Manual entry now also accepts an automatic step just entered and not yet dispatched (running, nothing pending, nothing in flight): before, a command that landed on a watcher had to wait for the worker's first look.
    • Before deploying: npm run release -- --dry-run on a fresh copy and review the "Past-vote records (dry run)" lines: each record it would close, from which step, each step with its evidence or "Not recorded" and the note, and the items the items pass then completes.
    • Dry run (2026-10-16, the 15:00Z production copy taken before #238 deployed, restored into a local Mongo): spell-vote-batch 7 instances on v2 a53ca87e: 4 migrate live (each landing where it was), 3 data-only, 0 closed, 0 failing; spell-prime-batch 17 on v2 a317ca3e: 8 migrate live, 9 data-only, 0 closed, 0 failing; spell-request 95 up to date. Past-vote records: 2 votes, 5 records to close: vote-2026-09-24 at Atlas updated (Not recorded); vote-2026-10-08 at Sky Core spell ready (Not recorded), Published, Passed and Executed from vote.sky.money, Atlas updated (Not recorded); prime-2026-10-08-grove, -osero, -spark at Sheet confirmed (Not recorded); then 9 items of 24 Sep and 15 of 8 Oct complete. Committing a replica-set copy of the same export closed all 5 and completed the 24 items in one run (exit 0); a second run planned nothing.