issue: complete deletion operations and integration b905

This commit is contained in:
DanConwayDev
2026-01-14 10:39:13 +00:00
parent 1af88cac7d
commit f01f65d49c
+25
View File
@@ -558,6 +558,31 @@ Kind 5 Event → Validate → Query Dependents → Archive Git → Move Events
- Database move operations (`move_to_holding_database()` for atomic event movement)
- Comprehensive tests for deletion validation and cascade behavior
### 2026-01-14 [Session 11:00]
- **Completed Event Dependency Queries:** Created `src/nostr/policy/deletion_ops.rs`
- `query_dependent_events()` - Recursive traversal to find all dependent events
- Queries events with `a` tags referencing addresses (kind 30617 announcements)
- Queries events with `e` tags referencing other events (PRs, issues, patches, status)
- Simple cascade for Phase 1 (graph algorithm deferred to Phase 3)
- Helper functions: `query_events_by_address_tag()`, `query_events_by_event_tag()`
- Tag checking: `has_address_tag()`, `has_event_tag()`
- **Completed Database Migration:** Implemented `move_to_holding_database()`
- Atomic operation to move events from main DB to holding DB
- Creates DeletionMetadata with deletion timestamp, event ID, and expiry
- Stores events in holding DB with metadata as custom tags
- Logs warnings about API limitation (can't delete from main DB yet)
- Returns count of successfully moved events
- **Integrated Deletion Processing:** Updated `src/nostr/builder.rs`
- Create holding database in `create_relay()` (unless disrespector mode)
- Add `holding_database` field to `Nip34WritePolicy`
- Implement full deletion processing in `handle_deletion()`:
- Query dependent events using `query_dependent_events()`
- Move all events to holding database with `move_to_holding_database()`
- Log success/failure with event counts
- Handle missing holding database gracefully
- All 344 tests passing
- **Next:** Write comprehensive integration tests for Phase 1 deletion flow
## References
- **Explanation:** `docs/explanation/deletion-requests.md`