Fix 5 bugs: persistence, join-links, stack overflow, storage ordering, pinned messages#97
Merged
Merged
Conversation
…, pinned messages (#44, #45, #61, #83, #94) - #61: Add missing `pinned_messages: BTreeSet<EventHash>` field to `willow_channel::Channel` with serde(default) for backward compat. Add state-level pin/unpin tests. - #44: PersistEvent handler now writes events to disk via new `storage::save_events()`/`load_events()` functions, following the same pattern as PersistServerState. Add round-trip storage tests. - #94: Replace recursive `insert_and_apply()` with iterative VecDeque work queue to prevent stack overflow on deep pending chains (3000+). Cache pending count in PendingBuffer for O(1) evict_to instead of O(n²). Add deep-chain and eviction performance tests. - #83: Change history() ORDER BY from `timestamp_hint_ms DESC` to `seq DESC, hash ASC` for deterministic ordering. Replace silent `.ok()` in 6 locations with `tracing::warn!` logging for corrupt event data and DB read errors. Add deterministic ordering and corruption resilience tests. - #45: Wire `server_registry` into `ListenerCtx` and replace hardcoded `None::<String>` in JoinRequest handler with actual invite generation via `invite::generate_invite()`. Add invite-via-endpoint-id test. https://claude.ai/code/session_01WYFM1sZdwSPoQF8CakdCZm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pinned_messages: BTreeSet<EventHash>field towillow_channel::Channelwith#[serde(default)]for backward compatPersistEventhandler now writes events to disk via newstorage::save_events()/load_events(), matching every other persist handler's patterninsert_and_apply()with iterativeVecDequework queue (prevents stack overflow on 3000+ deep chains); cachepending_countfor O(1) eviction instead of O(n²)history()ORDER BY fromtimestamp_hint_ms DESCtoseq DESC, hash ASCfor deterministic ordering; replace 6 silent.ok()calls withtracing::warn!for corrupt event dataserver_registryintoListenerCtxand replace hardcodedNone::<String>inJoinRequesthandler with actualinvite::generate_invite()callTest plan
cargo fmt— cleancargo clippy -D warnings— zero warningscargo test --workspace— all pass (0 failures)cargo check --target wasm32-unknown-unknownpasseshttps://claude.ai/code/session_01WYFM1sZdwSPoQF8CakdCZm