Problem
replace_addressable_event (~150 lines) and replace_parameterized_event (~200 lines) in lib.rs contain complex transactional SQL with advisory locks, stale-write detection, NIP-16/NIP-33 replacement semantics, and mention indexing. This is event-storage logic that belongs with the other event operations.
Proposed change
Move both methods into event.rs (where insert_event, query_events, soft_delete_event already live). Alternatively, if event.rs grows too large, create a dedicated replaceable.rs module. The event_replacement_lock_key helper function (currently in lib.rs) moves with them.
Priority
Medium — high-complexity code in the wrong location, naturally done alongside #2.
🤖 AI review update (2026-08-23)
Do this together with #4 and the narrow transaction work from #3. Prefer a dedicated replaceable.rs rather than growing event.rs beyond its current size. The module should own coordinate construction, advisory locking, stale-write/tie semantics, replacement mutation, mention indexing, and focused concurrency/rollback tests.
Problem
replace_addressable_event(~150 lines) andreplace_parameterized_event(~200 lines) inlib.rscontain complex transactional SQL with advisory locks, stale-write detection, NIP-16/NIP-33 replacement semantics, and mention indexing. This is event-storage logic that belongs with the other event operations.Proposed change
Move both methods into
event.rs(whereinsert_event,query_events,soft_delete_eventalready live). Alternatively, ifevent.rsgrows too large, create a dedicatedreplaceable.rsmodule. Theevent_replacement_lock_keyhelper function (currently inlib.rs) moves with them.Priority
Medium — high-complexity code in the wrong location, naturally done alongside #2.
🤖 AI review update (2026-08-23)
Do this together with #4 and the narrow transaction work from #3. Prefer a dedicated replaceable.rs rather than growing event.rs beyond its current size. The module should own coordinate construction, advisory locking, stale-write/tie semantics, replacement mutation, mention indexing, and focused concurrency/rollback tests.