ops(gate): the upgrade leg + role boundary (STORY-446, gh-#777) - #790
Merged
Merged
Conversation
…sequence (gh-#777) Fills in run_upgrade_leg in tools/gate/stack_gate.sh: resolve the previous published release (--from or the newest other v* release via gh), git worktree that tag, its own setup.sh --yes + up -d on the previous pin, wait health/on-air, compose stop api, swap db/ + migrate.sh to the current checkout, run the current ./migrate.sh, up -d api, wait health/on-air again — worktree removed on EXIT via the existing trap. SPEC F178.6, STORY-446. Also: the spec now locates the migrate.sh CALL line (StartsWith, not a substring search) so it can't match a docker stub's cwd directory-listing line that happens to mention migrate.sh.
After the current migrate.sh and before the api restart, psql as station_svc on library.media and as library_svc on station.settings via compose exec -T db; both must print permission denied (text, not exit code — real psql exits 1 on that outcome), anything else fails the leg 'role boundary'; report gets a role boundary row + json twin. SPEC F178.7, STORY-446 AC6-AC7.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
PR-6 of the gh-#777 epic (STORY-446, SPEC F178.6, F178.7). The gate now proves an upgrade: the previous release installed for real, then migrated forward onto the tag under test, with the role boundary re-checked afterwards.
🏗️ What
--upgrade): resolves the previous release (--from <vX.Y.Z>, else the newest other publishedv*release fromgh release list, drafts and pre-releases excluded), checks it out withgit worktree addinto the run's scratch, and runs that release's ownsetup.sh --yesthere with a generated overlay pinning its images. Once it is on the air the leg does what an operator's upgrade does:docker compose stop api, swapdb/andmigrate.shfor the current checkout's, run the current./migrate.sh(must exit 0, else the leg failsmigratewith the tail in the report),docker compose up -d api, then health and first on-air again. The worktree and the compose project are removed in the trap on every path.psql -U station_svconlibrary.mediaandpsql -U library_svconstation.settingsthroughcompose exec -T db. Both must printpermission denied; anything else (a row count, an auth error, empty output) fails the legrole boundarywith the probe's text in the report. The decision is on the text, not the exit code: real psql exits 1 on the outcome we want.upgrade previous / health_secs / onair_secsand arole boundary | okrow in the md, twins in the json (role_boundarynull when never reached).Story446_UpgradeLeg.cs: all 15 facts green. The migrate-order facts locate themigrate.shcall line rather than a substring, so a directory listing in the stub log cannot match.ghis a prerequisite only when--fromis absent.🔌 T495 — v5.8.3 → current on the dev box
The current checkout's five images were built locally and tagged
home-v9.9.9(the gate requires avX.Y.Ztag, so the plan'svTESTis spelledv9.9.9).A second run under
bash -x(exit 0, 89 s) showed the real sequence on the stack:stop api→ currentmigrate.shcopied into the worktree and run ("Schema migrations up to date") →psql -U station_svc … library.mediaprintedERROR: permission denied for schema library→psql -U library_svc … station.settingsprintedERROR: permission denied for schema station→up -d api→down -v→git worktree remove --force.🔍 Review rounds worth knowing
migrate.shfrom the worktree so a stub directory listing would not match the spec's substring search, with a comment claiming the previous stack boots from an empty volume. Both false to production; fixed by matching the call line in the spec and removing the deletion.role boundary error:), likemigrate error:.📝 For later tasks
actions/checkoutneedsfetch-depth: 0orfetch-tags: true, orgit worktree add … vX.Y.Zhas no tag to check out.up -d apialso recreatesengineon the current tag (api depends on engine), which matches a real upgrade and is inside the second on-air timing.✅ Gate
Full solution,
Category!=Integration: 9 projects, 0 failed (Host 2991 passed / 127 skipped, Architecture 150 / 10).bash -nand shellcheck clean.