You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CI core: the control repo (cross-repo dispatch, project records, reconcile) for terragucci and plywood #4568
terragucci holds the control repo today. Under the placement rule (chant#4530, docs concepts/ci-products) it is shared capability, and plywood needs it for plywood#18.
terragucci's pieces, at origin/main:
packages/terragucci/src/control-repo.ts: a member's dispatch after a default-branch apply (repository_dispatch, GitLab pipeline trigger, Forgejo workflow dispatch), and the control repo's pipeline running chant workspace run --dependents-of <member> --op <op>.
packages/terragucci/src/control-records.ts: projects and shared defaults as control-entry workspace records, read and written through chant workspace records.
packages/terragucci/src/reconcile.ts: bring each project's pipeline in line with the records; dry run by default, --mode apply opens a pull request per project and never writes a default branch.
Placement:
chant CI core: the dispatch for each forge, the control-entry record kind, and reconcile over the product pipeline (chant#4550), taking each product's generator as input.
products: the words, the project settings each product writes, and their docs. terragucci's Terraform provider for the control repo stays in terragucci.
Order: after chant#4550 and chant#4554. terragucci moves onto it under terragucci#1282; plywood uses it in plywood#18.
Landed on integration/ci-products: merge bb599f2 (unit branch unit/cp-chant-4568, commit b648b62). It builds on #4550 (words, productStatusContext, the pull request loop options), #4554 (forge clients with defaultBranch) and #4551 (records on the ledger). Typecheck and the docs prose lint pass on the merged tree with no regressions. No tests were run.
Files:
packages/core/src/ci-control.ts, the entry @intentius/chant/ci-control, with CI_CONTROL_FLOOR = NEXT_RELEASE
packages/core/src/components/pr-pipeline.ts: a control option on PrLoopPipelineOptions
lexicons/github/src/components/generate-pipeline.ts and lexicons/gitlab/src/components/generate-pipeline.ts: the control-dispatch job (Forgejo gets it through the github generator)
lexicons/{github,gitlab,forgejo}/src/components/control-pipeline.ts: generateControlPipeline for the control repo's own file
docs/src/content/docs/concepts/ci-products.mdx: a control repo section
Dispatch per forge. resolveControlTarget(settings, fallbackMember) takes { repo, op, forge?, member?, tokenSecret?, readTokenSecret?, ref?, apiBase? }, checks it with controlSettingsProblems (terragucci's rules), and settles the forge from the host. controlDispatchRequest(target, { member, op, sha }, words) builds one request: POST /repos/<path>/dispatches with event type <product>-applied on GitHub, POST /projects/<id>/trigger/pipeline with CHANT_CONTROL_MEMBER, CHANT_CONTROL_OP and CHANT_CONTROL_SHA on GitLab, and POST /repos/<path>/actions/workflows/<product>-dependents.yml/dispatches on Forgejo. Two senders use it. dispatchControl sends it in process for a product's bin, and controlDispatchScript is the generated step. The step reads the token from CHANT_CONTROL_TOKEN and pipes it to curl on stdin (-H @-, or --form token=<- on GitLab). terragucci's script put it in curl's argv. sentCheck and markSent take the product's shell lines for the idempotency mark terragucci does with terragucci post sent and post status. controlStatusContext(words) gives <product>/control.
Generated jobs. With prLoop.control = { target, sentCheck?, markSent? } and applyOnMerge (or a wave gate), the GitHub, Forgejo and GitLab pipelines add a control-dispatch job that needs the last apply job and runs on the green path. The applied commit is the last wave's green-sha (GitLab: $GREEN_SHA), else the green commit. On GitHub and Forgejo the product's secret is mapped into CHANT_CONTROL_TOKEN for that one step. On GitLab a CI/CD variable reaches every job, so the plan job's script unsets CONTROL_TOKEN_VARS and the product's two secret names along with the forge tokens. The control repo's file comes from generateControlPipeline({ words, image?, command? }) in each forge lexicon, built from controlPipelineSpec. It runs npx --no-install chant workspace run --dependents-of "$member" --op "$op" --json after checking both names, one member at a time.
Control-entry records. They are lines of _control/entries.jsonl on the control repo's chant/lifecycle, appended through appendLedgerLine under the member prefix. No product git writes are involved. Each line is one version of one entry (version, kind: control-entry, id: ctl-NNN, entry: project|defaults, project, state: active|retired, settings, estates, product, at, by?, prev, digest). prev names the digest it replaces, so putControlEntry(..., { expect }) refuses a raced write (ControlEntryConflict) and a reader catches a broken chain. The API is readControlEntries(port, { validate }), putControlEntry, retireControlEntry, importControlConfig, controlConfig and estateClaims, with gitControlLedger({ cwd }) as the port. The product's validate checks its own settings. As with every ledger, nothing pushes; call pushLifecycleReport after.
Reconcile. reconcileProjects(projects, { mode, words, generate, env, git?, forgeFor?, fetch? }) clones each project and calls the product's generate(dir, { key, name, forge, settings, dryRun }). A dry run reports. An apply pushes <product>/pipeline and opens a pull request against the forge's default branch, or edits the open one. It never writes a default branch. The token comes from the project's tokenEnv, else CHANT_<FORGE>_TOKEN, and reaches git as an http.extraheader in the environment. describeReconcile prints the outcomes.
For terragucci#1282 part d: control-repo.ts maps ControlSettings (token_env to tokenSecret, read_token_env to readTokenSecret) onto resolveControlTarget. It then calls controlDispatchScript or passes prLoop.control, and generateControlPipeline replaces controlPipeline. control-records.ts becomes readControlEntries, putControlEntry, retireControlEntry and estateClaims over gitControlLedger, with validateConfig as validate. reconcile.ts keeps init and writeGenerated as its generate and calls reconcileProjects. Every import needs a feature-detect on @intentius/chant/ci-control until a release carries it. One change lands at the switch: a control repo's record files move onto the ledger through importControlConfig, and terragucci needs a migration command for that.
For plywood#18: control in plywood.yml maps onto ControlSettingsInput and goes in as prLoop.control. plywood control init writes generateControlPipeline({ words }) for the control repo's forge. Approvers and pins live in the entries' settings, written with putControlEntry and checked by plywood's validate. Reconcile runs reconcileProjects with plywood's init as the generator.
Still missing:
The ledger table. chant ledger and chant query do not read _control/entries.jsonl yet. That would be a control_entries table under the read contract's floor rule.
No chant CLI command sends a dispatch or reconciles. Products call the API from their bins, by the placement rule.
The control repo's read checkout for estate ownership (terragucci's controlCheckoutStep and controlCloneScript) stays in terragucci. Since the entries are on the ledger now, that checkout fetches chant/lifecycle with CHANT_CONTROL_READ_TOKEN. Part d of terragucci#1282 should make that change.
The tests in packages/core/src/control/control.test.ts and the two lexicon tests, plus a run against two loopback fixture repos (plywood#18's acceptance), wait for epic-ready.
Merged to main: bb599f2 (control repo in CI core: dispatch per forge, control-entry records, reconcile; unit commit b648b62). Follow-ups on main: f08af77 (control_entries table in read contract v1, in chant ledger and chant query), 61c0484 (consumers joined across a control repo), 2c6f4dd (control-repo dispatch after the last wave in Op waves).
On origin/main: packages/core/src/control/dispatch.ts, records.ts and reconcile.ts. The ledger table the handoff listed as missing is there now. The issue has no checkboxes. The two-fixture-repo run (plywood#18 acceptance) is a harness run and is dropped under the 2026-10-29 ruling. terragucci's move onto this is terragucci#1282 and plywood's use is plywood#18, both tracked there.
Activity
feat(ci): the control repo in CI core, dispatch per forge, control-en…
Merge unit/cp-chant-4568: the control repo in CI core (#4568)
lex00 commentedon Oct 27, 2026
Landed on integration/ci-products: merge bb599f2 (unit branch unit/cp-chant-4568, commit b648b62). It builds on #4550 (words,
productStatusContext, the pull request loop options), #4554 (forge clients withdefaultBranch) and #4551 (records on the ledger). Typecheck and the docs prose lint pass on the merged tree with no regressions. No tests were run.Files:
packages/core/src/ci-control.ts, the entry@intentius/chant/ci-control, withCI_CONTROL_FLOOR = NEXT_RELEASEpackages/core/src/control/dispatch.ts,records.ts,reconcile.ts,control.test.tspackages/core/src/components/pr-pipeline.ts: acontroloption onPrLoopPipelineOptionslexicons/github/src/components/generate-pipeline.tsandlexicons/gitlab/src/components/generate-pipeline.ts: thecontrol-dispatchjob (Forgejo gets it through the github generator)lexicons/{github,gitlab,forgejo}/src/components/control-pipeline.ts:generateControlPipelinefor the control repo's own filelexicons/{github,gitlab}/src/components/generate-pr-pipeline.control.test.tsdocs/src/content/docs/concepts/ci-products.mdx: a control repo sectionDispatch per forge.
resolveControlTarget(settings, fallbackMember)takes{ repo, op, forge?, member?, tokenSecret?, readTokenSecret?, ref?, apiBase? }, checks it withcontrolSettingsProblems(terragucci's rules), and settles the forge from the host.controlDispatchRequest(target, { member, op, sha }, words)builds one request:POST /repos/<path>/dispatcheswith event type<product>-appliedon GitHub,POST /projects/<id>/trigger/pipelinewithCHANT_CONTROL_MEMBER,CHANT_CONTROL_OPandCHANT_CONTROL_SHAon GitLab, andPOST /repos/<path>/actions/workflows/<product>-dependents.yml/dispatcheson Forgejo. Two senders use it.dispatchControlsends it in process for a product's bin, andcontrolDispatchScriptis the generated step. The step reads the token fromCHANT_CONTROL_TOKENand pipes it to curl on stdin (-H @-, or--form token=<-on GitLab). terragucci's script put it in curl's argv.sentCheckandmarkSenttake the product's shell lines for the idempotency mark terragucci does withterragucci post sentandpost status.controlStatusContext(words)gives<product>/control.Generated jobs. With
prLoop.control = { target, sentCheck?, markSent? }andapplyOnMerge(or a wave gate), the GitHub, Forgejo and GitLab pipelines add acontrol-dispatchjob that needs the last apply job and runs on the green path. The applied commit is the last wave'sgreen-sha(GitLab:$GREEN_SHA), else the green commit. On GitHub and Forgejo the product's secret is mapped intoCHANT_CONTROL_TOKENfor that one step. On GitLab a CI/CD variable reaches every job, so the plan job's script unsetsCONTROL_TOKEN_VARSand the product's two secret names along with the forge tokens. The control repo's file comes fromgenerateControlPipeline({ words, image?, command? })in each forge lexicon, built fromcontrolPipelineSpec. It runsnpx --no-install chant workspace run --dependents-of "$member" --op "$op" --jsonafter checking both names, one member at a time.Control-entry records. They are lines of
_control/entries.jsonlon the control repo'schant/lifecycle, appended throughappendLedgerLineunder the member prefix. No product git writes are involved. Each line is one version of one entry (version,kind: control-entry,id: ctl-NNN,entry: project|defaults,project,state: active|retired,settings,estates,product,at,by?,prev,digest).prevnames the digest it replaces, soputControlEntry(..., { expect })refuses a raced write (ControlEntryConflict) and a reader catches a broken chain. The API isreadControlEntries(port, { validate }),putControlEntry,retireControlEntry,importControlConfig,controlConfigandestateClaims, withgitControlLedger({ cwd })as the port. The product'svalidatechecks its own settings. As with every ledger, nothing pushes; callpushLifecycleReportafter.Reconcile.
reconcileProjects(projects, { mode, words, generate, env, git?, forgeFor?, fetch? })clones each project and calls the product'sgenerate(dir, { key, name, forge, settings, dryRun }). A dry run reports. An apply pushes<product>/pipelineand opens a pull request against the forge's default branch, or edits the open one. It never writes a default branch. The token comes from the project'stokenEnv, elseCHANT_<FORGE>_TOKEN, and reaches git as anhttp.extraheaderin the environment.describeReconcileprints the outcomes.For terragucci#1282 part d:
control-repo.tsmapsControlSettings(token_envtotokenSecret,read_token_envtoreadTokenSecret) ontoresolveControlTarget. It then callscontrolDispatchScriptor passesprLoop.control, andgenerateControlPipelinereplacescontrolPipeline.control-records.tsbecomesreadControlEntries,putControlEntry,retireControlEntryandestateClaimsovergitControlLedger, withvalidateConfigasvalidate.reconcile.tskeepsinitandwriteGeneratedas itsgenerateand callsreconcileProjects. Every import needs a feature-detect on@intentius/chant/ci-controluntil a release carries it. One change lands at the switch: a control repo's record files move onto the ledger throughimportControlConfig, and terragucci needs a migration command for that.For plywood#18:
controlinplywood.ymlmaps ontoControlSettingsInputand goes in asprLoop.control.plywood control initwritesgenerateControlPipeline({ words })for the control repo's forge. Approvers and pins live in the entries'settings, written withputControlEntryand checked by plywood'svalidate. Reconcile runsreconcileProjectswith plywood's init as the generator.Still missing:
chant ledgerandchant querydo not read_control/entries.jsonlyet. That would be acontrol_entriestable under the read contract's floor rule.controlCheckoutStepandcontrolCloneScript) stays in terragucci. Since the entries are on the ledger now, that checkout fetcheschant/lifecyclewithCHANT_CONTROL_READ_TOKEN. Part d of terragucci#1282 should make that change.packages/core/src/control/control.test.tsand the two lexicon tests, plus a run against two loopback fixture repos (plywood#18's acceptance), wait for epic-ready.feat(core): a control_entries table in read contract v1, in chant led…
Op waves: control-repo dispatch after the last wave, and cross-stack …
lex00 commentedon Oct 29, 2026
Close-out (2026-10-29)
Merged to main: bb599f2 (control repo in CI core: dispatch per forge, control-entry records, reconcile; unit commit b648b62). Follow-ups on main: f08af77 (control_entries table in read contract v1, in chant ledger and chant query), 61c0484 (consumers joined across a control repo), 2c6f4dd (control-repo dispatch after the last wave in Op waves).
On origin/main: packages/core/src/control/dispatch.ts, records.ts and reconcile.ts. The ledger table the handoff listed as missing is there now. The issue has no checkboxes. The two-fixture-repo run (plywood#18 acceptance) is a harness run and is dropped under the 2026-10-29 ruling. terragucci's move onto this is terragucci#1282 and plywood's use is plywood#18, both tracked there.
Closing: the shared capability is on main.