Skip to content

test(native): run the whole update chain with real builds - #1884

Merged
frahlg merged 2 commits into
masterfrom
w0-6-update-chain-test
Oct 27, 2026
Merged

frahlg merged 2 commits into
masterfrom
w0-6-update-chain-test

Conversation

@frahlg

@frahlg frahlg commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Item W0-6 of the stable plan (gate G5).

Problem

Nothing tests the native update chain with real binaries. The launcher tests use a fake exec (go/cmd/ftw-launcher/main_test.go), and the site rig only ever stops Core with SIGTERM (go/test/site/stack_test.go:411). So no test shows that a box on the last beta can update to a candidate, fall back after a crash loop in probation, take a binary rollback, and keep its data.

Change

TestUpdateChain in go/cmd/ftw-launcher/update_chain_test.go, plus make update-chain. The test runs only with FTW_UPDATE_CHAIN=1, because it builds Core.

For each previous release (by default the last three betas before HEAD, each built from git archive; or this tree when FTW_UPDATE_CHAIN_FROM=tree), it:

  1. Packs both builds as ftw-linux-<arch>.tar.gz plus .sha256 and serves them through FTW_RELEASE_MIRROR.
  2. Runs ftw-launcher install and init for the previous release, starts it, and saves a mode, a grid target and a recurring charging schedule. A standalone Lua site meter in the user-drivers overlay records history.
  3. Updates through GET /api/version/check and POST /api/version/update, then restarts the launcher as systemd would. The trial commits.
  4. Stops with SIGTERM once (no crash counted), then sends SIGKILL three times inside probation. The crash count reads 1 and 2, and the third start runs the previous release with last_failed set to the candidate.
  5. Retries the candidate with {"retry": true}, then calls POST /api/version/binary-rollback. The previous release starts as a trial and commits.

At each step it checks the exact slots, the version that /api/status reports, the saved settings and goal, and that the history count did not fall.

It does not yet check that the commit comes after the first control tick. That ordering arrives with A7, which can add the check here.

Tests

  • make update-chain (v0.157.1-beta.1, v0.157.0-beta.1, v0.156.0-beta.1 to the tree): PASS, 81 s.
  • FTW_UPDATE_CHAIN=1 go test -race -run TestUpdateChain ./cmd/ftw-launcher/: PASS, 43 s (now needs FTW_UPDATE_CHAIN_FROM=tree).
  • No previous release: in a --no-tags --depth 1 clone, make update-chain fails before any build and says to fetch tags, name refs or set FTW_UPDATE_CHAIN_FROM=tree. TestChainRefs covers the empty list. make update-chain UPDATE_CHAIN_FROM=tree: PASS, 28 s.
  • Mutation check: with crashLimit raised from 3 to 4, the test fails with Core never served v0.998.0-beta.1 (last "v0.999.0-beta.1"). I reverted the change.
  • go test -race ./cmd/ftw-launcher/..., go vet ./... and go build ./...: clean.

Risk

Low. The PR adds a test and a make target and changes no Core code. Without the env var the test skips, so make test and CI do not change. It runs on arm64 and amd64 hosts with host builds. The archive matches scripts/package-linux.py, except that the energyplan bundle manifest is a stub.

🤖 Generated with Claude Code

TestUpdateChain builds Core twice, installs the previous release with
ftw-launcher, updates through FTW_RELEASE_MIRROR, kills the candidate
three times inside probation, retries it and takes a binary rollback.
Slots, the running version, two settings, a saved charging goal and
the history count are checked at each step. It runs only with
FTW_UPDATE_CHAIN=1; make update-chain starts it from the last three
betas.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@frahlg frahlg added the no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping) label Oct 27, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T13:14:22.502057Z 0e30165 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Without beta tags (shallow clone or fork) make update-chain passed an
empty FTW_UPDATE_CHAIN_FROM, and the test quietly built the previous
release from the candidate's own source. Now an empty list fails before
any build and says how to fix it. FTW_UPDATE_CHAIN_FROM=tree (or
UPDATE_CHAIN_FROM=tree) opts into the tree-only run, and the Makefile
passes a caller's FTW_UPDATE_CHAIN_FROM through.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@frahlg
frahlg merged commit 53bf2a0 into master Oct 27, 2026
23 checks passed
@frahlg
frahlg deleted the w0-6-update-chain-test branch November 11, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changeset PR intentionally exempt from the changeset requirement (dev tooling / non-shipping)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant