build: the engine cannot come back from quartz (marmot-kmp, Phase 7)

marmotAudit runs docs/scripts/marmot-kmp-imports.sh --check from `check`, beside the M3,
brand and wallet audits. Verified both ways: silent on a clean tree, and on a tree with
one import put back it names the file and the line and fails with a pointer to the note.
That is C2 made enforceable -- a cherry-pick from a Bennu still on quartz 1.15.2 brings
the old spelling back, and "re-run the rule" is advice until a build failure makes it a
step.

The other three items of this phase are named in the note rather than done, each for a
reason:

- The app's own copies: nothing to delete. CommitOrdering is still live in NostrDao's
  reindex sweep and MarmotInboundManager's epoch tracker, and marmot-kmp has no
  CommitOrdering at all -- the convergence engine replaced the idea, not the class. Under
  D4 the legacy pipeline keeps its behaviour, so the comparator retires with the profile.
- The sender ratchet record wants a new table, so schema 36 -> 37 and an AutoMigration,
  and the interface says the write MUST be durable before it returns or a lost position
  reuses an AEAD key and nonce pair. A per-message write path with a correctness hazard
  does not belong in the tail of a migration whose discipline was D5. It is the obvious
  next task, and it is the same shape as the receive-side write Phase 5 pinned: one piece
  of work that decides how often this app persists a group, in both directions.
- Durable ingest dedup is taken by MarmotManager, not by MarmotInboundProcessor, so it
  needs the client D1 deferred. Phase 3 is where that stopped being hypothetical.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5 committed 2026-11-19 00:16:21 +02:00
1 parent 3b2b5e3614
commit f0f1c179df
2 files changed
+77

No files matched your search

+39
View File
@@ -437,6 +437,45 @@ val walletAudit = tasks.register("walletAudit") {
tasks.named("check") { dependsOn(walletAudit) }
/**
* That the Marmot engine stays marmot-kmp's (docs/marmot-kmp.md, Phase 7): no import of a
* class quartz 2.3.0 dropped. quartz keeps the event classes -- `KeyPackageEvent`,
* `WelcomeEvent`, `GroupEvent`, the MIP-05 push events -- and those are not reported; the
* engine around them is not quartz's at any version the app can resolve, so an import of
* it does not compile here anyway.
*
* It is in `check` for the same reason [brandAudit] is: the fork cherry-picks from a
* Bennu that is still on quartz 1.15.2 with the engine inside it, and every line this
* guards is a line such a pick will conflict in. The audit is what turns "resolve it by
* re-running the rule" from advice into a build failure if somebody doesn't.
*/
val marmotAudit = tasks.register("marmotAudit") {
group = "verification"
description = "Checks that the Marmot engine still comes from marmot-kmp."
val script = rootProject.layout.projectDirectory.file("docs/scripts/marmot-kmp-imports.sh").asFile
val projectDirectory = rootProject.layout.projectDirectory.asFile
doLast {
val bash = listOf("/bin/bash", "/usr/bin/bash").firstOrNull { File(it).canExecute() }
if (bash == null) {
logger.warn("marmotAudit: no bash found, skipping. Run docs/scripts/marmot-kmp-imports.sh --check by hand.")
return@doLast
}
val result = providers.exec {
commandLine(bash, script.absolutePath, "--check")
workingDir = projectDirectory
isIgnoreExitValue = true
}
logger.lifecycle(result.standardOutput.asText.get())
if (result.result.get().exitValue != 0) {
throw GradleException("quartz's Marmot engine is back. See the report above, and docs/marmot-kmp.md.")
}
}
}
tasks.named("check") { dependsOn(marmotAudit) }
compose.desktop {
application {
mainClass = "mobi.giza.desktop.MainKt"
+38
View File
@@ -567,6 +567,44 @@ Four things, each its own commit, none of them required by the move:
**Check:** `./gradlew check`, with the new guard in it.
**The guard is built; the other three are named rather than done, and here is why each.**
`marmotAudit` runs `docs/scripts/marmot-kmp-imports.sh --check` from `check`, beside the
M3, brand and wallet audits. Verified both ways: silent on a clean tree, and on a tree
where one import is put back it names the file and the line and fails the build with a
pointer to this note. That is the whole point of C2 — a cherry-pick from a Bennu still on
quartz 1.15.2 brings the old spelling back, and the resolution is to re-run the rule, which
is advice until a build failure makes it a step.
**The app's own copies: nothing to delete.** `CommitOrdering` is still live, in
`NostrDao`'s reindex sweep and in `MarmotInboundManager`'s epoch tracker, and marmot-kmp
has no `CommitOrdering` at all — the convergence engine replaced the idea rather than the
class. Under D4 the legacy pipeline keeps its behaviour, so the comparator stays until the
legacy profile retires with it. The KDoc that used to cite
`com.vitorpamplona.quartz.marmot.mls.group.MlsGroup` now cites mls-kmp's, and the sentence
about quartz 1.14.0's own `CommitOrdering` stays as the historical note it always was.
**The sender ratchet record: a schema change, and it should be its own.** The store's
`saveSenderRatchet`/`loadSenderRatchet` default to `false`/`null`, and the manager then
falls back to a full `save()` — which is *correct*, just expensive: it re-encodes the
ratchet tree, the group context and every epoch secret to persist a counter, per message,
growing with the group. Implementing the pair means a new table, so schema 36 → 37 and an
`AutoMigration`, and the interface's own words are that the write MUST be durable before
it returns or a lost position re-emits a generation already used and reuses an AEAD key
and nonce pair. That is a change to a per-message write path with a correctness hazard
attached, and it does not belong in the tail of a migration whose whole discipline was D5:
no new behaviour inside the swap. It is the obvious next task, and it is the same shape as
the receive-side write Phase 5 pinned — worth doing as one piece of work that decides how
often this app persists a group, for both directions at once.
**Durable ingest dedup: not reachable without `MarmotManager`.**
`MarmotIngestDedupStore` is taken by the client, not by `MarmotInboundProcessor`, so the
follow-up marmot-v2.md's Phase 5 asked for is only available by adopting the client — the
question D1 deferred. Phase 3 is where that stopped being hypothetical: a `MarmotManager`
now runs in this repo's tests and the app's own orchestration agrees with it. What is left
is a decision about what owns the stores and the publisher in the app, not a question
about whether the library's client works.
## Out of scope
`marmot-quic` and agent text streams. MIP-04 encrypted media and the Blossom image