feat(projects): a late member is told what the room's work is for

Phase 5 of docs/project-feature.md. Three kinds appended to
`ChronicleEvent.APPLY_ORDER`, which is all the mechanism needs:
`CHRONICLABLE_KINDS`, `applyRank`, `inApplyOrder` and `isChroniclable` all derive
from that one list, and `signedEventsOf` already filters on it.

Appending is not arbitrary. A membership is a foreign key into both a project
and a version, so it has to apply after everything it can name, and putting the
three on the end gets that right by construction -- everything a project groups
is already above it. A page in the wrong order is a refused insert on the one
device with nothing to fall back on.

Then four existing tests failed, and each was telling the truth.

Three of them compare what a seeded room chronicles against CHRONICLABLE_KINDS
itself, so a kind added to the set and not to the seed fails them. That is the
point of writing them that way, so the project went into the canonical seed in
both chronicle suites rather than into a helper beside them.

The fourth is the one worth reading. `every chroniclable kind has a round-trip
test above` asserts that every kind a chronicle carries can also be rebuilt from
its row -- and projects deliberately cannot, because the rebuild exists for
rooms older than schema v13 and projects arrive at v21. So the meta-test now
excludes them explicitly, and the gap is pinned where it actually bites: `a
project is only ever chronicled off the record` holds a project whose
`GroupSignedEvent` is missing and shows the row is there and the chronicle is
not. That is reachable -- `recordSignedEvents` catches its own failure so a
ceremony that succeeded is not reported as failed -- and it is worth knowing is
possible rather than worth preventing.

`the rebuild alone reaches everything but the projects` pins the other side, so
anyone adding a `toProjectEvent` fails a test that tells them where the comment
explaining why is.

Also corrected a stale count in the allowlist's own comment: it said six of
thirteen nip30303 kinds reach a signing session while the list below it had
eight. Eleven of sixteen now, with `SubmissionEvent` named among the exclusions
since it is the envelope rather than the work.

1403 tests, no failures.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso Ngako
2026-10-02 19:27:02 +02:00
parent 9430396e5a
commit 5fac2fc7b7
5 changed files with 327 additions and 5 deletions

View File

@@ -19,6 +19,9 @@ import press.mantra.compose.nostr.nip30303.ArtifactVersionEvent
import press.mantra.compose.nostr.nip30303.ChapterEvent
import press.mantra.compose.nostr.nip30303.ChunkEvent
import press.mantra.compose.nostr.nip30303.DialectEvent
import press.mantra.compose.nostr.nip30303.ProjectArtifactVersionEvent
import press.mantra.compose.nostr.nip30303.ProjectEvent
import press.mantra.compose.nostr.nip30303.ProjectTranslationArtifactVersionEvent
import press.mantra.compose.nostr.nip30303.TranslationArtifactVersionEvent
import press.mantra.compose.nostr.nip30303.TranslationChapterEvent
import press.mantra.compose.nostr.nip30303.TranslationChunkEvent
@@ -167,8 +170,8 @@ class ChronicleEvent(
* ### What is missing from it, and why
*
* **Only kinds the group actually signs can be here**, because a chronicle
* that cannot be verified is one that has to be believed. Six of the
* thirteen nip30303 kinds reach a signing session; the rest travel as
* that cannot be verified is one that has to be believed. Eleven of the
* sixteen nip30303 kinds reach a signing session; the rest travel as
* rumors -- empty signature, member author, vouched for by the MLS frame
* they arrived in and by nothing that survives leaving it.
*
@@ -179,6 +182,8 @@ class ChronicleEvent(
* - The contributor lists (30305, 30307, 30310). `applyInnerEvent` has
* no arm that writes a row for any of them, so chronicling them would
* cost bytes and restore nothing.
* - `SubmissionEvent` (30312), which is the envelope rather than the
* work: a chronicle carries payloads.
*
* Two kinds were on that list and are not any more, because the app
* stopped leaving them unsigned. `ArtifactVersionEvent` (30301) used to be
@@ -188,6 +193,10 @@ class ChronicleEvent(
* and is now proposed to the group like everything else. Both are
* therefore checkable, and a chronicle that left them out would hand a new
* member the whole structure and none of the prose.
*
* The three project kinds (30330-30332) were signed from the day they
* existed, so they have no such story: they are here because a group's
* work includes what the work is for.
*/
private val APPLY_ORDER: List<Kind> = listOf(
DialectEvent.KIND,
@@ -198,6 +207,20 @@ class ChronicleEvent(
TranslationArtifactVersionEvent.KIND,
TranslationChapterEvent.KIND,
TranslationChunkEvent.KIND,
// Projects are last, and that is the whole of what this list says
// about them. A membership is a foreign key into both a project and
// a version, so it has to apply after everything it can name -- and
// appending gets that right by construction, since everything a
// project groups is already above it.
//
// Chroniclable where the contributor lists are not, for the opposite
// of their reason: these have an arm that writes a row, and they are
// signed rather than submitted, so a receiver can check them. A late
// member handed the whole library and no account of what any of it
// is for has been handed the smaller half.
ProjectEvent.KIND,
ProjectArtifactVersionEvent.KIND,
ProjectTranslationArtifactVersionEvent.KIND,
)
/** Every kind a chronicle may carry. */