Skip to content

calternal_collab::repeats

Read-only detector for Note bodies damaged by the room epoch bug (see crate::stored): a tab that merged its old document into a rebuilt room saved the whole body twice, and each later restart doubled it again. The damaged body is therefore an exact repeat of one top-level block sequence.

#634 also detects identical adjacent blocks that share an explicit anchor. Repeated prose without a shared identity can be intentional and is not a repair candidate. Nothing here writes. The operator lists the Notes with calternal-server find-repeated-notes <user-id> and restores each one from its version history. Adjacent anchored copies can also be removed through the explicit editor action, with a repair-only Undo (#634).

Source: crates/calternal-collab/src/repeats.rs

pub fn adjacent_duplicate_ids(body: &str) -> Vec<String>

List the IDs of identical adjacent top-level blocks for review (#634, DESIGN §§9, 33). No normalization or removal: a changed copy is ambiguous. This uses the same canonical tree as the live room and editor repair.

Source: crates/calternal-collab/src/repeats.rs:18

pub fn repeat_count(body: &str) -> Option<usize>

How many times the body repeats one top-level block sequence: Some(n) with n >= 2 for a body that is exactly n copies of the same blocks, else None. An unparsable or empty body is None.

Two identical blocks in a row (for example two rules) also count; the list is for review, not for automatic repair.

Source: crates/calternal-collab/src/repeats.rs:40