Skip to content

epic: self-service from templates #4642

Closed

Description

@lex00

People who don't write infrastructure code should be able to get what they need without waiting on someone who does: a new app from an approved template, a database or cache added to that app, a routine operation such as rotating a credential, and an upgrade when the template moves on. They fill in a form in behold, or ask an agent, and the change still lands the way every other change does: as a pull request that is planned, policy-checked, approved against its plan and applied in waves. This epic adds that feature across behold, terragucci, plywood and chant.

behold never changes infrastructure here. Every request becomes a pull request (or, for a day-2 action, a gated request on the chant ledger), so a form, an agent and a person at a shell all go through the same review.

Design

  1. Templates. A template is a module published through terragucci's module registry: tested before release, signed, recorded on the release ledger, and listed in the release catalog (catalog/index.json, terragucci: the catalog preset and terragucci modules terragucci#1297). A template.yml beside the module marks it as a template and names the inputs the form asks for. behold gets a Templates tab that lists them and renders a form from the catalog's terraform.inputs. Submitting the form makes terragucci open a pull request that adds an app: a new root under apps/<name>/ whose only module call is the template, pinned to the exact version. plywood follows for Pulumi component packages once its package registry lands (A private package registry for Pulumi packages, with tests before release plywood#32, ruled "after v1"); until then plywood takes only the parts that need no registry (day-2 actions).
  2. Add-ons. The same form on an existing app opens a pull request that adds one module call (a database, a cache) to that app's root, in its own file. behold draws the app and its add-ons as one group on the graph, with drift from terragucci's reports.
  3. Day-2 actions. A Terraform action block in an app is run from a /terragucci action pull request comment or from a behold button that dispatches terragucci's workflow. Each run is a gated request on the chant ledger (op tf-action), approved under the same rules as a wave, and recorded with its outcome; behold shows the history. Pulumi gets the same feature through a gated stack operation in chant's pulumi lexicon.
  4. Agent requests. terragucci's MCP server (and plywood's) gains a request_from_template tool that opens the same pull request, so an agent's request is reviewed like a person's.
  5. Upgrades. A new template version rolls out to every app built from it through terragucci's existing module rollout, one pull request per wave.

Shared parts go to chant first (CONTRIBUTING placement: chant core, then the engine lexicon, then the product): the request document and its pull request, rendering a root or a module call from a catalog version, the gated action operations, the MCP tier that may write to the forge, and the harness steps that follow a pull request a product opened.

Defaults taken

  • The pull request's files are the record. An app is a root under templates.apps (default apps/<name>/) whose module call sources a template; an add-on is another module call that sources a template of kind addon. No marker file.
  • A version is offered only when the catalog lists it as active (not deprecated or yanked) and its attestation is verified or signed. templates.require: signed is the default; any turns it off.
  • Inputs the module marks sensitive are never asked in a form or an MCP call; the request is refused and names the secret store setting.
  • Request branches are request/<template>/<app> and request/<template>/<app>/<addon>; a second request with the same branch returns the open pull request rather than opening another.
  • The requester is named in the pull request body and in terragucci's audit record (request entries). Approval rules are the repo's, unchanged.
  • Day-2 actions run only on Terraform 1.14 or newer. OpenTofu and choudoufu roots answer with a refusal naming the binary (see question E).
  • behold reaches terragucci only by dispatching its workflow through the operator's gh (GitHub, Forgejo), the path POST /api/ci/dispatch already uses. GitLab takes the terragucci request and terragucci action CLI path until behold has a GitLab trigger.
  • Build order and packaging follow the epic convention: units build against local packs of chant (just chant-local), releases and harness runs come last.

Open questions

A. How behold's form reaches terragucci.

  • (a) behold dispatches terragucci's request workflow with the form as inputs; the pull request is opened by the pipeline's token and names the dispatching person. Recommended: behold keeps holding no forge write credential beyond a dispatch, and the path is the one Deploy already uses.
  • (b) behold runs terragucci request locally with the operator's forge token.
    B. Where a module says it is a template.
  • (a) template.yml in the module's directory, published inside the release so it is signed and versioned with the module. Recommended.
  • (b) a templates: list in the publishing repo's terragucci.yml.
  • (c) every published module is a template.
    C. Where an add-on lives.
  • (a) a module call in a new file apps/<app>/addon-<name>.tf in the app's own root. Recommended: one root, one state, one plan, and the add-on can read the app's outputs directly.
  • (b) a separate root apps/<app>/<addon>/ that reads the app through remote state.
    D. Upgrade trigger.
  • (a) a person starts it (terragucci rollout <template> <version> or behold's Upgrade button); the existing rollouts schedule carries it wave to wave. Recommended.
  • (b) a publish of a new template version starts the rollout itself.
    E. Day-2 actions on OpenTofu and choudoufu roots.
  • (a) refuse with the binary's name until the engine has action blocks. Recommended.
  • (b) emulate an action as a terraform_data replace under -replace.
    F. The Pulumi side of day-2 actions.
  • (a) an action is a command provider resource named in plywood.yml actions:, run as a preview and an update with --target <urn> --replace <urn> under a gated request. Recommended: it needs no registry and no new engine feature.
  • (b) a program-defined function run through the automation API.
  • (c) no Pulumi actions in this epic.
    G. Pulumi templates before A private package registry for Pulumi packages, with tests before release plywood#32.
  • (a) wait for A private package registry for Pulumi packages, with tests before release plywood#32 and take packages from its registry. Recommended, matching the ruling.
  • (b) read component packages by git tag in the meantime.

Order to build

  1. chant: the harness steps (they are how every later unit proves itself), then the request document, the root rendering, the Terraform action operation, the Pulumi action operation and the MCP tier, in any order.
  2. terragucci: apps from templates, then add-ons, day-2 actions, the MCP tool and upgrades.
  3. behold: the Templates tab, then apps and add-ons on the graph, then action buttons and history.
  4. plywood: day-2 actions now; templates, the MCP tool and upgrades after A private package registry for Pulumi packages, with tests before release plywood#32 and Roll a package version out to its consumer repos, one pull request per wave plywood#34.
  5. Releases, then the harness runs for every unit, last.

Done when

  • In behold on a terragucci repo, the Templates tab lists each active signed template; filling in the form for orders opens a pull request request/<template>/orders adding apps/orders/main.tf, which plans only apps/orders, waits at its wave for an approval of its digest, and applies after merge. not run: emulator runs dropped by maintainer ruling 2026-10-28; covered by unit tests and CI
  • On the orders card, Add an add-on opens a pull request adding apps/orders/addon-<name>.tf; after it applies, the graph draws orders with the add-on in one group and shows drift on either from the newest drift report. not run: emulator runs dropped by maintainer ruling 2026-10-28; covered by unit tests and CI
  • On the orders card, an action button (or /terragucci action apps/orders <address> on a pull request) records a pending tf-action request; after a second person approves it, the action runs once, and behold's history for orders shows the request, the approval and the outcome. not run: emulator runs dropped by maintainer ruling 2026-10-28; covered by unit tests and CI
  • An agent calling terragucci:request_from_template gets the same pull request the form opens, with the same plan, policy result and gate. not run: emulator runs dropped by maintainer ruling 2026-10-28; covered by unit tests and CI
  • Publishing a new template version and starting its rollout opens one pull request per wave moving every app's pin, and the next wave opens only after the previous one merged and applied. not run: emulator runs dropped by maintainer ruling 2026-10-28; covered by unit tests and CI
  • plywood: a Pulumi stack's declared action runs under the same gate and record; Pulumi templates follow A private package registry for Pulumi packages, with tests before release plywood#32. deferred: plywood#40, Op codegen can't surface activity return values as workflow search attributes #41, describeResources() coverage gap: 9 of 11 lexicons not yet implemented #42
  • Every unit's harness scenario has a row with plain: pass and break: caught. not run: emulator runs dropped by maintainer ruling 2026-10-28

Units

Build order within each repo is top to bottom.

chant

terragucci

behold

plywood

Related: INTENTIUS/terragucci#1293 (module registry epic), INTENTIUS/terragucci#1297 (the catalog and terragucci modules), INTENTIUS/plywood#32 (Pulumi package registry), INTENTIUS/plywood#34 (package rollout).

Activity

  1. added
    enhancement
    epic
    area:ci
    epic:self-service
    on Oct 28, 2026
  2. lex00 commented on Oct 28, 2026

    @lex00
    ContributorAuthor

    Ruling for self-service (2026-10-28):

    • A: Dispatch workflow. behold dispatches terragucci's request workflow; the PR is opened in CI with the repo's own token.
    • B: template.yml in release. A template.yml (form fields, defaults, description) is published inside the signed module release.
    • C: File in app root. An add-on is addon-.tf in the app's own root, so the app and its add-ons plan and apply together.
    • D: A person starts it. Someone starts the rollout; terragucci's existing rollout schedule carries it one wave at a time.
    • E: Refuse by name. An action on an OpenTofu or choudoufu root is refused with a message naming the engine.
    • F: command resource. A Pulumi action is a command resource in the stack, replaced on request with --target/--replace, under the same approval rules.
    • G: Wait for feat(state): chant state diff --live drift detection (#26) #32. Pulumi templates and add-ons wait for plywood's registry; Pulumi actions (plywood#39) go ahead now.
  3. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    Handoff (self-service-1, 2026-10-28). Every unit outside the deferred ones is built and merged to its repo's integration/self-service. behold and terragucci are on main with push CI green. chant and plywood are green on integration and wait for ci-products-1's cp8 before their main merge. No harness run has been made yet.

    Unit Integration merge Main Left
    chant#4650 harness steps 9f2049f pending run items
    chant#4651 request document (+ claimedBy cfc71a2, app refs 4794d23) e0f2d70 pending run item
    chant#4652 render f101037 pending run items
    chant#4653 tf-action 64ac529 pending run item
    chant#4654 Pulumi action ddf94a1 pending run item pw-action
    chant#4655 --propose tier a4310cb pending run item
    terragucci#1308 apps from templates ced5014e6756 7e469f59a1a7 run items
    terragucci#1309 add-ons 1148cfc270e8 7e469f59a1a7 run items
    terragucci#1310 day-2 actions c5e88fc5d3e8 7e469f59a1a7 run items
    terragucci#1311 MCP request 376610c7ddd7 7e469f59a1a7 run item
    terragucci#1312 upgrades 0fc578fbca5b 7e469f59a1a7 run item
    behold#1035 Templates tab f4e09138935a e3cfbee9aa98 draft docs, run item
    behold#1036 app frame 1cdbdd7afcb9 e3cfbee9aa98 draft docs, run item
    behold#1037 action buttons 7fd1ec038434 e3cfbee9aa98 draft docs, run item
    plywood#39 day-2 actions 892d942dca63 pending run item
    plywood#41 MCP request (refusal) b50c95cf9caf pending two build items and the run item wait on plywood#40
    plywood#44 bench for pw-action (new) 26dee51be6d8 pending confirm the command provider pin, run item

    Rulings for self-service (2026-10-28), recorded on their issues: an action comment is accepted on a plain issue or a pull request (chant#4654); requestedBy is the run's actor, and the person a form or agent names goes next to it as claimedBy (terragucci#1308); harness runs wait for ci-products-1's pw22 round.

    Epic-ready on the integration tips: chant unit 31847 pass (load-only budget timeouts pass alone), typecheck no regressions, docs prose 1693 of 1694; terragucci on the published chant pin check-static and all three shards pass after four fixes (action comment type, bundle stand-in for template-request, harness lint on an older harness, a test's git identity on a bare runner); behold 4971 pass; plywood 458 pass on the 0.124.55 pin.

    Harness rows: none recorded. Eight terragucci scenarios (tg-template-app, tg-template-addon, tg-agent-request, tg-template-upgrade, tg-action-run, tg-behold-request, tg-behold-addon, tg-behold-action) and plywood's pw-action are written and lint clean. Commands, prerequisites and expected plain/BREAK verdicts are in engine-wt/goals/self-service-1-runs.md.

    Waiting: plywood#40 (plywood#32, a Pulumi renderer in chant's pulumi lexicon), plywood#42 (plywood#34, #40), behold#1038 (Pulumi actions in behold, new). The intentius.io comparison rows (self-service catalog, day-2 actions) are not proposed yet; they wait until the catalog, add-ons, actions and agent requests are on every product's main.

    Release steps are on the run sheet: a chant release carrying chant#4650-4655 first, then the product bumps and the draft guides published.

  4. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    Close-out (2026-10-28)

    Per-repo state, all on 2026-10-28:

    • chant: integration/self-service merged to main at 8c18b27. CI green (chant 40814401598, docs 40814401604, chant-ci-green 40815002521). Released as 0.124.58 (publish run 40816550044), carrying e2e harness: await-pull and comment steps, and a pull outcome #4650-4655.
    • terragucci: chant 0.124.58 bump and fallback removal at 267e0e32. CI green (terragucci 40819098802, pages 40819098816, chant-ci-green 40819387843). Guides request-an-app, run-a-day-2-action and agent-request-from-a-template are live.
    • behold: chant 0.124.58 bump at 1b8a812, feature-detect now a static import, TS2322 fixed, using/templates guide published. CI green (ci 40818247582, docs 40818247650).
    • plywood: main at 47b4f0d on chant 0.124.58, fallbacks for pulumi lexicon: a gated stack action, a command resource replaced on request #4654 and MCP: a --propose tier for product tools that open pull requests #4655 removed, run-a-day-2-action published. CI green (plywood 40818078190, docs 40818078215, chant-ci-green 40818131521). agent-request-from-a-template is back to draft (c3ebe6d) because it waits on plywood#40.
    • intentius.io: comparison rows catalog and actions at 7be1fe0.

    Closed: chant#4650-4655, terragucci#1308-1312, behold#1035-1037, plywood#39 and #44.

    Open, deferred: plywood#40 (needs plywood#32 and a Pulumi renderer in chant's pulumi lexicon), plywood#41 (tools/list and opens-one-PR items wait on #40), plywood#42 (needs plywood#34 and #40), behold#1038 (Pulumi actions in behold, outside this epic's units).

    Harness runs: the maintainer dropped the emulator runs (8 terragucci scenarios, plywood pw-action), so those items are struck as not run. The 'Done when' outcomes in this body are left unticked, because no run or other check verified them end to end. The plywood Pulumi items in particular wait on the open issues above.

  5. lex00 commented on Oct 29, 2026

    @lex00
    ContributorAuthor

    Edited per maintainer ruling 2026-10-28: the five end-to-end Done-when items (form to PR, add-on, action, agent request, upgrade wave) are ticked and struck as not run (emulator runs dropped; covered by unit tests and CI). The plywood Pulumi outcome and the plywood#40, #41, #42 unit lines are struck and marked deferred to those issues. Issue stays closed.

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:cienhancementepicepic:self-service

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions