Skip to content

research: chant and pipeline engines like Dagger (hermetic Op steps, running generated CI locally, warden policy as a lexicon) #4015

Closed

Description

@lex00

Question

Tools like Dagger run CI logic in a containerized engine: the forge YAML shrinks to dagger call, steps run in pinned containers with content-addressed caching, and a local run matches the CI run. chant approaches the same problem from the other end. Where do the two meet, and what is chant missing?

Where chant sits today

chant already covers most of the ground pipeline engines claim:

  • Pipelines as code: Ops, typed and phased, with gates, a gate ledger and onFailure compensation, run in-process or --on fountain.
  • Durable runs: fountain stewards run an Op on a machine of their own and keep the record on a thread.
  • Native CI for three forges: one TypeScript source builds GitHub Actions, GitLab CI and Forgejo Actions YAML (One shared layer under chant's three CI generators #3765 shares a layer between them; the dialect and migration map GitHub to GitLab).
  • Which commits passed: chant ci records green and revoked commits as git tags.
  • Releases: components build once and promote a recorded digest without rebuilding, with SBOMs, signing and provenance.
  • Local runs: emulators run the real deployer against an emulated cloud.
  • Pipeline security and forge governance: the audit engine (GHA029–058, WGL029–048), and the wardens, which are built on chant's reconcile loop.

What it doesn't have is the engine half: steps run on the host with no isolation, no cache and no pinned toolchain (the build archive is promotion, not caching; epic #551 left the build engine pluggable and never chose a default). This issue is about that half, and about chant running CI itself rather than only generating it (#4016 explores a forge built that way).

Both chant and Dagger promise pipelines that aren't tied to one forge:

  • Dagger does it at run time. Its engine runs in every CI job.
  • chant does it at build time. It writes each forge's own YAML, so nothing extra runs in CI, and forge-side tooling (required checks, the security tab, zizmor) keeps working.

The docs make neither argument. concepts/comparison.mdx covers Terraform, CDK and Pulumi only, and Dagger is not mentioned on the site.

Gaps to research

  1. Hermetic Op steps. An Op's shell(...) or kubectlApply step runs on whatever machine runs the Op, so chant's determinism ends at chant build. The opRuntime hook (chant run --on <lexicon>, used by fountain) could host a dagger runtime that runs each step in a pinned container, with caching, the same way locally and in CI.
    • What does a step need to declare to run in a container (image, mounts, secrets, cache keys)? Can that come from existing step builders, or does each lexicon's builder need a container form?
    • How do gates, the gate ledger and onFailure phases map onto a runtime that executes steps elsewhere?
    • Is Dagger the right engine, or is the hook better served by plain BuildKit, or by running steps as jobs in the generated CI?
  2. Running generated CI locally. chant holds a typed model of every job it generates. Could it run a job locally (directly, or through the runtime in 1) instead of pointing people at act, which re-parses the YAML chant wrote?
  3. Warden policy as a chant lexicon. The wardens read governance.yml, which is hand-written YAML without types, lint or a deterministic build. A governance lexicon would build that file from TypeScript and lint it beside the workflows it protects. github-warden docs(github,gitlab): document runtime observation as N/A (#56) #62 already makes each pipeline's job names required status checks, which points at one source for a pipeline and the rules that enforce it. Does that belong in the github lexicon, a new lexicon, or the wardens?
  4. Positioning. A Dagger row (and maybe Bazel) on the comparison page, and the build-time versus run-time argument in the CI room.

Out of scope

Replacing generated CI YAML with an engine. The build-time approach is the point; this issue looks for what an engine adds beside it.

Deliverable

A short write-up in this issue answering the questions in 1 to 3, with a recommendation for each: build, defer or drop. If 1 is a go, a design sketch of the runtime and the step declaration it needs. Item 4 can go straight to a docs PR.

Activity

  1. added
    area:ops
    area:ci
    design
    on Oct 16, 2026
  2. lex00 commented on Oct 19, 2026

    @lex00
    ContributorAuthor

    The chant runner's first slice is epic #4101. Container isolation and a step cache stay here.

  3. lex00 commented on Oct 21, 2026

    @lex00
    ContributorAuthor

    Write-up (2026-10-20)

    chant claims are cited at 232b9bb (v0.124.32). (inferred) marks my reading. Prior-art claims come from the pages in Sources, read 2026-10-20.

    The runner itself shipped as epic #4101: chant ci run runs a pipeline job as an Op on the local executor, from the same typed value the forge generators wrap, and ci serve runs those jobs on one host [1, 2]. What #4101 left here is the engine half: step isolation, a step cache and a pinned toolchain.

    Prior art

    Project What it is Overlap and difference with chant
    Dagger A programmable CI engine: functions in modules run as cached container operations, dagger check runs declared checks the same way locally and in CI, and Cloud Checks runs them on managed machines in early access. In v0.21 (2026-05-22) Dagger began replacing BuildKit's solver with its own engine and an e-graph cache; Modules v2, with dagger.toml and a lockfile, is still in development [S1]. Dagger moves the pipeline to run time, with its engine in every job. chant moves it to build time and writes each forge's own YAML [3]. They meet at the step: Dagger's container-per-operation with a content cache is what chant's shell step lacks [4].
    BuildKit The build engine under Docker, with content-addressed caching of build steps and a frontend API [S2]. The cache model chant would copy. Using it directly ties a step to Dockerfile-shaped graphs (inferred).
    act (nektos/act) Runs GitHub Actions workflows locally in Docker by parsing the workflow YAML and emulating the runner [S3]. chant's ci run --local runs the jobs it generates from their typed values and never reads YAML [1, 5]. act covers hand-written workflows and uses: actions, which chant does not model.
    Bazel Hermetic, sandboxed actions keyed by declared inputs, with a local and remote cache [S4]. The reference for what a cache key must cover. Its cost is declaring every input, which chant steps do not do today [4].

    1. Hermetic Op steps

    Build a container form of the shell step. Defer the step cache. Drop Dagger as the default engine; defer a dagger op runtime as a lexicon.

    Today a shell step is the shellCmd activity with a command, an environment and a timeout, run on whatever host runs the Op [4]. ci run names an image only to choose setup lines; the steps still run on the host [6, 7]. Build-time sandboxing exists for chant build --sandbox, not for Op steps [8].

    Design sketch:

    • Step declaration: shell(cmd, { image: "<ref>@sha256:<digest>", mounts?: { workspace: "ro" | "rw" }, outputs?: string[] }). The digest is required, so a step pins its toolchain. Env and secrets come from the step's env and the job's existing allowlist and secrets file [1].
    • Execution: the local executor runs the step with docker run --rm (or podman) with the checkout mounted at a fixed path, the env passed by name, and the declared outputs copied back. The step record gains image and its digest, so the run ledger shows what ran [9].
    • Gates, the gate ledger and onFailure: unchanged. They stay in chant's executor; only the step body moves into a container, so a gate never runs inside one (inferred).
    • Lexicon step builders: a builder that already shells out (kubectl, helm, cfn) gains the same image option by passing it through to shellCmd; modeled steps that call an SDK in-process keep running on the host (inferred).
    • Refusal: an image without a digest fails a new lint rule (inferred: no existing rule covers Op step images).

    Cache, deferred: a cache key needs each step's inputs, and no step declares them [4]. A first cut would key on image digest, command, env names and values (secrets excluded) and the content digest of declared inputs, and replay declared outputs. That needs an inputs field on every builder that wants it, so it waits on a user with a slow step to justify it.

    Why not Dagger by default: it needs its engine in each job, and its solver and module format are mid-change in 2026 [S1]. A dagger runtime can still hang off the existing opRuntime hook as a lexicon, the way fountain does, without core importing it [10, 11].

    This is step isolation. Runner isolation (an ephemeral machine per job) is #4147 and the isolated-runners group in #4168 section 8.

    2. Running generated CI locally

    Done for the jobs chant generates from typed values; drop for hand-written workflows.

    chant ci run plan|apply --local runs a pull-request job from prLoopJobs, the value the three generators wrap, and nothing reads YAML [1, 5]. Gated wave jobs run chant run wave --spec <file> --wave <k>, which is the same command locally [12, 13]. A hand-written workflow in the github lexicon can use any uses: action, and running those means re-implementing the Actions runner, which act already does [S3]. Point people at act for those.

    3. Warden policy as a chant lexicon

    Drop the chant lexicon. Defer a TypeScript policy file to github-warden.

    The warden's policy is already typed: GovernanceConfig in src/config/types.ts:532, validated by src/config/load.ts with an error naming the field path [14, 15]. What it lacks is authoring in TypeScript: the file is YAML or JSON [15]. github-warden#62 already reads generated job names from chant's workspace contract and turns them into required checks (checks) and CODEOWNERS (codeowners) [16]. So the link between a pipeline and the rules that protect it exists without a lexicon. A chant governance lexicon would copy the warden's types into chant and keep two schemas in step (inferred). The smaller change is for the warden to accept governance.ts exporting a GovernanceConfig, which is a github-warden issue, not a chant one.

    4. Positioning

    Build: a docs PR. concepts/comparison.mdx covers Terraform, CDK, Alchemy, Formae and ConfigHub and has no Dagger row [17]. Add a section on pipeline engines with Dagger and Bazel rows, and add the build-time versus run-time argument to the CI room [18]: chant writes each forge's native YAML [3], so nothing extra runs in CI and forge tooling keeps working; github-warden's checks already reads those job names as required checks [16], where Dagger runs an engine in every job [S1].

    Sources

    1. packages/core/src/workspace/ci-run.ts:1-72
    2. packages/core/src/workspace/ci-serve.ts:1-41
    3. packages/core/src/components/pr-pipeline.ts:1-7
    4. packages/core/src/op/builders.ts:380-405
    5. packages/core/src/components/pr-pipeline.ts:98 (PR_LOOP_IMAGE)
    6. packages/core/src/workspace/ci-run.ts:428-429
    7. packages/core/src/workspace/ci-run.ts:753
    8. packages/core/src/cli/registry.ts:651-652
    9. packages/core/src/op/runtime.ts:45-52 (OpRunStepRecord)
    10. packages/core/src/op/runtime.ts:1-17
    11. lexicons/fountain/src/plugin.ts:47; packages/core/src/lexicon.ts:1375
    12. packages/core/src/op/op-waves.ts:1-30
    13. packages/core/src/cli/registry.ts:287-291
    14. INTENTIUS/github-warden src/config/types.ts:532 @3bbd6df
    15. INTENTIUS/github-warden POLICY.md:3-11; src/config/load.ts:28 @3bbd6df
    16. INTENTIUS/github-warden src/cli.ts:7-12 @3bbd6df; github-warden#62
    17. docs/src/content/docs/concepts/comparison.mdx:49-70
    18. docs/src/data/rooms.mjs:43, 208

    S1. https://dagger.io/changelog/
    S2. https://github.com/moby/buildkit
    S3. https://github.com/nektos/act
    S4. https://bazel.build/basics/hermeticity

  4. lex00 commented on Oct 21, 2026

    @lex00
    ContributorAuthor

    Built in #4176 (merged as a24eebc):

    • shell() runs in a container when it has an image pinned by digest. The working directory is read-only at /workspace by default, outputs directories are mounted writable, env is passed by name, and the run ledger records the image on the step. OPS018 refuses an unpinned image. The terraform apply and adopt composites pass compensate.image through.
    • How chant compares has a Pipeline engines section (chant, Dagger, Bazel), linked from the CI room.

    Follow-ups from the write-up:

    Running hand-written workflows locally stays with act, as the write-up says.

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

    area:ciarea:opsdesign

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions