Refactor: Server idiomatic cleanup (thiserror, ULID panic, parking_lot, pagination) #89

Closed
opened 2026-07-08 02:40:34 +00:00 by icub3d · 0 comments
Owner

Category: Refactor / idiomatic (server) — found in code review 2026-07-07.

Collection of lower-urgency cleanups in server/:

  • Replace hand-rolled StorageError Display/Error/From impls (storage/mod.rs:21) with thiserror.
  • new_id (storage/sqlite/mod.rs:124) .expect()s on ULID overflow — panics under burst inserts. Fall back to Ulid::new(); consider dropping the global Mutex<Generator>.
  • Use parking_lot locks in the gateway registry (9 .expect("...poisoned") sites) to avoid poisoning cascades.
  • Standardize check ordering (feature flag / read-only / membership / permission / existence) across modules, and unify the pagination envelope (messages has has_more, others return bare Vec; after cursor is accepted-then-errored — implement or drop it).
  • event_json silently swallows serialization errors into None — log a warn! instead.
  • Replace blanket #![allow(dead_code)] (permissions.rs:1, storage/mod.rs:4) with targeted allows.
**Category: Refactor / idiomatic (server)** — found in code review 2026-07-07. Collection of lower-urgency cleanups in `server/`: - [ ] Replace hand-rolled `StorageError` `Display`/`Error`/`From` impls (`storage/mod.rs:21`) with `thiserror`. - [ ] `new_id` (`storage/sqlite/mod.rs:124`) `.expect()`s on ULID overflow — panics under burst inserts. Fall back to `Ulid::new()`; consider dropping the global `Mutex<Generator>`. - [ ] Use `parking_lot` locks in the gateway registry (9 `.expect("...poisoned")` sites) to avoid poisoning cascades. - [ ] Standardize check ordering (feature flag / read-only / membership / permission / existence) across modules, and unify the pagination envelope (`messages` has `has_more`, others return bare `Vec`; `after` cursor is accepted-then-errored — implement or drop it). - [ ] `event_json` silently swallows serialization errors into `None` — log a `warn!` instead. - [ ] Replace blanket `#![allow(dead_code)]` (`permissions.rs:1`, `storage/mod.rs:4`) with targeted allows.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
icub3d/decentcom#89
No description provided.