# Content Reporting

## Objective

Let users flag content that needs a human to look at it.

A reporting flow that captures a reason, a snapshot of context, and enough signal for a moderator — without exposing the reporter.

## Before You Begin

This feature is being added to an application that already exists and already
works. Do not scaffold a new project, and do not assume a blank slate.

Inspect the codebase first and establish:

- The existing application structure and where code of this kind already lives.
- The framework and version in use.
- The existing design system — colours, spacing, typography, and component conventions.
- Existing UI components you can reuse instead of writing new ones.
- The existing database structure, if this feature needs to persist anything.
- The existing authentication and authorization system, if this feature is user-scoped.
- Dependencies already installed, so you don't add a library that duplicates one.
- The existing test setup and conventions.

Only start writing code once you understand the above. If the application
already implements part of this feature, extend it rather than replacing it.

## Implementation Instructions

1. Add a report action to every user-generated surface: posts, comments, profiles, files, messages. Offer a short list of concrete reasons plus an optional free-text field.
2. Capture the context a moderator needs at the moment of reporting — the content ID, its current body, the author, and a timestamp — so the review is not dependent on the content still existing.
3. Give the reporter an immediate self-serve action alongside the report: hide this item, mute this author, or both. A report that takes hours to review leaves the user staring at the thing they reported.
4. Never tell the reporter what a moderator decided, who reviewed it, or whether the author was actioned. Confirm receipt and stop there.
5. Do not collect more than the report needs. Copying private message threads or unrelated account data into a report record turns moderation tooling into a privacy incident.

## UI and UX Requirements

Match the application's existing design system exactly. Reuse its components,
spacing, and typography. This feature should look like it was always there.

## Responsive Requirements

Works on mobile, tablet, and desktop. Touch targets are large enough to hit on a
phone, and nothing overflows horizontally at 320px.

## Accessibility Requirements

- Fully keyboard navigable.
- Correct semantic elements and ARIA roles.
- Visible focus states.
- Meets WCAG AA contrast.
- Dynamic changes are announced to screen readers.
- Respects prefers-reduced-motion.

## Edge Cases

- A user reporting their own content should be refused with a plain explanation, not silently accepted.
- Repeat reports of the same item by the same user must collapse into one report, not inflate the count.
- Rate-limit reporting per user and per target. Coordinated mass-reporting is an attack, and volume must not by itself trigger automatic removal.
- A report against already-deleted content must still be reviewable, using the captured snapshot.
- Anonymous or logged-out reporting, if allowed, needs its own abuse controls and a way to reply — otherwise require sign-in.
- Reports about the reporter's own safety may need a faster path than the normal queue; define which reasons escalate.

## Testing

Exercise the feature end to end in the running application. Cover every edge case
above, then run the existing test suite and confirm nothing regressed.

## Acceptance Criteria

- [ ] Every user-generated surface has a report action.
- [ ] A report stores a snapshot of the reported content that survives edits and deletion.
- [ ] Reporters can hide or mute immediately without waiting for review.
- [ ] Report status never reveals the decision, the moderator, or any action taken against the author.
- [ ] Duplicate reports collapse and reporting is rate-limited per user and per target.
- [ ] Report records contain only the data required to review the item.
- [ ] The feature matches the existing design system.
- [ ] No existing functionality is broken.

## Adaptation Rules

- Match the existing design system. Do not introduce a new colour palette,
  spacing scale, or component library.
- Reuse existing components and utilities wherever they fit.
- Follow the naming, file layout, and code style already present.
- Do not upgrade, replace, or remove existing dependencies to make this
  feature fit. Adapt the feature to the app, not the app to the feature.
- Do not break existing functionality. If a change is genuinely required in
  existing code, make the smallest one that works and say so.
- If something in these instructions conflicts with how the application is
  built, follow the application and explain the deviation.

## Final Verification

Before you report the work as done:

1. Re-read the acceptance criteria above and check each one against what you
   actually built.
2. Run the application and exercise the feature end to end.
3. Run the existing test suite and confirm you have broken nothing.
4. Check the feature on mobile, tablet, and desktop widths.
5. Check keyboard navigation and focus handling.
6. Summarize what changed: files added, files modified, and anything you
   deliberately did differently because of how this application is built.

If any acceptance criterion is unmet, fix it before reporting completion.
