Files
giza-kmp/docs/tools/old-state-blob
Kgothatso NgakoandClaude Opus 5 1321962b3f test: the version the app ships, opened by the version it builds (marmot-kmp, Phase 9)
Phase 4 settled the blob and left the database alone, because there was nothing
to settle: the state is opaque to Room and its version is inside it. Phase 8 added
a table, and that turns "does an existing install still open?" from a question
about MLS into a question about Room. They fail differently. A blob the engine
cannot read costs one room; a migration Room cannot find costs the app, on every
device that has ever had it, on the first launch after the update.

That second one is also the easiest here to ship by accident, because a fresh
install never migrates anything. Measured rather than assumed: with
`AutoMigration(from = 36, to = 37)` commented out, 32 database tests ran and 4
failed -- all four of them the new ones.

ShippedProfileUpgradeJvmTest builds a v36 database on disk from the exported v36
schema, down to its indices, its room_master_table identity hash and its
user_version, puts a profile and two rooms in it with the Phase 4 blob in one, and
opens it with the app's own getRoomDatabase. Four claims: it reaches v37 with
Room's own identity hash stamped and every table's columns and indices equal to
37.json's; the legacy room's bytes come back unchanged and MarmotEngine.groupFor
restores a group with its 0xF2EE metadata and a 32-byte kind:445 key; opening the
profile rewrites nothing, which is asserted only after checking the restore held
the room; and the new table takes a row keyed to a ChatRoom that predates it.

Room opens lazily, so a test that builds a database and closes it migrates
nothing. The first version of this did that and failed on user_version still
reading 36.

The blob itself moves to OldEngineBlob in commonTest, read by both tests. The
only thing those bytes are worth is that they are old ones, and a blob living in
two files can be regenerated in one of them.

1171 tests across 157 classes, 0 failures; the four audits unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-11-19 18:57:12 +02:00
..

The old engine's state blob

A throwaway project whose only dependency is the engine the app shipped before it moved to marmot-kmp: com.vitorpamplona.quartz:quartz:1.15.2. It prints a MlsGroupState TLS blob, at the STATE_VERSION = 4 that version wrote.

What it printed is pinned in OldEngineBlob, in commonTest, and two tests read it from there: MlsGroupStateCompatibilityTest decodes it with mls-kmp, and ShippedProfileUpgradeJvmTest puts it in a database at the schema version the app ships and opens that database with the app's own builder (docs/marmot-kmp.md, Phases 4 and 9). One copy, because the only thing that makes those bytes worth anything is that they are old ones, and a blob living in two files can be regenerated in one of them.

../../../gradlew --project-dir . -q run

It is here for provenance. The fixture has to be bytes the old engine wrote, so regenerating it with the engine the app now ships would defeat the point of both tests -- and once this project is gone there is no way to tell the difference by reading the hex. It is not part of the root build (its own settings.gradle.kts makes it a build of its own), and nothing in ./gradlew check runs it.

Not a general-purpose tool: it is the one blob Phase 4 of docs/marmot-kmp.md needed, and Phase 9 found a second use for rather than a second source.