Merge branch 'mantra' into claude/rename-archive-chronicle-a4a8e0

The rebuild deprecation landed on mantra while the rename was in flight, and it
touched the same files by their old names. Git matched the renames itself, so
the only conflict was `ChronicleRoundTripTest`'s header, where both sides had
rewritten the same paragraph: mantra's says this file is now the gate on a
deprecated fallback rather than on the only path, which is the newer and truer
claim, so it wins and the rename is applied on top of it.

Everything the merge brought in went through the same substitution as the rest:
the nine `@Deprecated` messages and the "Retiring the rebuild" checklist all name
`ChronicleManager`, `ChronicleRoundTripTest` and docs/member-chronicle.md, which
are the files that now exist.

797 tests pass -- 500 jvm, 297 android. The five new ones are the migration's.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5 committed 2026-09-06 16:29:23 +02:00
commit 4890906b24
11 files changed
+170 -13

No files matched your search

@@ -87,6 +87,11 @@ data class MantraArtifact(
* wrong here until a chronicle needed to rebuild an artifact and nothing had
* ever called this.
*/
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toArtifactEvent(versionLabel: String): ArtifactEvent {
return ArtifactEvent(
id = id,
@@ -66,6 +66,11 @@ data class MantraArtifactVersion(
override val createdAt: Instant = Clock.System.now(),
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toArtifactVersionEvent(): ArtifactVersionEvent {
return ArtifactVersionEvent(
id = id,
@@ -71,6 +71,11 @@ data class MantraChapter(
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toChapterEvent(): ChapterEvent {
return ChapterEvent(
id = id,
@@ -67,6 +67,11 @@ data class MantraChunk(
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toChunkEvent(): ChunkEvent {
return ChunkEvent(
id = id,
@@ -56,6 +56,11 @@ data class MantraDialect(
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toDialectEvent(): DialectEvent {
return DialectEvent(
id = id,
@@ -75,6 +75,11 @@ data class MantraTranslationArtifactVersion(
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toTranslationArtifactVersionEvent(): TranslationArtifactVersionEvent {
return TranslationArtifactVersionEvent(
id = id,
@@ -70,6 +70,11 @@ data class MantraTranslationChapter(
override val createdAt: Instant = Clock.System.now(),
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toTranslationChapterEvent(): TranslationChapterEvent {
return TranslationChapterEvent(
id = id,
@@ -72,6 +72,11 @@ data class MantraTranslationChunk(
override val updatedAt: Instant = createdAt
): OptionalNostrEventEntity, TimestampedEntity {
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. Read the " +
"event off that table instead; this rebuild goes when the last pre-v13 install " +
"does -- see the removal checklist in docs/member-chronicle.md."
)
fun toTranslationChunkEvent(): TranslationChunkEvent {
return TranslationChunkEvent(
id = id,
@@ -42,8 +42,10 @@ import press.mantra.compose.nostr.frost.GroupKeyStateEvent
* signed; `ChronicleRoundTripTest` is what says it is, per kind, against a real
* quorum, and it found two faults in the artifact's rebuild the first time it
* ran -- both of which would have shipped payloads that every receiver drops as
* forgeries without a word. The fallback can go once no install still holds
* pre-v13 work.
* forgeries without a word. Both it and everything that exists only to hold it
* up are marked `@Deprecated`; the fallback can go once no install still holds
* pre-v13 work, and docs/member-chronicle.md's "Retiring the rebuild" is the list
* of what goes with it.
*
* **The allowlist does real work on the way out now.** The rebuild could only
* ever produce document kinds; the table holds everything the group has ever
@@ -662,7 +664,18 @@ object ChronicleManager {
*
* It returns everything it can rebuild and lets [signedEventsOf] and the
* verify filter decide what can travel.
*
* Deprecated rather than merely legacy: it is a whole mechanism kept alive
* for a shrinking set of rows, and it takes eight `toXEvent()` methods and a
* ten-case round-trip suite with it. **docs/member-chronicle.md, "Retiring the
* rebuild", is the checklist** -- what goes, what only looks like it goes,
* and the one thing that has to be true before any of it can.
*/
@Deprecated(
"Chronicle fallback for work signed before the GroupSignedEvent table. " +
"Goes when the last pre-v13 install does -- see the removal checklist " +
"in docs/member-chronicle.md."
)
private suspend fun rebuiltEventsOf(
database: MantraDatabase,
chatRoomId: String,
@@ -39,22 +39,30 @@ import press.mantra.compose.nostr.nip30303.TranslationChapterEvent
import press.mantra.compose.nostr.nip30303.TranslationChunkEvent
/**
* The assumption the whole chronicle rests on: a row can be turned back into the
* event the group signed.
* The assumption the chronicle's *fallback* rests on: a row can be turned back
* into the event the group signed.
*
* Signed events are not stored as events. `FrostSigningManager.complete` applies
* them and what survives is a `Mantra*` row, so a chronicle has to rebuild each
* one with `toXEvent()` and hope it comes out byte-identical. If it does not,
* the id changes, the signature no longer covers it, and every receiver drops
* the payload as a forgery -- silently, one kind at a time.
* Signed events used to be stored only as rows. `FrostSigningManager.complete`
* applied one and what survived was a `Mantra*` row, so a chronicle had to
* rebuild each payload with `toXEvent()` and hope it came out byte-identical --
* and if it did not, the id changed, the signature no longer covered it, and
* every receiver dropped the payload as a forgery, silently, one kind at a time.
*
* That is what the round-trip note on each `toXEvent` claims and what nothing
* asserted until now. Every kind in `ChronicleEvent.CHRONICLABLE_KINDS` is checked
* here against a real FROST quorum, because a signature that verifies is the
* only evidence that the rebuild is faithful -- comparing fields would only
* asserted until this ran. Every kind in `ChronicleEvent.CHRONICLABLE_KINDS` is
* checked here against a real FROST quorum, because a signature that verifies is
* the only evidence that the rebuild is faithful -- comparing fields would only
* prove the test and the code agree about which fields matter.
*
* A kind that fails here cannot be chronicled at all, whatever the allowlist says.
* ### Deprecated, along with what it guards
*
* `GroupSignedEvent` keeps the events now, and `ChronicleManager.assemble` reads
* them; the rebuild survives only for work signed before that table existed, and
* so does this. Nothing else covers the `toXEvent()` methods, so **this whole
* file goes when they do** -- see "Retiring the rebuild" in
* docs/member-chronicle.md. Until then a kind that fails here cannot be chronicled
* *from a row*, whatever the allowlist says, which for a pre-v13 room is the
* same thing as not at all.
*/
class ChronicleRoundTripTest {
private val participants = 3