Repository navigation
Workflows rendered from the declaration: triggers on env/<name>, auto-promotion, packages from main - #126
Merged
davidjalbers merged 21 commits intoDec 6, 2026
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A template's manifest names under each, by source path, a variable of its scope that holds a list; the file is rendered once per item with _item bound. The environment files of a stack and the promotion workflow of each environment are one file per declared environment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…a render is given the declaration A newborn repo with a stack and no declaration passes the doctor: its stack is born with no environment file. The stop-gap declaration of the two names the stack template wrote is gone from newSite.test.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er is given the declaration templateAnswers adds declared_environments, each environment's name, branch, source and auto_promote, to the answers of every render plx makes (new, apply, update, doctor): no template spells a branch. The stack template renders one environment file per item, birth-only, so a newborn repo with a stack and no declaration passes the doctor. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
on_push runs on the branch of each declared environment, listed by name, and on_commit on every other branch; a repo without a declaration has no on_push. An environment that promotes itself gets a workflow that fast-forwards its branch with plx promote after a green run on its source, pushed with the App's token. The operations repo deploys the same way. The newborns move off develop and declare their environments. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The renders that read on_push or deploy.yml declare an environment; the pins and the held app pipeline are checked with and without one, the triggers and the whole-history checkout left out of what is held. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
on_push of an app repo and deploy of an operations repo run on a push to the branch of each declared environment, listed by name, and on no other; on_commit runs on every other branch, main among them. A repo that declares none has neither, and on_commit runs on every branch. The job repo of on_push checks out the whole history with its tags. Each environment that promotes itself has a workflow that runs plx promote after a green run on its source and pushes as the tenant's App. The operations repo deploys the environment of its branch, queued per branch. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nt's branch setup promote mints the App's token with contents and workflows write, so that the promoting push starts the pipeline of the environment's branch. A job deploy is refused off a declared environment's branch in whatever workflow mounts it, the operations repo's deploy among them. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… branch in any workflow setup promote mints the App's token with contents and workflows write for the job that fast-forwards an environment's branch. The refusal of a run on a branch that deploys nowhere covers a deploy job in whatever workflow mounts it, so that a deploy started by hand on another branch or a tag fails before any host is reached. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eclare PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The name given must be an environment of the root marker's declaration; any other is refused before anything is read, naming those declared, and a repo that declares none, or whose declaration is invalid, deploys nowhere, with --environment as without. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The plx of an earlier version hands the templates of the version a repo takes the marker's answers alone; the templates then render as a repo that declares no environment, rather than fail the update. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
So that the plx of an earlier version, which hands the templates of the version a repo takes the answers alone, renders them as for a repo that declares no environment instead of failing the update. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A repo taken by the plx of an earlier version, or declaring no environment, has no on_push or deploy.yml after the update; one born with a declaration keeps its workflow, moved to the version. A repo of 0.138.0 deploying from main and develop gets its environments' workflows once it declares them and runs plx apply. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A repo that declares environments and has no stack fails the doctor's check for a file of each, so the newborn whose verbs run declares none, and the workflows are read from a second newborn that does. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An item taken out of the list deletes its file, or keeps an edit to it as a conflict; an item added adds one, a rename does both, and an emptied list deletes every file. An item may name a path below the source's directory, and one outside the output is refused. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ations it is rendered with PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The promotion workflow and the header of setup promote say that the head of the source as it stands when the job runs is promoted, whichever run started the job, and that a newer push's run promotes again; why the App's token has workflows write; and why setup is handed the vault's token where the repo holds no App credentials on the forge. PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s keeps the App's credentials there PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… and that the token finds them PLX-303 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
davidjalbers
deleted the
davidjalbers/plx-303-workflows-rendered-from-the-declaration
branch
December 6, 2026 12:29
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Milestone 3 of the environment branches: the workflows are rendered from the environments a repo declares.
Behaviours
env/<name>, by name, and on no other branch.repo-turborenderson_push.ymlonly for a package repo or a repo that declares an environment, withbranches: [env/<a>, env/<b>]taken from the declaration.on_commitruns on every other branch (branches-ignorethe same list),mainamong it; with no declaration it runs on'**'.The deploy job deploys the environment of its branch (
plx deploywithout--environment).Each environment with
auto_promote: truegets.github/workflows/promote-<name>.yml:workflow_runof[on_commit, on_push](operations:[on_commit, deploy]),types: [completed],branches: [<source>], a job-levelifon the run's conclusion,plx-ci setup promote, a second checkout with the App's token andfetch-depth: 0, thenplx -y promote <name>.Only
plx promotefast-forwards; it fails and changes nothing otherwise.It promotes the source's head as it stands when the job runs, which can be newer than the commit whose green run started the job: for an environment whose source is another environment, the target can so receive a commit whose run on the source has not finished.
The workflow's comments and the header of
setup promotesay so, and that the newer push's own run promotes again; whether that changes is the maintainer's.plx-ci setup promotemints it withcontents: writeandworkflows: write.The fast-forward can bring a changed file under
.github/workflowsonto the branch.GitHub's docs ask the Workflows permission of an App that edits files in
.github/workflows("Choosing permissions for a GitHub App"); that the forge refuses a push of existing commits that change one without it is relied on and not verified.fetch-depth: 0in the jobrepo);plx-ci imagealready refused a shallow clone.mainby changesets: unchanged, and tested as such.env/trigger: noon_push, nodeploy.yml, no promotion.plx updatelands onmain:consumers.tsnames no branch and lands on origin's default branch; every newborn of this checkout is onmain.plx-ci setuprefuses a deploy job off a declaredenv/<name>in any workflow (the operations repo'sdeploy, started by hand, among them), before anything is read.if:of every rendered workflow.plx deploy --environment <name>refuses a name the repo does not declare, naming those it does; a repo that declares none, or whose declaration is invalid, deploys nowhere, with the option as without.birth-only), none where none is declared; the stop-gapsSTACK_FILE_ENVIRONMENTS,FILE_ENVIRONMENTSanddeclaredare gone, and a newborn with a stack and no declaration passes the doctor.Readings
each, a new manifest key ofplx-template.A template cannot loop over files, and one workflow and one environment file per declared environment need one.
each: {<source path>: <list variable>}renders the source once per item with_itembound; generic, and it knows nothing of Plexus.declared_environments, a read plx computes.No template spells
env/:templateAnswers(libdeclaredEnvironments.ts) gives every render (plx new,plx updateon both sides,plx apply,plx doctor's judge) a list of{name, branch, source, auto_promote}, empty where the declaration is invalid; it is never written into a marker.The question's help text of
environmentsin both repo templates, which predates this branch, still namesenv/<name>in prose.[].The plx of an earlier version renders the new side of an update with the marker's answers alone; without the default every update from 0.138.0 would fail.
With it, a repo taken by an older plx renders as one that declares nothing;
plx applyon the new version renders the declared workflows.plx new -a environments=...gives the answer as text, sonewSiterenders twice: once to resolve the answers, once with the declaration computed from them.ifongithub.event.workflow_run.conclusion.The rule "a step is one command with no workflow condition" binds steps; the promotion's job condition reads the run's outcome, not an environment's name.
Alternative: let
plx-ci setup promoterefuse a red run, which would mark every promotion after a red run red as well.Its
deploy.ymlruns on each declaredenv/<name>, deploys the environment of its branch, queues per branch (deploy-${{ github.ref }}), and has no paths filter, so that a promotion that creates a branch starts it.Alternative: keep
deploy.ymlonmainwith a named environment, whichPLX-Delivery/NoWorkflowLogicand the "no conditional on a name" rule leave no room for.deployon a tag or another branch fails in one line inplx-ci setup, before any host.OP_SERVICE_ACCOUNT_TOKENwhereci_service_accountis true (in the operations repo through a read with defaulttrue).A repo that deploys reads the vault, so the App's credentials may be there (
PLX-Delivery/CIVaultlets only a repo that reads nothing else from it hold them on the forge, and does not oblige it to), and the step is handed the token to find them; setup takes the forge's copy where both are set.eachtakes any item: an item may name a path below the source's directory (a/blands ata/b), and one that leaves the output is the error any such path is; the engine checks nothing else, and plx bounds the items (an environment's name is one lowercase word).Not covered by a test
on_pushon a push made with the App's token, and none on one made with a workflow's own token: GitHub's documented behaviour, relied on, not exercised.workflow_runwithbranchesfilters on the head branch of the run it follows, and runs from the default branch's copy of the workflow.declared_environmentsinto a marker: plx replaces it on every render andplx doctordoes not report it.plx applyadds no file (the files arebirth-only);PLX-Stack/DeclaredHasFiletells only where no stack has a file for it.Left
PLEXUS_COMMIT_SHAis still delivered bypackages/lib/src/deploy.tsandpackages/lib/src/compose.ts(§ 7.8), outside this issue's sections.Release notes
The branch model moves from
main/developtomainplusenv/<name>, and the workflows follow the environments a repo declares.Walked once with the packed tools, a repo of 0.138.0 taking this checkout as 0.139.0, in scratch repos with bare remotes.
What the plx of 0.138.0 does with this version.
The engine of 0.138.0 cannot read the template
stackof this version:template.yml: unknown key eachandthe policy of {{ _item.name }}.yaml.jinja is merge or born-once, not birth-only.birth-onlyis already onstacks-3, so this holds forstacks-3without this branch as well;eachis a second reason.Its scheduled
plx-updateshows one red run a day and pushes nothing; the version is taken by hand with the newplx(below).developin an app repo, andmainin an operations repo.It deletes
on_push.yml(ordeploy.yml), setson_committobranches: ['**'], and writesenvironments: {}.Its body says "Nothing needs a hand: every site merged clean.", as does the plx of this version; the update prints
unknown key eachfor the repo template, which is harmless.After the merge nothing tells the person anything:
plx doctorpasses, and the body carries no steps.An app repo without a stack that moves to
maincloses that pull request againstdevelopand takes the version onmainwith the newplx(steps 2 and 3 below).Such a repo deploys nothing; an app repo without a stack also stops publishing images, since only an environment's branch does.
An app repo with a stack (0.138.0 deploys
mainto production anddevelopto staging).The order that keeps the gap smallest, with the commands:
developonce more the old way:git switch main && git pull && git merge origin/develop && git push.The push to
mainruns the oldon_push, which deploys production; push nothing todevelopfrom here on, where the oldon_pushwould still deploy staging.mainthe default branch:gh repo edit --default-branch main.The promotion runs only from the default branch's copy of its workflow.
mise exec npm:@plexus-ms/cli@<version> -- plx update --to <version> ..It pushes
plexus/<version>and opens the pull request againstmain.git fetch && git switch plexus/<version>; in the root marker replaceenvironments: {}with the declaration matching the stack's files, for example{staging: {promotes_from: main, auto_promote: true}, production: {promotes_from: staging}}; thenplx apply(the branch pins the new plx),plx doctor, commit andgit push.plx applyaddson_push.ymlon[env/staging, env/production]andpromote-staging.yml, and turnson_committo ignore the two branches.A push here runs
on_pr; nothing deploys.main.The push to
mainrunson_commitonly, and nothing deploys frommain.Once it is green,
promote-staging.ymlcreatesenv/stagingat the head ofmain, and that push runson_push, which publishes the images and deploys staging.Without
auto_promote:plx promote staging.on_pushonenv/stagingis green:plx promote production.It creates
env/production, whose push runson_pushand deploys production.Promoting it while staging's run is still going deploys production from a commit staging has not finished with;
plx promote productionbefore step 5 is refused (env/staging … is not on the remote yet).main/developtoenv/*, thengit push origin :develop.Production runs what step 1 deployed until step 6; a push to
mainbetween steps 1 and 6 deploys nowhere.An operations repo with a stack (0.138.0 deploys
mainto production throughdeploy.yml):mise exec npm:@plexus-ms/cli@<version> -- plx update --to <version> ..plexus/<version>: declare the environments in the root marker, for example{production: {promotes_from: main}}, matching the stacks' files;plx applyaddsdeploy.ymlon[env/production];plx doctor, commit, push.main:on_commitruns, and nothing deploys.plx promote productioncreatesenv/production, whose push runsdeploy.With
auto_promote: true,promote-production.ymldoes it after every greenon_commitonmain.Production runs what it ran until step 4; a push to
mainbetween steps 3 and 4 deploys nowhere.A package repo: nothing beyond taking the version.
Every repo:
maingets no promotion: the forge runs aworkflow_runworkflow only from the default branch's copy.mainthat changes only Markdown starts no run (paths-ignore: ['**/*.md']), and so no promotion, until the next push that does.PLX-Stack/DeclaredHasFile.plx deploy --environment <name>refuses a name the root marker does not declare, and a repo that declares none deploys nowhere.plx-ci setuprefuses a deploy off a declaredenv/<name>.plx apply; writestack/<name>.yamlby hand.Contents: writeandWorkflows: write(already held forplx update).In the walk,
plx doctoron the update branch reportedPLX-Repo/Verbs(the scratch shimsmise) and, in the operations repo,PLX-Stack/Layout(the fixture's one stack sits atstacks/docs); the stacks passed.What the pages say otherwise
The compendium at
stacks-3(5a8c7c3) says what this builds; nothing found that says otherwise.Not on the pages:
plx applyon the new version (reading 3).PLX-Stack/DeclaredHasFile, so declaring environments needs a stack first./home/albers/dev.worktrees/scratch/stacks-3-lint/compendiumstands at e0be761, behindorigin/stacks-3(5a8c7c3); the citation lint passes against both.Verification
TURBO_FORCE=true mise run testat c89e2bd: exit 0,Tasks: 7 successful, 7 total,Cached: 0 cached, 7 total,Finished in 393.55s; the pre-push hook'stestpassed as well.repo-turbo14/14,repo-operations9/9; at 77d71c3:pipeline4/4,deploy-job15/15,app-nextjs15/15,e2e-playwrightwithhelpers48/48,update-released20/20.mise run e2eonce at 77d71c3: 203 pass, 1 fail,runner-host-mail, on a DNS failure of the container's apt; run again alone, 13/13.each.test.tsfails with only the first item rendered (7), with an item's slashes flattened (2), with a path outside the output not refused for an item (1), with an unedited removed file kept (3), with an edited removed file deleted (1); the render test fails with a promotion job whoseif:names the environment (promote-production.yml: … 'production' != '').update-released, not committed, with bare remotes; every step as written there passed.🤖 Generated with Claude Code