Repository navigation
The environments declaration in the root marker: the question, its validation and the checks of plx doctor - #120
Merged
davidjalbers merged 17 commits intoDec 6, 2026
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ion and its branches Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… that declares none deploys from no branch Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…e declaration Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…NCHES is gone Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…n main Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…file and a declared environment without a file The index of requirement names gets the two names of the new pages by hand, as the last change did; ship regenerates the file. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ironment files Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…environments as it was written Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ks of the declaration Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ration of environments with its other defaults Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
… deploying branch, and one with none says where to declare Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…vironment, instead of a branch that does not deploy; the repo templates say birth needs git 2.28 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
davidjalbers
deleted the
davidjalbers/plx-302-the-environments-declaration-in-the
branch
December 6, 2026 04:48
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.
What it does
environments: a map of name topromotes_fromand optionalauto_promote(§ 3.6, § 3.7).One function of
libreads and validates it:packages/lib/src/declaredEnvironments.ts.The name rule is the one environment files use, imported from
environments.ts.repo-turboandrepo-operationsaskenvironmentsas ayamlquestion (default{};repo-turboskips it for a package repo).plx new,plx applyandplx updatecarry the nested value as written.plx doctor:PLX-Stack/FileNamesDeclaredandPLX-Stack/DeclaredHasFile(repo checks, silenced by a deviation), and an invalid declaration as a finding of no requirement with its reason.ENVIRONMENT_BRANCHESis gone;environmentOftakes the declaration. An invalid declaration deploys from no branch.PLEXUS_(own test and code commits).git init --initial-branch=main. A test with no git configuration holds it. Noenv/branch is created at birth.Interface for PLX-303 and PLX-305 (
@plexus-ms/lib)readDeclaredEnvironments(ctx, dir): Promise<DeclaredEnvironments>reads the root marker ofdir;declareEnvironments(value)is the pure form.DeclaredEnvironments = { environments: DeclaredEnvironment[]; problems: string[] }; never throws; order as written;problemsempty means valid, and a caller that acts refuses otherwise.DeclaredEnvironment = { name, promotesFrom, autoPromote, branch: 'env/<name>', source: 'main' | 'env/<promotesFrom>' }.environmentBranch(name),environmentOfBranch(environments, ref),describeBranches(declared, 'and' | 'or')(the branches of a valid declaration only),declarationRefusal(declared)(the problems, or where to declare one, or undefined where branches deploy),DEFAULT_BRANCH,ENVIRONMENTS_KEY.environmentOf(declared, event, ref, given)keeps its rule, with the declaration first.auto_promoteis absent when not written, so a template must useis defined(the default is applied by the loader only).Readings (not decided by the issue or the decisions)
main,env/<name>) (the maintainer's opening reading).environmentsdeploys nothing and passesplx doctor, unless a stack has an environment file, which is then an undeclared environment (the maintainer's opening reading).environmentsnull,{}or absent declares nothing; a declared name whose entry isnullor{}has nopromotes_fromand is refused.PLX-Stack/EnvironmentFile).environmentOfreturns no environment for any branch.plx deployreads the declaration only to find the environment of a branch;--environmentstands in without reading it, as before.plx-ci setupreads the declaration from the working directory (.) of the step.DeclaredHasFile.PLX-Stack/EnvironmentFilerefuses anyPLEXUS_name; the page's doctor paragraph still says "not every name underPLEXUS_" (compendium sentence to correct).standard-index.jsongot the two names appended by hand (shipregenerates); the lint against the new pages reports only olderNoCommittedValuesandPathPrefixcitations that were there before.ship.integration.test.tsnow expectsenvironments: {}among the defaults spliced into arepo-operationsmarker; its commit comes after the template commit because the expectation only changed with it.PLX-276
Resolved by
git init --initial-branch=mainin both repo templates andenvironmentsQuestion.test.ts("born on main", withGIT_CONFIG_GLOBALandGIT_CONFIG_SYSTEMat/dev/null).No
env/branch and nodevelopis created at birth (§ 6.2).The search of the done-when
NODE_ENVand "production artifacts" are no environment name.Each other hit stays, and the issue that removes it:
deployTargets.ts:7,31(DEFAULT_ENVIRONMENT): the deploy verb's issue, PLX-299, which deletes the inventory records.repo-operations/.../deploy.yml.jinja:4,23,25,65andrepo-operations/files/PLEXUS.md.jinja:5: the workflows issue, PLX-303.repo-turbo/.../on_push.yml.jinja:68,73andon_commit.yml...jinja:4,8: the workflows issue, PLX-303.repo-turbo/files/mise.toml.jinja:72,73(thepromotetask): the promote and release issue, PLX-305.None of these files is changed here.
What no test covers
plx deployorplx-ci setupfrom a GitHub run on anenv/<name>branch.plx promote(PLX-305).plx newwith the declaration given as a-a environments=...string on the command line (the engine's YAML cast is tested, the flag through the proof only:--answersfile).mise installbirth beyond the proof run.-a environments=...is read by the engine as YAML 1.1, so the nameson,y,noandnbecome booleans; the marker is read as YAML 1.2, where they stay names.git init --initial-branchneeds git 2.28 or newer; both repo templates say so beside the birth command, and an older git fails at that command, which the failure lists by hand.Release-notes material
repo-turboandrepo-operationshave a new questionenvironments;plx updateaddsenvironments: {}to a marker without it.plx doctorfails.plx newis onmain; birth needs git 2.28 or newer.plx deployandplx-ci setupdeploy only fromenv/<name>branches the repo declares;mainanddevelopno longer deploy.mainordevelop:plx deployandplx-ci setuprefuse loudly, saying the repo declares no environment and where to declare one.This and the workflows rendered from the declaration ship in one version.
PLEXUS_.Verification
TURBO_FORCE=true mise run test: exit 0.node newborns/scratch.ts node --test):repo-turbo,repo-operations,update-released(including two new tests for a declaration kept byplx update),pipeline,deploy-job,package-pipeline: all pass.plx(plx newon a machine withinit.defaultBranch=trunk, doctor pass and five failures,plx applyafter a hand edit) is kept by the author.Lines
+997 −72 over 25 files; 664 added and 36 removed lines are in tests, fixtures and the index (66% of the additions).
🤖 Generated with Claude Code