Files
buzz/desktop/src/features
npub1g8493u0xfsjrvflg4n08ezd7vec99mnwzlv0qgwpr9d7gvjwhuzqx59rhw 28c000f372 fix(read-state): close Thufir pass-1 findings in nip-rs unread UI (slice 3)
CRITICAL 1: Make manager liveness sole verdict for manual-unread.
- Active-community unread memo now derives forced-unread from
  getOverrideLiveness(channelId)?.active, not forcedUnreadRef membership.
  forcedUnreadRef is an optimistic local cache; liveness is authoritative.
- communityUnreadObserver: switch from mergeReadStateEvents (frontier-only)
  to mergeReadStateEventsStructured; evaluate isOverrideActive(S,C,B,F) from
  the merged override registers instead of gating the local cache against the
  frontier baseline.

CRITICAL 2: Explicit mark-read as one outcome-bearing transition.
- applyOverrideRead now returns OverrideReadOutcome instead of void.
  Order: frontier advance → C-bump → re-read liveness.
  Clears local presentation only when liveness is confirmed inactive.
  null ≠ inactive: pre-init returns overrideStillActive (fail-closed).
  already_inactive race: silent success (overrideCleared).
- markChannelRead and markAllChannelsRead gate the local cache delete
  on outcome === "overrideCleared".

IMPORTANT 1: No local mutation on refusal.
- useChannelUnreadState.handleMarkUnread now calls markChannelUnread first
  and does not add to forcedUnreadRef; the session-level timeline overlay
  is not set before or on refusal.

IMPORTANT 2: Tests exercise production code.
- Delete handwritten simulations and assert.ok(true) placeholder.
- Import and invoke applyOverrideUnread, applyOverrideRead,
  persistForcedUnread, overrideErrorMessage directly with injected deps.
- Witnesses: null-liveness pre-init, inactive-without-C-bump, active-success,
  active-uint32_overflow refusal, active-load_incomplete refusal,
  already_inactive race, persistForcedUnread refresh-on-existing-entry.
- Test count: 19 → 27.

MINOR 1: OverrideAPIs functions now required (no optional-chain fail-open).
MINOR 2: Remove duplicate MarkResult/OverrideLiveness from forcedUnreadStore;
  move overrideErrorMessage/toast policy to readStateOverride.ts.
Also fix persistForcedUnread to refresh existing entries (re-mark after
a dead override uses the current frontier as baseline).

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-07-31 17:13:39 -04:00
..
2026-07-27 16:45:34 -04:00