feat(comments): DELETE /api/comments/{id} admin endpoint - #269
Merged
Merged
Conversation
Comment rows could only be removed by direct SQL against the
production SQLite file — the comments routes exposed no delete. That
made every dirty-row cleanup (legacy duplicates, test residue) a
manual host operation.
Add Store::delete_comment() (RowNotFound -> CommentNotFound, same as
get_comment) and a DELETE /api/comments/{id} route returning 204, or
404 COMMENT_NOT_FOUND when absent. DB-local by design: no Threads API
call — deleting someone else's comment is not possible via the Graph
API, moderation there stays with hide/unhide. Registered in OpenAPI.
Closes #267
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
Resolve conflicts with #268 (cleanup_superseded_comments + its tests) alongside delete_comment: both methods and both test blocks are kept; missing closing braces at the splice points restored; fmt/clippy/tests re-validated on the merged tree.
Contributor
Author
|
Cora (local pre-commit) raised one [MAJOR] on the merged tree worth answering with evidence:
This is a by-design tradeoff inherited from #261, not a regression:
If Meta's behavior ever changes, the correct fix is tighter identity upstream (e.g. hashing commenter-visible fields), not retaining unreconcilable rows. |
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.
What
Add
DELETE /api/comments/{id}— admin cleanup endpoint that removes a comment row from the local store (204on success,404 COMMENT_NOT_FOUNDwhen absent). IncludesStore::delete_comment()and OpenAPI registration.Why
Comment rows could only be removed by direct SQL against the production SQLite file — the comments routes exposed no delete (only list/fetch/sentiment/PATCH reply status). That made every dirty-row cleanup (legacy duplicates, misattributed fetches, test residue) a manual host operation; the production host is not SSH-reachable from agent machines, so the 2026-09-11 duplicate-row cleanup required a hand-run
sqlite3 DELETEon the host by the operator.Closes #267.
How
Store::delete_comment()mapsrows_affected == 0to the existingCommentNotFounderror (same pattern asget_comment)..delete()on the existing/api/comments/{id}route (alongside the PATCH reply-status handler) and registered in utoipa/OpenAPI.Testing
cargo test --workspacepasses — all suites green (store_comments 9/9 incl. 2 new, api_comments 2/2 new)cargo fmt --all -- --checkpassescargo clippy --workspace --all-targets -- -D warningspassesCOMMENT_NOT_FOUNDcode for unknown ids; verified no network dependency (store-layer only)Related Issues
Closes #267
Checklist
feat/)develop