Repository navigation
test(apps): migrate a reference update and refuse incompatible rollback - #586
Conversation
Repackage the official Greeting 1.0.1 archive as four signed releases with declared SQL migrations and drive them through the real app manager in a fresh appliance state: a fresh install migrates from empty state, a failing migration rolls back and restarts the previous release, an update migrates version 1 to 2, a rollback to 1.1.0 is refused as incompatible before the fence, and a committed migration whose backend fails to start stays recovery-required until recover finishes it without migrating again. The App Runtime Reference and Rust coverage jobs run it on amd64 and arm64 through a new --migrations mode of the Greeting lifecycle fixture. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
…e-migration-recovery # Conflicts: # .github/workflows/app-runtime-reference.yml
Summary
Adds an end-to-end test that runs app data migrations, the refused incompatible rollback and recovery through the real app manager on amd64 and arm64. It closes the gaps the acceptance audit found for #458 criterion 4 and #453 criteria 4 and 5.
New privileged test
core/tests/private/app_manager/lifecycle/published_greeting/data_migrations.rs. It repackages the verified official Greeting 1.0.1 archive (samebin/app,ui/,api/,LICENSE) as four releases. Each release rewritesversionanddatainapp.jsonand addsmigrations/*.sql. The test clones the official 1.0.1 catalog entry for each release and signs one catalog revision per release with the replay repository. Loopback distribution hosts serve them. The test then drives the real manager through the catalog UI in a fresh appliance state.initialize(0→1)initialize,broken(1→2: adds a column, then violatesNOT NULL)initialize,upgrade(1→2)initialize,upgrade,archive(2→3, can run twice, logs one row)Failing activation without a separate binary. Before the 1.4.0 update, the test writes
{}to the app-ownedgreeting.json(app UID, mode 0600). The official backend exits at startup on invalid state, so the migration commits and then activation fails. The test restores the file before it postsrecover.Fixture script.
app-greeting-lifecycle.shgains a--migrationsmode and a fourthrun_fixturecall withNET_BIND_SERVICEand the/greetingmount, like the existing calls. Only that run gets a 3 GiB state tmpfs instead of 1 GiB, because four archives and four staged packages of the ~50 MB Greeting build do not fit in 1 GiB. The test runs in App Runtime Reference on both architectures and in the Rust job throughrust-coverage.sh.Evidence. The test writes
greeting-migrations.json, which is uploaded with the other reference evidence.Helper reuse. Two existing helpers are made visible instead of being rewritten:
pack_fixture_archivebecomespub(crate)andportable_backup::postgresbecomespub(super).Each update needs its own catalog revision, because the manager offers only the latest newer release. The test restarts the manager after serving each revision, since the listing otherwise refreshes only every 60 s.
Assertions and criteria
initialize. Recorded data version 1, rows(1,first);(2,second), log1.operationFailed. 1.1.0 is running again in a new generation (failed activation + restart = +2) withrecoveryRequired: false. Recorded version still 1, rows and log unchanged, partialrevisioncolumn absent. Greeting andgreeting.jsonunchanged.revisionadded, rows(1,first,2);(2,second,2), log1,2. Greeting readable.incompatibleData. The generation, the running 1.3.0 release and the whole manager status are unchanged. Recorded version, rows, log, greeting andgreeting.jsonare unchanged.operationFailed. The catalog row showsrecoveryRequired, and the manager reportsrunning: false, active 1.3.0, candidate 1.4.0. Recorded version 3 and log1,2,3: the committed migration was not discarded and 1.3.0 was not restarted on version-3 data.recover1,2,3(no second migration). Greeting readable.Code fixes
None. The manager behaved as designed in every step.
Not covered
Verification
cargo check --locked --all-targetsandcargo clippy --locked --all-targets --all-features -- -D warningspass on Rust 1.99.1 in Kiri.cargo fmt --checkpasses.bun --no-env-file fmt --checkpasses for the workflow.Refs #458
Refs #453
🤖 Generated with Claude Code
Summary by CodeRabbit