test: pin the state version a save is written at (quartz-mls-marmot-update, Phase 4)
C1 measured again on mls-kmp 1.3.1: the old-blob, shipped-profile, store, sender-ratchet, skipped-generation and fork tests are green untouched, and the authored fork is still open. The re-save test only said "newer than 4", which a library that moved to 11 would pass, though a bump is what an older build cannot read back; the seventh case pins 10 exactly, checked red at 11. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a08a878935
commit
0b43295aff
2 files changed
+50
No files matched your search
+25
@@ -120,6 +120,26 @@ class MlsGroupStateCompatibilityTest {
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The version a save is written at today, exactly. The test above only says "newer
|
||||
* than the old engine's", which a library that moved to 11 would still pass. But a
|
||||
* bump changes what every device writes on its next save, and a build older than
|
||||
* that library cannot read the result back -- so a downgrade, or a peer device on an
|
||||
* older build sharing a backup, loses the room. When this fails, read the library's
|
||||
* upgrading guide for what the new version appends and whether `decodeTls` still
|
||||
* takes 4, and only then move the number. docs/quartz-mls-marmot-update.md, Phase 4.
|
||||
*/
|
||||
@Test
|
||||
fun `a save is written at the state version this app was checked against`() {
|
||||
val group = MlsGroup.restore(MlsGroupState.decodeTls(OldEngineBlob.HEX.hexToByteArray()), MarmotGroupPolicy)
|
||||
|
||||
assertEquals(
|
||||
CHECKED_STATE_VERSION,
|
||||
OldEngineBlob.stateVersionOf(group.saveState().encodeTls()),
|
||||
"mls-kmp writes a new state version -- check what it appends before moving this",
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* The retained-epoch window is the app's own rows, not an opaque blob:
|
||||
* `RoomMlsGroupStateStore` decodes each one into five columns and re-encodes it from
|
||||
@@ -146,4 +166,9 @@ class MlsGroupStateCompatibilityTest {
|
||||
assertEquals(3, back.leafCount)
|
||||
assertContentEquals(retained.exporterSecret, back.exporterSecret)
|
||||
}
|
||||
|
||||
private companion object {
|
||||
/** mls-kmp 1.3.0 and 1.3.1 both write 10. */
|
||||
const val CHECKED_STATE_VERSION = 10
|
||||
}
|
||||
}
|
||||
@@ -483,6 +483,31 @@ No schema change is expected: no table and no column moves.
|
||||
|
||||
**Check:** the five tests green with their assertions untouched, and this table filled in.
|
||||
|
||||
**Built.** All six classes in the table are green on quartz 2.20.0, marmot 2.3.0 and mls
|
||||
1.3.1, with no assertion touched:
|
||||
|
||||
| class | tests | result |
|
||||
|---|---|---|
|
||||
| `MlsGroupStateCompatibilityTest` | 6, now 7 | green |
|
||||
| `ShippedProfileUpgradeJvmTest` | 4 | green |
|
||||
| `RoomMlsGroupStateStoreJvmTest` | 5 | green |
|
||||
| `SenderRatchetPersistenceJvmTest` | 5 | green |
|
||||
| `SkippedGenerationJvmTest` | 4 | green |
|
||||
| `ConvergenceForkJvmTest` | 2 | green; its `assertNotEquals` held, so the authored fork is still open, as marmot-kmp's unchanged `MlsCandidateStateEngine` predicts |
|
||||
|
||||
There is no schema change: the app is at schema 42, and nothing in this update touches a
|
||||
table.
|
||||
|
||||
**One correction to this phase as written.** The table above says that if mls had bumped
|
||||
`STATE_VERSION`, "the re-save is version 10 assertion fails". There was no such assertion.
|
||||
The re-save test asserts only that the version is *greater than 4*, which a library at 11
|
||||
would also pass. A bump matters because it changes what every device writes on its next
|
||||
save, and an older build cannot read that back: a downgrade loses the room. So the
|
||||
compatibility test has a seventh case pinning the exact version a save is written at,
|
||||
`CHECKED_STATE_VERSION = 10`, with a message that says to read the library's upgrading
|
||||
guide before moving it. It was checked both ways: green at 10, and red at 11 with
|
||||
"expected:<11> but was:<10>".
|
||||
|
||||
## Phase 5 — past marmot's pins
|
||||
|
||||
Two commits, in this order, each reverting on its own.
|
||||
|
||||
Reference in new issue
Block a user