Cut public message path over to ConversationStore; delete PublicTimelineStore

Mesh and geohash timelines are now store conversations. All public
mutation sites flow through store intents; PublicMessagePipeline keeps
its 80ms UI batching but commits batches via store appends with each
buffered entry carrying its destination conversation (a mid-batch
channel switch now flushes instead of dropping the buffer).
ChatViewModel.messages becomes a cached get-only view of the active
conversation, invalidated through the change subject. The mesh
late-insert threshold is consciously removed: it only ever ordered the
non-rendered messages copy, so strict timestamp insertion makes the
working set agree with rendered order. PublicTimelineStore and the
per-message full-array legacy sync are deleted; the coalescing bridge
mirrors public conversations for the remaining legacy readers.

pipeline.publicIngest: 6.6k -> 9.5k msg/s (+45%); private steady;
store.append 237k/s.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
jack
2026-06-11 13:03:07 +02:00
co-authored by Claude Fable 5
parent 879d8cba12
commit 99d1d1dccd
26 changed files with 713 additions and 875 deletions
@@ -389,9 +389,9 @@ final class PerformanceBaselineTests: XCTestCase {
/// Baseline for the full public-message ingest cycle through a real
/// `ChatViewModel`: `didReceivePublicMessage` (transport delegate entry,
/// main-actor Task hop per message) `handlePublicMessage` (rate limit,
/// `PublicTimelineStore` append, per-message full-array
/// `LegacyConversationStore` sync) `PublicMessagePipeline` timer-batched
/// flush into `ChatViewModel.messages` `PublicChatModel` mirror.
/// pipeline enqueue) `PublicMessagePipeline` timer-batched flush into
/// the `ConversationStore` (derived `ChatViewModel.messages` view)
/// coalesced `LegacyConversationStoreBridge` mirror `PublicChatModel`.
/// Measures until `messages` and the feature model reflect every message,
/// so the pipeline's flush latency is part of the cycle. Senders are
/// spread 4-per-peer to stay under the 5-token sender rate bucket.
@@ -567,13 +567,11 @@ private final class PerfNostrContext: ChatNostrContext {
}
var messages: [BitchatMessage] = []
func resetPublicMessagePipeline() {}
func updatePublicMessagePipelineChannel(_ channel: ChannelID) {}
func flushPublicMessagePipeline() {}
func refreshVisibleMessages(from channel: ChannelID?) {}
func addPublicSystemMessage(_ content: String) {}
func drainPendingGeohashSystemMessages() -> [String] { [] }
func appendGeohashMessageIfAbsent(_ message: BitchatMessage, toGeohash geohash: String) -> Bool { true }
func synchronizePublicConversationStore(forGeohash geohash: String) {}
private(set) var handledPublicMessageCount = 0
func handlePublicMessage(_ message: BitchatMessage) { handledPublicMessageCount += 1 }