fix(report): allow community_watch_* reasons in DB check constraint#4844
Merged
Conversation
The GraphQL ReportReason enum declares community_watch_porn_ad and community_watch_spam_ad, but report_reason_check (from 20231221154057) was never updated to permit them. submitReport inserts the raw reason, so any report with those values failed in production with a report_reason_check violation (INTERNAL_SERVER_ERROR) — surfaced by the coastguard bot's Tier-1 reports. Realign the DB constraint with the schema. communityWatchRemoveComment is unaffected (it syncs illegal_advertising, not these values). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4844 +/- ##
===========================================
+ Coverage 72.82% 73.03% +0.21%
===========================================
Files 1054 1066 +12
Lines 21263 21638 +375
Branches 4671 4808 +137
===========================================
+ Hits 15485 15804 +319
+ Misses 5706 5354 -352
- Partials 72 480 +408 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jun 15, 2026
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.
Problem
The GraphQL
ReportReasonenum (src/types/system.ts) declarescommunity_watch_porn_adandcommunity_watch_spam_ad, but thereport.reasonDB check constraint (report_reason_check, from20231221154057_alter_report_add_reason) only allows the original five values.submitReportinserts the raw reason, so any report submitted with either community_watch value fails in production:Surfaced live by the coastguard bot's Tier-1 reports (it sent
community_watch_porn_adand every insert was rejected).Fix
Migration realigns the DB check constraint with the schema — adds the two community_watch values. The enum is the contract; the constraint had drifted.
communityWatchRemoveCommentis unaffected: it syncsillegal_advertising(not these values) into the report table.Notes / follow-up
src/queries/system/oss/reports.ts) filtersreason = 'illegal_advertising'; community_watch_* reports won't appear there. If those should surface in that view, that's a separate product decision.submitReportresolver, or drop them from the submittable enum. Chose the migration since the enum already advertises them as validReportReasonvalues with doc comments — the DB was simply stale.Test plan
submitReportwithcommunity_watch_porn_ad/community_watch_spam_adsucceedscommunityWatchRemoveCommentstill works (illegal_advertising)downmigration restores the original five-value constraint🤖 Generated with Claude Code