Skip to content

CI products: gate, approval, apply and run records go on the workspace ledger through chant, not product git writes #4551

Closed

Description

@lex00

terragucci writes its own gate, approval, apply and run lines to chant/lifecycle with raw git, and decides approvals with its own code. Ruling E (INTENTIUS/plywood#1) says these records belong in the chant workspace ledger, written by chant. Ruling F says both products use the same chant feature. Most of the storage exists already. This issue lists the ledger and API for each record, and the few pieces chant still lacks.

Read at chant ef5e494 and terragucci 83fac46. terragucci paths are under packages/terragucci/.

Audit finding covered

Finding 3. terragucci's appendLifecycle (src/apply.ts:586-611) builds commits with hash-object, commit-tree and push. It never resolves a member prefix (no _members or resolveMemberLedger anywhere in src/), so inside a workspace its lines land at the top of the branch, apart from the member's ledger chant writes. Gate logic is its own too: parseLedger (src/apply.ts:424), decideGate (:467), spendStanding (:2472), quorum (:3365-3460), and the pr-review record (src/review.ts:1-30). The op-waves spec passes only approvals: { spend: true } (src/chant-waves.ts:91) and ledger under pr-review (:77).

The ledger

The member's ledger on chant/lifecycle: the top of the branch at level 0, _members/<member>/ for a member, resolved by resolveMemberLedger (packages/core/src/lifecycle/member-ledger.ts:84). The table is in the workspace declaration reference, section Ledgers. Decision ws-068 keeps these ledgers as append-only ledgers read through the read contract (chant ledger, chant query).

Each terragucci write and its chant home

terragucci writes at chant ledger and API
wave pending facts and approvals _gates/tf-apply.jsonl (src/apply.ts:520, :570-580) gate ledger _gates/<op>.jsonl: appendPendingGate and appendGateResolution (packages/core/src/lifecycle/gate-ledger.ts:475, :460), read with readGateLedger / parseGateLedger (:528, :543). Op waves already write these.
applied and finished lines _gates/tf-apply/applied.jsonl AppliedGateRecord and FinishedGateRecord (packages/core/src/lifecycle/gate-applied.ts:25, :64, path :76), written by op waves through the port's appendApplied (packages/core/src/op/op-waves-run.ts:2484) under approvals.spend. isApprovalSpent (gate-applied.ts:140) replaces spendStanding.
the plan report beside a pending fact _gates/tf-apply/wave-<k>/<digest>.json (src/apply.ts:557, :3634) the change-set store _change-sets/<digest>.json: persistChangeSet and readStoredChangeSet (packages/core/src/lifecycle/change-set-store.ts:54, :109), under retention. The pending fact cites the digest. No new store.
migration proof, applied and done _gates/<migrate op>/…, done.jsonl (src/migrate.ts:88-90, :1597, :1642, :1658) gate ledger plus applied.jsonl / finished lines, as above
state export done _gates/<export op>/done.jsonl (src/export.ts:56, :314) gate ledger for the request and approval, applied.jsonl and a finished line for the export
state-lock release done _gates/<unlock op>/done.jsonl (src/unlock.ts:53, :417) same as export
ephemeral copy records chant's own _pr-envs/records.jsonl (src/ephemeral.ts:116, :612) chant's PR-environment ledger (packages/core/src/components/pr-environment.ts:54-55). chant exports only the parser (parsePrEnvRecords, :249), no append, so terragucci writes chant's file by hand.
module release records <env>/releases.jsonl (src/publish/ledger.ts:23, src/publish/index.ts:471, :587) release ledger: appendReleaseRecord (packages/core/src/lifecycle/release-ledger.ts:398)
agent runs _gates/agent-runs.jsonl (src/report/audit.ts:97, src/agent-record.ts:214) run ledger <env>/runs__<op>.jsonl: appendRunRecord (packages/core/src/lifecycle/run-ledger.ts:164)
overrides (through chant today) override ledger _gates/policy-override.jsonl: recordOverrideDenial and recordOverridesApplied (packages/core/src/lifecycle/override-ledger.ts:43, :50)

Gate decisions

terragucci chant
decideGate (src/apply.ts:467) decideGateApproval (packages/core/src/gate-decision.ts:496), evaluateGate (packages/core/src/op/gate.ts:799)
quorum, quorumSince and the rest (src/apply.ts:3365-3460) approvals.quorum (packages/core/src/op/op-waves.ts:56-60, packages/core/src/op/gate-quorum.ts)
its own pr-review record (src/review.ts:1-30) op waves' pr-review branch (packages/core/src/op/op-waves-run.ts:1938-1950) and approvals.reviewLedger (op-waves.ts:542)

Missing in chant (core, both products)

  1. Op waves append a run record per wave run to the run ledger with appendRunRecord. Today only the local executor does (packages/core/src/op/local-executor.ts:1776), so a wave apply leaves no runs__<op>.jsonl line.
  2. A pending fact can cite a stored change set by digest, so a refusal or a respond job reads the plans an approval was asked for.
  3. A gated request for an op that has no wave (export, unlock, ephemeral copy, migration): request, approve, applied, finished, all on the gate ledger, decided by decideGateApproval with the same quorum and pr-review rules. plywood needs it for plywood approve and plywood override outside waves.
  4. An exported append for _pr-envs/records.jsonl.
  5. Every write above takes the member prefix and honours --no-record.

None of this is engine-specific, so nothing goes to a lexicon.

Missing in terragucci

Pass pr-review and the quorum rules through the op-waves spec, write each record through the chant API in the table, and delete appendLifecycle, parseLedger, decideGate, spendStanding and the quorum code.

Acceptance

  • git grep -n "commit-tree\|hash-object" packages/terragucci/src finds no ledger writer.
  • In a workspace member, terragucci's records land under _members/<member>/, and chant ledger gates and chant ledger runs list them.
  • A wave decided under quorum or pr-review gives the same answer in terragucci and in a plain op-waves spec.

Related: #4530, INTENTIUS/terragucci#1280, #4545, INTENTIUS/plywood#1.

Activity

  1. added
    epic:ci-products
    epic:plywood
    on Oct 27, 2026
  2. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Design for the four ledger gaps (ci-products Wave 0). The record-by-record mapping in the body above is ruled and this builds on it. Paths are at origin/integration/ci-products (chant 3037bbe, terragucci 18f6431); chant paths are under packages/core/src/, terragucci paths under packages/terragucci/src/.

    Two things hold for all four and need no new code. Every chant ledger write resolves the member prefix from its cwd (lifecycle/git.ts:40-46, ledgerPrefixOf calls resolveMemberLedger), so a writer only has to run with cwd inside the member. --no-record and CHANT_NO_RECORD are enforced in the git layer (lifecycle/no-record.ts), so every writer below honours them once it goes through lifecycle/git.ts. The one wiring gap is chant run wave: its handler (cli/handlers/run-wave.ts:45) never reads args.noRecord (cli/registry.ts:757), so gap 1 adds it there the way cli/handlers/run.ts:1039 does.

    Every new floor below is export const <NAME>_FLOOR = NEXT_RELEASE; (release-floors.ts:22, now 0.124.55), so scripts/release-floors.ts resolves them at the next cut. terragucci stays green on its pinned chant 0.124.54 through the loader pattern it already uses in chant-next.ts:1-20: a @ts-ignored dynamic import() of the new subpath (reachable through the package's ./* export), undefined on an older chant, with today's code as the fallback.

    1. Op-wave run record

    Today only the local executor appends a run record (op/local-executor.ts:1776); runOpWave (op/op-waves-run.ts:1197) writes the outcome file and returns.

    Shape. The existing OpRunRecord (op/runtime.ts:119), written with appendRunRecord (lifecycle/run-ledger.ts:164) to <env>/runs__<spec.name>.jsonl, one line per chant run wave job, plus one optional field:

    wave?: {
      spec: string;            // the spec's name, e.g. tf-apply
      number: number;          // the wave the job was started for
      name: string;
      job: "wave" | "decide" | "share" | "group";
      share?: number; group?: string;
      digest?: string;         // the set digest decided or applied under
      exitCode: number;        // runOpWave's own code, kept raw
      outcome?: "held" | "stood-down";
      applied: string[]; failed: string[]; moved: string[];
      blocked?: Record<string, string>;
    }
    

    phases has one phase per wave the job walked (a rest wave walks several), named wave-<k>, and one step per run target: fn is the target, ok when it applied, fail when it failed, skipped when it moved, was blocked or waited. gate is set on a gated job with the wave's gate and the pending fact's timestamp. runOrigin and gitSha are filled as the executor fills them. id is minted; a job joins its pending facts on runOrigin and wave, since every job of one CI run shares the CI run id the facts carry (op/op-waves-run.ts:2026).

    Status, until chant#4553's table lands: exit 0 is ok, 3 is gated (or waiting when the gate asks a decision point), 5 and 6 are ok with wave.outcome set (the job applied nothing and nothing failed), and 1, 4, 7 and 8 are fail with failure.code command-failed, moved, denied or point-refused. wave.exitCode is kept raw so a reader can map it under #4553 once ruled.

    Writer. A new optional port on RunOpWaveOptions (op/op-waves-run.ts:610), runs?: { append(record: OpRunRecordInput): Promise<void> }, defaulting to appendRunRecord plus pushLifecycleReport (lifecycle/git.ts:897) over cwd. runOpWave calls it on every return path: the end (:1238), the two early returns (:1210, :1218) and the throw path (:1226). A failed write warns and never changes the exit code, as notifyOpWave does.

    Read contract. runs in chant query and chant ledger gains a wave JSON column (lifecycle/query.ts:73), filterable as --where wave.spec=tf-apply; runs.schema.json gains the optional wave object. Floor OP_WAVE_RUN_RECORD_FLOOR.

    terragucci. Nothing to call. Its waves run through the chant bin it installs (chant-waves.ts:1-20), so the record appears once that bin is at the floor and is absent before it, which is today's state.

    2. A pending gate that cites a change set

    An op wave binds a set digest (opWaveSetDigest, op/op-waves-run.ts:871), which is not a change-set document's digest, so the ledger keeps no plan an approval was asked for. terragucci fills the gap with its own file _gates/tf-apply/wave-<k>/<digest>.json (apply.ts:557, written at :3634, read at apply.ts:560 and approve.ts:198).

    Shape. PendingGateRecord (lifecycle/gate-ledger.ts:323) and GateResolutionRecord (:96) gain changeSet?: string, the digest of a document stored in _change-sets/ by persistChangeSet (lifecycle/change-set-store.ts:54). On a pull-request or release gate, whose planDigest already is a change-set digest, chant sets changeSet to the same value so readers use one field.

    Writer. OpWavePlansFile (op/op-waves-run.ts:170) gains changeSet?: ChangeSetDocument, the document the product composed with composeChangeSet. When the wave waits, chant stores it before the pending fact, the order writeCheckpoint already uses (op/gate.ts:119-124), through a new optional GateLedgerPort.storeChangeSet?(doc) that gitGateLedgerPort (op/gate.ts:154) implements with persistChangeSet. A document that fails its digest check is logged and the pending fact goes out without changeSet; it never blocks the gate. OpWaveDecision (:226) gains changeSet?: string so the decision record names it. chant approve copies changeSet from the standing fact onto the approval when the plans match, beside checkpointDigest and releaseDigest (cli/handlers/approve.ts:443-451). Retention keeps a stored change set that a pending fact or a resolution names in changeSet, beside today's planDigest rule (lifecycle/retention.ts:354).

    Readers. readStoredChangeSet(fact.changeSet) (lifecycle/change-set-store.ts:109) and chant change-set show <digest>, both existing. A refused wave reads the approved plans from the mismatched resolution's changeSet.

    Read contract. gates gains a change_set TEXT column (lifecycle/query.ts:75). Floor GATE_CHANGE_SET_FLOOR.

    terragucci. The plan callback puts the document report/build.ts:329 already composes into plans.json as changeSet. The feature-detect is chant's own output: when the wave's decision record (chant-waves.ts, readWaveRecord) carries changeSet, terragucci skips the write at apply.ts:3634; without it, it writes as today. approve.ts:198 and the respond job read the stored change set first and fall back to storedReport for facts written before.

    3. Gated requests for export, unlock, ephemeral and migrate

    terragucci runs each of these as its own request: a digest over the request (export.ts:123), a pending line with a request field (export.ts:267, unlock.ts:377, migrate.ts:1626), its own decideGate (apply.ts:467) and a done.jsonl beside the ledger (export.ts:314, unlock.ts:417, migrate.ts:1658) that no chant reader sees.

    Ephemeral needs no request kind. Its gate is chant's pr-env gate under op pr-<n>, run by components/pr-env-run; terragucci decides it with its own ports (ephemeral.ts:604-627) only because lifecyclePrEnvPorts (components/pr-env-ports.ts:53) cannot take a sealed approval mode. The design gives lifecyclePrEnvPorts an approval?: { mode: GateApprovalSource; signers?: GateSigners } option, decided with decideGateApproval (gate-decision.ts:496), and terragucci's ports use chant's decideGate. Its records are gap 4.

    For export, unlock and migrate, a new module lifecycle/gated-request.ts (subpath @intentius/chant/lifecycle/gated-request), with its pure decision in the gate-decision bundle:

    interface GatedRequest {
      kind: string;                    // "state-export", "unlock", "migrate"; plywood's "stack-export", "cancel"
      subject: string;                 // the gate: a root, a stack
      by: string; at: string;          // requester, ISO time
      fields: Record<string, string>;  // location, version_id, lock id, proof digest
    }
    gatedRequestDigest(req): string    // sha256 over sorted JSON of op, kind, subject, by, at, fields
    requestGate({ op, request, description?, expiry?, rules, base?, attachment?, cwd? })
      -> { status: "approved", digest, approval } | { status: "waiting", digest, command }
       | { status: "refused", digest, by, reason } | { status: "spent", digest, finished? }
    spendGatedRequest({ op, gate, digest, approval, runId?, commit?, cwd? })
    finishGatedRequest({ op, gate, digest, applied, result, detail?, cwd? })
    readGatedRequests(op, location?)   // each request joined with its approvals, applied and finished lines
    

    The records are the existing ones. The request is a PendingGateRecord in _gates/<op>.jsonl (gate is subject, planDigest is the request digest) with a new optional request field. The approval is a plain chant approve <op> <subject> --plan <digest> resolution, with no new verb; plywood approve and terragucci's approve export|unlock|migrate are words over it. spendGatedRequest appends an applied line to _gates/<op>/applied.jsonl (lifecycle/gate-applied.ts:25, :76) and throws unless it was pushed, as op waves require of a spend (op/op-waves-run.ts:1851). The caller acts only after that. finishGatedRequest appends a finished line (:64), which gains detail?: Record<string, string | number | boolean> for the product's flat facts (content_digest, a lock id, version ids before and after), never a state's contents. A request applies once: a spent approval (isApprovalSpent, :140) makes requestGate answer spent.

    attachment covers migrate's proof (migrate.ts:1597, keptPath): chant writes it once to _gates/<op>/requests/<digest>.json before the pending fact, as checkpoints sit at _gates/<op>/checkpoints/ (lifecycle/gate-checkpoint.ts:72), and the proof's digest goes in fields.proof.

    Decision rules. rules is { mode: "ledger" | "pr-review" | "sealed", quorum?, reviewLedger?, involved? }, the same block op waves read at base (op/op-waves.ts:530-545, op/op-waves-run.ts:566), read by the caller at base. Quorum targets match against subject. The workspace's identity.gates rule and judge come through the port as for any gate (op/gate.ts:105, :113). Two defaults I took: an approval by the requester never counts (terragucci's export rule, and plywood needs the same), and under pr-review a request counts ledger approvals only, since a request made from a laptop has no merged pull request whose review could approve it. A migration run inside a wave keeps going through the wave's hold hook (chant-waves.ts, the migration gate hook), which chant already decides; only the standalone path moves here.

    Read contract. gates gains a request JSON column. Applied and finished lines are covered by question C. Floor GATED_REQUEST_FLOOR.

    terragucci. export.ts, unlock.ts and the standalone path in migrate.ts load gated-request through the chant-next.ts loader. When it resolves they call requestGate, spendGatedRequest and finishGatedRequest; otherwise they run today's code. report/audit.ts:85, :88 read the legacy done.jsonl files and the new finished lines, so history from before the switch stays listed. No legacy line is rewritten or copied: the ledgers are append-only, and a copied line would count an export twice.

    4. Append API for _pr-envs/records.jsonl

    chant appends these lines only inside lifecyclePrEnvPorts.appendRecord (components/pr-env-ports.ts:63), which swallows errors, and exports only the parser (components/pr-environment.ts:249). terragucci writes chant's file with raw git (ephemeral.ts:612), at the top of the branch even inside a member.

    Shape. PrEnvRecord as it is (components/pr-environment.ts:208).

    Writer. A new module components/pr-env-ledger.ts that imports only lifecycle/git.ts, so a product bundle loads no Ajv or component driver:

    appendPrEnvRecord(record: PrEnvRecord, opts?: { cwd?: string }): Promise<{ commit: string; record: PrEnvRecord }>
    readPrEnvRecords(location?: LedgerLocation): Promise<PrEnvRecord[]>
    

    appendPrEnvRecord refuses a record parsePrEnvRecords would skip (a PrEnvRecordError), appends with appendLedgerLine (lifecycle/git.ts:574) under the member prefix, and does not push; the caller calls pushLifecycleReport, the two-step shape every ledger here uses. lifecyclePrEnvPorts.appendRecord becomes a call to it and keeps its warn-and-continue behaviour.

    Read contract. Question C. Floor PR_ENV_APPEND_FLOOR.

    terragucci. ephemeral.ts:612 calls appendPrEnvRecord when the loader resolves and appendLifecycle otherwise. LEGACY_EPHEMERAL_DONE (ephemeral.ts:118) is still read first.

    Docs that change with the build

    The Ledgers table in the workspace declaration reference gains _gates/<op>/requests/. The read contract page and cli/ledger.mdx and cli/query.mdx gain the new columns (and tables, per question C) with their floors. The op-waves page gains the run record and changeSet in the plans file.

    Open questions

    A. Which <env> directory does an op-wave run record go under?
    a. The spec's new optional labels.Env, else local, the rule every Op already follows (lifecycle/run-ledger.ts:58) (recommended). One rule for every run, and chant ledger runs --where op=tf-apply finds them with no loader change.
    b. A fixed waves directory. Easy to find, but it looks like an environment named waves to every env reader.
    c. Each run target's own environment, one line per target. Needs the product to map targets to environments, which only terragucci's environments config does.

    B. Who computes a gated request's digest?
    a. chant, with gatedRequestDigest over the canonical request (recommended). terragucci and plywood bind the same fields the same way, and chant approve can show exactly what the digest covers. Requests pending at the switch (48 hours at most) are asked again.
    b. The product passes its own digest. Pending requests survive the switch, but chant cannot show what an approval binds, and each product can bind different fields.

    C. How do the read contract and chant ledger show applied, finished and pull-request environment lines?
    a. Two new tables within contract version 1, applies (each applied or changes line under _gates/<op>/applied.jsonl joined with its finished line, including detail) and pr_envs (_pr-envs/records.jsonl), each behind its floor (recommended). The tables are additive, and the acceptance item "chant ledger lists them" holds for every record in the mapping.
    b. Fold applied and finished lines into gates as two more kind values. That changes what kind holds, so it is contract version 2.
    c. No new tables; readers use gate-audit and the products' own reports. No contract change, but the audit trail stays outside chant ledger and chant query.

    D. How many run records does a wave write?
    a. One per chant run wave job, with one step per run target (recommended). Every job writes its own line with no coordination, and a deciding job and its share jobs join on wave.digest.
    b. One per run target. Easier to join with a root's history, but a 400-root wave writes 400 lines per job.
    c. One per wave across all its jobs. Needs a last job that knows the others finished, which independent share jobs do not have.

  3. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Ruling for ci-products (2026-10-27)

    • A. Op-wave run record directory: labels.Env, else local, the rule every Op already follows (run-ledger.ts:58).
    • B. Gated request digest: chant computes it (gatedRequestDigest over the canonical request). Requests pending at the switch are asked again.
    • C. Read contract: two new tables, applies and pr_envs, within contract version 1, each behind its floor.
    • D. Run records per wave: one per chant run wave job, with one step per run target; jobs join on wave.digest.
  4. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Built on integration/ci-products, merge f0bec58 (unit branch unit/cp-chant-4551, commit 3ab5562), per the 2026-10-27 ruling: run records under labels.Env else local, chant computes the request digest, applies and pr_envs tables in contract v1 behind floors, one run record per chant run wave job. Paths are under packages/core/src/.

    1. Op-wave run record
    • runOpWave (op/op-waves-run.ts) records one run per job on every way it ends, the throw path included, through a new runs port (gitOpWaveRunPort: appendRunRecord then pushLifecycleReport). A failed write warns and never changes the exit code. A caller that passes its own gates port records nothing unless it also passes runs.
    • opWaveRunRecord builds it: one phase wave-<k> per wave walked, one step per run target (ok applied, fail failed, skipped otherwise), gate or point while waiting, failure for 1, 4, 7 and 8 (command-failed, moved, denied, point-refused), status by Exit codes: one table in chant core for both products, mapped by the terraform and pulumi lexicons, with moved distinct from gated #4553's table. OpRunRecord.wave (op/runtime.ts) carries spec, number, name, job, share or group, digest, exitCode, outcome and the run lists; parseRunLedger drops a malformed one. Floor OP_WAVE_RUN_RECORD_FLOOR.
    • The spec takes optional labels (op/op-waves.ts); Env picks the directory.
    • chant run wave reads --no-record and CHANT_NO_RECORD (cli/handlers/run-wave.ts). The logic is inlined there rather than imported from run.ts, so the wave-job runtime bundle does not pull run.ts in.
    1. A pending fact cites a change set
    • The plans file may carry changeSet. The deciding job stores it through the new GateLedgerPort.storeChangeSet (persistChangeSet) before any pending fact, and the three settle paths put changeSet on the fact. A document that fails its digest check is logged and left out. OpWaveDecision.changeSet names it.
    • PendingGateRecord.changeSet and GateResolutionRecord.changeSet (floor GATE_CHANGE_SET_FLOOR). chant approve copies it from the standing fact when the plans match. decidePrGate and the release gate in components/driver.ts set it to their plan digest. Retention keeps a cited change set while its fact stands.
    1. Gated requests
    • lifecycle/gated-request.ts (new): requestGate answers approved, waiting, refused or spent. spendGatedRequest throws unless the applied line was pushed. finishGatedRequest writes detail on the finished line. readGatedRequests returns each request joined with its approvals, applied and finished lines. The requester's own approval never counts, and that is the only meaning of refused: an approval stands and does not count, and the request still waits. attachment is stored at _gates/<op>/requests/<digest>.json and its SHA-256 goes in fields.proof. pr-review counts ledger approvals only.
    • lifecycle/gated-request-digest.ts (new, pure): gatedRequestDigest and gatedRequestOf, re-exported from @intentius/chant/gate-decision. Floor GATED_REQUEST_FLOOR.
    • lifecyclePrEnvPorts takes approval: { mode, signers? } and decides with decideGateApproval.
    1. PR environment ledger
    • components/pr-env-ledger.ts (new): appendPrEnvRecord, which refuses a record the parser would skip and does not push, and readPrEnvRecords. lifecyclePrEnvPorts.appendRecord calls it and still warns and continues on failure. Floor PR_ENV_APPEND_FLOOR.

    Read contract (lifecycle/query.ts, ledger-read.ts, workspace/ledger.schema.json): runs.wave, gates.change_set and gates.request columns (LEDGER_WAVE_COLUMNS_FLOOR), and new applies and pr_envs tables (LEDGER_APPLIES_FLOOR). All floors are NEXT_RELEASE, and the docs and schema texts are listed in scripts/release-floors.ts. The check passes with --release 0.124.55.

    Docs: guide/op-waves (changeSet in the plans file, a run record section, exit 8 in the table), cli/query, cli/ledger, reference/workspace-declaration (Ledgers rows), and reference/workspace-read-contract (two rows; the ci-run-index exit row now says 4 for a moved plan).

    Tests: op/op-waves-run-record.test.ts, lifecycle/gated-request-ledger.test.ts and components/pr-env-ledger.test.ts. Only typecheck ran. The suites wait for epic-ready, and none of the acceptance boxes is ticked.

    Still missing

    • terragucci's side (terragucci#1282): the plans file changeSet, gated-request behind its chant-next.ts loader, appendPrEnvRecord, deleting appendLifecycle and the rest. ephemeral.ts can now use lifecyclePrEnvPorts({ approval }).
    • --where wave.spec=... depends on chant ledger's existing JSON-column filter; no new filter code was added.
    • Retention keeps a cited change set only while the pending fact stands. An approval's changeSet does not hold it longer, which matches the existing planDigest rule.
    • Risk for the suites: op-wave tests that call runOpWave without a gates port now also write a run record to chant/lifecycle in their scratch repos. Any test that counts lifecycle commits or files there will need updating at epic-ready.
  5. lex00 commented on Oct 27, 2026

    @lex00
    ContributorAuthor

    Merge 65c3e52 on integration/ci-products reworded the ci.reportUrl paragraph and the ledger path rows in docs/src/content/docs/reference/workspace-declaration.mdx so the docs prose lint passes. No meaning changed and the baseline is untouched.

  6. lex00 commented on Oct 28, 2026

    @lex00
    ContributorAuthor

    Epic-ready fix, merged into integration/ci-products at 9f00e0b (unit/cp-chant-fix-bundles).

    lifecycle/gated-request-digest.ts took sortedJsonReplacer from utils.ts, which imports AttrRef, so the gate-decision bundle took in attrref.ts and went over its 58 KB limit. The replacer moved to packages/core/src/sorted-json.ts, which has no imports. utils.ts re-exports it, so its other importers are unchanged. gated-request-digest.ts imports the leaf. The gate-decision bundle is now 56985 bytes, and its list names gated-request-digest.ts and sorted-json.ts.

  7. lex00 commented on Oct 28, 2026

    @lex00
    ContributorAuthor

    The pr handlers' chant/lifecycle pushes now fetch, replay and retry, on chant main 4073bb3 (merge of unit/cp7-chant-lifecycle-retry, 972a99d). Push CI green: chant — main 40786841659, docs 40786842035, chant-ci-green 40787640830. This is the proposed feature from INTENTIUS/plywood#22 (the record job's failed to push some refs on chant/lifecycle, refused as stale info).

    • pushLifecycleRebasing in lifecycle/git.ts: on a stale refusal it fetches the remote's chant/lifecycle into a scratch ref and replays this checkout's commits on that tip with git merge-tree --write-tree --merge-base=<parent>. Each replayed commit keeps its author and message, and nothing touches a work tree. The function then points the lease at the tip and pushes again, up to LIFECYCLE_PUSH_TRIES (3) pushes, the count publishRef in snapshot-store.ts uses. After the last refusal, or a commit that changes a file the other writer changed too, it throws LifecyclePushLostError, which names the remote and the tries. No remote, recording off and other git refusals (no network, no credentials) come back the way pushLifecycleReport returns them, which is unchanged for its other callers.
    • cli/handlers/pr.ts: pr-record's merge record, the green-apply record (pr-apply --green and the wave path), the push before --merge auto and the change set the gate binds go through it. A lost merge record or green-apply record prints the error and exits 1 after the report is written; it used to warn and exit 0. A lost push before --merge auto leaves the pull request unmerged (mergeAfterApply refuses and posts why) and exits 1 instead of 3. A lost change set stops the stage.
    • Tests: lifecycle/git.test.ts runs against a bare remote. In one test another writer advances it between the record job's checkout and its push: the single push refuses, pushLifecycleRebasing lands, both writes are on the remote, the record's commit sits on the other writer's with its own message and author, and the lease names the new tip. A conflicting write throws the named error and keeps the local branch. A remote whose update hook refuses every push throws after three tries. cli/handlers/pr-record.test.ts covers exit 0 when the retrying push lands, and exit 1 with the error text when it throws; the report is still written. The other pr handler tests stub the new push the way they stub the old one.
    • Checks: the touched suites passed (pr handlers, git, snapshot-store: 254), and so did the bundle tests (pr-loop, pr-env-run, gate-audit, ledger-readers, gate-resume-plan, bundle-decoupling). Neither the pr-loop nor the pr-env-run bundle takes in lifecycle/git.ts, so their module lists and ceilings are unchanged. tsc --noEmit on packages/core reports no error in core sources; the errors left are the ungenerated lexicons of a fresh checkout, the same as before. Docs: one sentence pair in guide/pull-request-ci.mdx on what the record job does. Prose lint showed no regressions (1693 against the baseline of 1694), and the baseline is untouched.

    Still open: the bench smoke on plywood#22 has not run this push path, because the bench was not started (disk).

  8. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    plywood#22 finding 9 is on chant main in dec10dc (merge of unit/cp9-chant-queue; bab34db followed with a test timing fix). Push CI on bab34db: chant — main 40799516512 success, docs — main 40799516511 success, chant-ci-green 40799904830 and 40800190876 success. The first push's chant — main 40798720083 failed in shard 3 on that test alone; the other shards passed.

    • The waves run's run record (gitOpWaveRunPort, packages/core/src/op/op-waves-run.ts), its release records (maybeRecordAutoRelease, packages/core/src/components/auto-release.ts) and the gate lines (gitGateLedgerPort in packages/core/src/op/gate.ts: pending, resolution, applied and finished) push through pushLifecycleRebasing. A run or release record whose push never lands after its replays fails the job by name (LifecyclePushLostError). A gate line that never lands reports not pushed with that name, so the spend line still fails the wave.
    • The replay (rebaseLifecycleOnRemote, packages/core/src/lifecycle/git.ts) now carries a commit that only appends lines to .jsonl ledger files onto the other writer's copy of those files (replayAppends). Without this, two wave jobs appending to one environment's <env>/pulumi-up.jsonl or releases.jsonl met in merge-tree and one record was lost. Any other change to a file the other writer changed is still refused by name.
    • Read side: a fetch that finds the local chant/lifecycle diverged replays its unpushed commits onto the remote's tip and reports ahead (fetchLifecycleStatus), so requireLifecycleLedger reads on. A branch that shares no history with the remote, or whose commits cannot be replayed, stays diverged and is refused as before.

    Tests with a bare remote advanced by another writer: two writers appending to one releases.jsonl, a diverged read replayed then pushed, a rewrite still diverged (packages/core/src/lifecycle/git.test.ts), and a waves run record landing after another writer appended to the same run ledger (packages/core/src/op/op-waves-ledger-lock.test.ts). The #2310 gate test now expects the third pending fact to land beside the other writer's.

  9. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    Close-out (2026-10-29)

    Chant side is on main: f0bec58 (op-wave run record, pending gate citing a stored change set, gated requests, pr-env ledger append, applies and pr_envs tables), 4073bb3 (pr handler pushes fetch, replay and retry), dec10dc (waves ledger pushes replay and retry). No box is ticked.

    Open: terragucci origin/main (bce2a73d4) still has ledger writers built on hash-object and commit-tree (packages/terragucci/src/apply.ts:673, apply-rows.ts:216, chant-waves.ts:186, plus shell in render.ts), so box 1 fails. Boxes 2 and 3 depend on terragucci writing through chant's API and are unconfirmed. The issue stays open for terragucci#1282.

  10. lex00 commented on Nov 2, 2026

    @lex00
    ContributorAuthor

    Closing per the close-out comment of 2026-10-29 above: the work is on main and released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:ci-productsepic:plywood

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions