Skip to content

workspace: a release train across repositories, promoted through the control repo #5119

Closed

Description

@lex00

Today

Change

  • A train can pin repo members. chant reads each one's releases at the pinned rev through its read contract (chant release list --json) and records repo.url, releaseDigest and commit. A member with no release refuses the train, and an empty train is refused.
  • The train gets a digest over its member release digests, the same one workspace: releases across several members, reconciled with the release train (#2554) #4037 needs.
  • A promote command in the control repo (its name is a decision) dispatches into each member repository in link order, producers first, carrying the train id, env and release digest. The member's pipeline runs chant run <op> --env <env> --release <digest> at the release's commit, under its own identity. The control repo holds a dispatch-only token per repository and no cloud credentials.
  • The member's existing <product>-applied dispatch carries the train id back. The control repo records it and dispatches the next member only after applied or unchanged.

Done when

  • A fixture org workspace with two repo members, each with a cut release, records a train naming both. A member with no release, or no members, refuses.
  • The same picks give the same train digest.
  • Against a fake forge, promote dispatches the first member only. Its applied record dispatches the second, and failed stops the train and records where.
  • The generated member job runs chant run --release, its deploy record carries the releaseDigest, and the generated control job has no credential step.

Depends on

#4037 for the train digest and gate binding. The dispatch from #4568 and #4617.

Not in this issue

Gates that span repositories (each member keeps its own gate), rolling a train back, and the lane view.

Tracked on #5105.

Activity

  1. added
    epic:estate-read
    on Nov 15, 2026
  2. lex00 commented on Nov 15, 2026

    @lex00
    ContributorAuthor

    Scope, read against origin/estate/4037-train-promote a2388e3 (chant#4037, pending its batch)

    The premise holds on that base. readMemberReleases still reads chant members only, so an org workspace records nothing for its repo members, and #4037's pickTrain now refuses the empty train that results. chant workspace train promote (#4037) runs each member's components promote in its own directory, which a repo member does not have. The applied dispatch (#4568, #4617) carries member, op, sha and outcome, and nothing that names a train.

    What already exists

    Decisions

    • The promote keeps workspace: releases across several members, reconciled with the release train (#2554) #4037's command: chant workspace train promote <env> [<train>]. When the train pins repo members, it dispatches instead of running members. A train that pins both kinds is refused at promote, since one half runs here and the other in other repositories.
    • --continue advances a promote already in flight from the answers recorded in _control/applied.jsonl, and starts nothing new. The control repo runs it when an applied dispatch names a train. Without --continue, a promote with a run in flight refuses and names the member it waits on.
    • The member job runs chant run --components all --env <env> --release <digest> at the release's commit, because that is the run that deploys a release and records releaseDigest today. chant run <op> --release does not exist. Adding it is a separate change.
    • A dispatch-only token per member repository, in the secret CHANT_TRAIN_TOKEN_<MEMBER> (the member name upper-cased, every other character _). The control job holds these tokens and nothing else.
    • Each member keeps its own gate. A member whose run stops at its gate answers waiting, and the train stops there as gated. No workspace gate covers members in different repositories, so --gate is refused for such a train. The dispatch payload carries the cover's identity fields (member, environment, release digest), and the step records the answer in workspace: releases across several members, reconciled with the release train (#2554) #4037's step shape.

    Contract (Done when)

    1. A repo member's releases are read at its pinned rev: chant fetches the revision into the cache (fetchRepoAt), fetches that repository's chant/lifecycle into the cache clone, and runs chant release list --json in the fetched workspace root. A train member then carries repo: { url, rev } beside releaseDigest, commit and label. A member with no release refuses the train, as does a read that fails or an empty train. Shown by a test over two temp repositories standing in for the members, with local URLs, a temp cache, and a stand-in chant for the read.
    2. The same picks give the same trainDigest, whatever the members' kinds. Shown by a pure test.
    3. chant workspace train promote <env> in a workspace whose train pins repo members writes a workspace run record citing the train. Each step names the member's repository. The command dispatches the first member in link order (producers first) and marks its step dispatched. The dispatch carries the member, env, train id, run id, release digest and the release's commit. --continue reads the answers: applied or unchanged marks the step ok and dispatches the next member. failed, partial or waiting stops the run as fail or gated and records the step it stopped at. An answer for another release digest fails the step. With no answer yet, nothing is written. Shown by a test against a fake dispatcher and temp repo ledgers: before an answer, only the first member is dispatched. Its applied dispatches the second, and a failed stops the train and records where.
    4. The applied dispatch carries train, run, env and release when the member's job ran for a train. _control/applied.jsonl keeps them, and the control repo's step runs train promote <env> <train> --continue for such a dispatch in place of the dependents. Shown by tests of the request, the script and the record.
    5. Generated files, forge-neutral in core (@intentius/chant/control/train) and serialized for GitHub by the github lexicon:
      • The member's <product>-train.yml takes the <product>-train dispatch, checks out the release's commit, and runs chant run --components all --env "$env" --release "$release". It then sends <product>-applied with the outcome and the train fields.
      • The control repo's <product>-train.yml starts a promote. Its job holds only the dispatch tokens: no cloud credential step and no id-token permission.
        Shown by tests of both files. A run under --release recording releaseDigest is already shown by run-release.test.ts.
    6. train list --json shows the newest record of each run, with dispatched steps and each member's repo. The workspace train CLI page documents repo members, the promote across repositories and --continue.

    Not in this issue

    • GitLab and Forgejo serializations of the two train files. The request builder covers all three forges.
    • chant run <op> --release, rolling a train back, gates that span repositories, and the lane view.
    • Reading a repo member's releases from a member below its workspace root. The member's repo.workspace can name that directory.
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:estate-read

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions