Skip to content

Op waves: control-repo dispatch after the last wave, and cross-stack edge marks in the note #4617

Closed

Description

@lex00

plywood#18 (merge c9ccfcd270b79f5bca8d7e621ff91854d6a54617) found that chant#4568's prLoop.control adds the control-repo dispatch only to the pull-request loop's own apply. Products that apply on merge through op waves (plywood, terragucci) have no way to tell the control repo a member applied.

Done when: op-waves specs take a control option and the github, gitlab and forgejo op-wave generators emit a dispatch job that runs after the last wave applies, carrying the real apply outcome, with the same token handling as chant#4568; the PR note marks cross-stack edges as stale, current or unknown from the control entries; generator tests for each forge.

plywood and terragucci switch behind feature-detects.

Filed for the ci-products session (2026-10-27)

Activity

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

    @lex00
    ContributorAuthor

    Merged to integration/ci-products at 8ef09c1 (unit branch unit/cp-chant-4617, commit 2c6f4dd). Compile checks only: npm ci, scripts/ci-lexicon-artifacts.sh --steps generate,bundle and npx tsx scripts/typecheck.ts pass on the merged tree with no regressions, and the docs prose lint shows 0 regressions. Tests are written and were not run; they wait for epic-ready.

    The control option on op waves

    • OpWavesSpec.control (packages/core/src/op/op-waves.ts) takes the pull request loop's control settings (ControlSettingsInput) plus sentCheck and markSent. member is required, since a spec has no repository name to default it to. assertOpWavesSpec checks it with opWavesControlProblems. OP_WAVES_CONTROL_FLOOR (NEXT_RELEASE) is the name a product feature-detects on @intentius/chant/op/op-waves.
    • chant run wave --spec <file> --waves-outcome adds up every wave job's outcome file under .chant/op-waves/<name>/outcomes and prints one word: applied, partial, unchanged, waiting or failed (applyOutcomeOf in packages/core/src/control/applied.ts). --json prints the counts too. It is in the wave runtime as well.
    • GitHub and Forgejo (lexicons/github/src/components/generate-op-waves-pipeline.ts; Forgejo through its dialect): a control-dispatch job needs the last wave's applying jobs with if: !cancelled(), so a failed run does not stop it. It downloads every outcome artifact, runs --waves-outcome through the product's bin into CHANT_CONTROL_OUTCOME, then sends one dispatch for ${{ github.sha }}. Only the dispatch step maps secrets.<tokenSecret> into CHANT_CONTROL_TOKEN, and curl reads it on stdin (controlDispatchScript from CI core: the control repo (cross-repo dispatch, project records, reconcile) for terragucci and plywood #4568, bb599f2). markSent adds statuses: write.
    • GitLab (lexicons/gitlab/src/components/generate-op-waves-pipeline.ts): a control stage after the waves, and its job needs the last wave's jobs, whose artifacts hold every outcome file. The setup and the outcome run in a subshell that unsets the control token variables, then the dispatch runs with $CI_COMMIT_SHA. Every wave job, the resume job and the record-plans job start with unset CHANT_CONTROL_TOKEN CHANT_CONTROL_READ_TOKEN <tokenSecret> <readTokenSecret>. A last wave whose runs failed (exit 1) lets the job run. A wave waiting at its gate stops it with the waves, and it runs once the retried job carries on.
    • The dispatch carries the outcome: client_payload.outcome on GitHub, inputs.outcome on Forgejo, variables[CHANT_CONTROL_OUTCOME] on GitLab (packages/core/src/control/dispatch.ts). The pull request loop's dispatch is unchanged and carries none.

    The control repo's side

    • generateControlPipeline passes the outcome to the step, and the Forgejo and GitHub workflows gain an outcome input. The step checks it against the five words, records a dispatch that carries one, and runs chant workspace run --dependents-of only after applied or partial (or no outcome, as before).
    • The record is a control-applied line of _control/applied.jsonl on the control repo's chant/lifecycle, beside the entries: member, op, sha, outcome, at and a digest over the rest (recordControlApplied, parseControlApplied, latestControlApplies). The step calls recordControlAppliedFromEnv from the control repo's own install through a node -e feature-detect, which also pushes the branch. A chant without it says so and records nothing, and a failed record or push is a warning, never the job's failure. The GitHub workflow now asks for contents: write and the full history. GitLab gets GIT_DEPTH: "0", and its notes say the job token needs push access.
    • Exported from @intentius/chant/ci-control with CONTROL_APPLIED_FLOOR (NEXT_RELEASE).

    Cross-stack edges in the note

    • pulumi-up's artifact gains stackReferences.lastUpdate, the export's deployment.manifest.time (lexicons/pulumi/src/pulumi-up.ts).
    • PrReport.crossStackEdges (PR_REPORT_CROSS_STACK_FLOOR, schema and read contract row): one entry per outside reference from the plans' artifacts (crossStackReadsOf in packages/core/src/components/pr-run.ts), with member, stack, lastUpdate, status, owner, ownerApplied and why.
    • markCrossStackEdges (packages/core/src/control/edges.ts) finds the owner among control entries whose estates hold the stack: the exact name, or the same <project>/<stack> once an org is dropped. A bare stack name only matches exactly. It then reads that project's newest applied or partial record, keyed by the entry's settings.member, else the repository's name. stale means the owner applied after the reader's last update and current means the reader updated after it. Every other case is unknown with its reason: not read, unclaimed, claimed twice, no apply on record, or a reader that has not updated.
    • The plan job marks every edge unknown. postPlanReport (and pr-plan's own publish) marks them again from the checkout CHANT_CONTROL_DIR names, using only each edge's reader, stack and last update from the report. That way a mark the report wrote itself never shows. The note gets a table under the member table and a line naming the stale edges (packages/core/src/pr-loop.ts).
    • The control_entries table from Read contract: a control_entries table for control-repo entries #4593 (a00670c) reads the same entries. I read them through readControlEntries with lenient, so a broken line leaves the rest marked.

    Docs: guide/op-waves ("Tell the control repo"), concepts/ci-products (the op waves dispatch, the record, "Cross-stack edges"), cli/run (--waves-outcome), reference/workspace-read-contract.

    Tests written, not run: packages/core/src/control/applied.test.ts, packages/core/src/control/edges.test.ts, and generate-op-waves-pipeline.control.test.ts in each of the github, gitlab and forgejo lexicons. The control workflow test in lexicons/github/src/components/generate-pr-pipeline.control.test.ts was updated for the new input.

    Still missing

    • No generated job checks out the control repo for the note. A product sets CHANT_CONTROL_DIR in its note job (terragucci already clones it in controlCheckoutStep; plywood needs the same step), and until then every edge is unknown.
    • plywood and terragucci switch behind feature-detects. plywood#18's follow-up does that for plywood.
    • Every check that needs a run waits for epic-ready: a dispatch reaching a loopback control repo with its outcome, the record pushed, a note marking a stale edge. No box is ticked.

    Defaults I took

    • The dispatch goes for every outcome, failed and waiting included. The control repo records each one and runs dependents only after applied or partial, so its record shows a member that tried and applied nothing.
    • The apply records live in their own file beside the entries, which keeps the entries' version chain about settings alone.
  3. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    Close-out (2026-10-29)

    On main: 2c6f4dd (op waves: control-repo dispatch after the last wave, and cross-stack edge marks in the note), merged at 8ef09c1. Checked against origin/main: OpWavesSpec.control and OP_WAVES_CONTROL_FLOOR, chant run wave --waves-outcome, a control-dispatch job in the github and forgejo op-wave generators and a control stage in gitlab's, the outcome carried in the dispatch (control/dispatch.ts), recordControlApplied on the control repo's side, PrReport.crossStackEdges with markCrossStackEdges (control/edges.ts), and stackReferences.lastUpdate in pulumi-up. Tests: generate-op-waves-pipeline.control.test.ts in each of the github, gitlab and forgejo lexicons, control/applied.test.ts and control/edges.test.ts.

    The issue has no boxes. Left to the products: a note job that sets CHANT_CONTROL_DIR (until then every edge reads unknown), and plywood and terragucci switching behind the feature-detect. Closing.

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