Run terragucci 0.4: plan notes carry the plan's diff, and an estate's version is honoured in a templated sandbox #3
No reviewers
Labels
No labels
terraform-plane
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jhgaylor/sluice!3
Loading…
Reference in a new issue
No description provided.
Delete branch "lex00/sluice:terragucci-040"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
terragucci 0.4.0 is on npm. It puts the plan's diff in the plan note: each group's diff and each root's whole plan, cut to the forge's comment limit, with links to report.html and plan.txt. This PR moves sluice to it and fixes a bug that kept an estate's own terragucci version from reaching its sandbox.
What changes
Defaults:
TERRAGUCCI_VERSIONdefaults to0.4(src/config.ts), andestates.terragucci_versiondefaults to0.4(src/db/schema.ts).scripts/sandbox-bootstrap.shinstalls0.4.0when it gets no version argument.drizzle/0002_terragucci_04.sqlwas generated withbun run db:generate, then I added one data statement to it. It sets the column default and moves estates on the old default"0.3"to"0.4". 0.4.0 reads every 0.3terragucci.ymlunchanged, so those estates get plan diffs without anyone touching them. An exact pin such as"0.3.1"stays where it is.The version is now honoured:
buildDepscreatedMoorRunnerwith noterragucciVersion, and the executor'sStartInputhad no version either. As a result every cold sandbox got the bootstrap script's default (0.3.1), whatever the estate said. NowStartInputcarriesestate.terragucciVersion, andMoorRunnerfalls back to configTERRAGUCCI_VERSIONwhen a run doesn't name one.bootstrap()used to check onlycommand -v terragucci, so a sandbox from a template with an older terragucci would never be upgraded. It now reads the installed version (from the global package.json, the same file the script reads) and runs the bootstrap with the requested version when terragucci is missing or doesn't match. A request for"0.4"accepts any 0.4.x, and"0.4.0"accepts only 0.4.0. The script applies the same rule, so it does nothing on a sandbox that already matches.Tests
bun test: 380 pass, 3 skip, 0 fail.bun run typecheckis clean.New tests in
test/moor-runner.test.ts:terragucciSatisfiestest/executor.test.tschecks that the estate's version reachesrunner.start. I also checked the migration by hand on PGlite: estates on0.3and on the column default move to0.4,0.3.1stays.Deploy
TERRAGUCCI_VERSIONis set insluice-secrets, in which case it overrides the new default.moor-tpl-sluice(built in moor'sscripts/build-templates.tsfrom this script) bakes 0.4.0 the next time it is built.An admin can already set an estate's terragucci version to
0.4on the estate's settings page in the console. Before this PR, though, that value didn't reach the sandbox, which installed the script's default. After this PR it does.terragucci 0.4.0 puts the plan's diff in the plan note. The defaults move to it: TERRAGUCCI_VERSION and the estates.terragucci_version default are "0.4", and sandbox-bootstrap.sh installs 0.4.0 when it is handed no version. Migration 0002 sets the new column default and moves estates on the old default "0.3" to "0.4" (0.4.0 reads every 0.3 terragucci.yml unchanged); an exact pin like "0.3.1" stays. The estate's version never reached the sandbox: deps built MoorRunner without a version and the executor's start input had none, so every cold sandbox got the script's default. StartInput now carries the estate's terragucci_version, and MoorRunner falls back to config TERRAGUCCI_VERSION. bootstrap() probes the installed version instead of only `command -v terragucci`, and bootstraps when terragucci is missing or does not meet the request ("0.4" takes any 0.4.x, "0.4.0" only that). The script applies the same rule, so it is a no-op on a sandbox that already meets it. Tests: missing terragucci bootstraps with the run's version; a template that meets it skips; an older template is bootstrapped to the estate's version; the runner default applies when a run names none; the executor passes the estate's version to runner.start.