Skip to content

[fix] Display report information on other reports table#475

Merged
juanmrad merged 3 commits into
mainfrom
fix-450-missing-report-information-from-table
May 16, 2026
Merged

[fix] Display report information on other reports table#475
juanmrad merged 3 commits into
mainfrom
fix-450-missing-report-information-from-table

Conversation

@juanmrad
Copy link
Copy Markdown
Member

@juanmrad juanmrad commented May 15, 2026

Context & Requests for Reviewers

Fixes #450

When a job had multiple merged reports, the "N other reports" table on the manual review screen rendered column headers but no rows, even though the count above said reports existed.

Root cause: MergedReportsComponent filtered the merged report list by reportedAt !== job.createdAt to drop the primary report (which is shown separately above). That filter is fragile given that several reports share the same reportedAt (common in tests, scripted submissions, or bursty real traffic where multiple users report within the same second), every entry whose timestamp matched the original report's reportedAt got filtered out, leaving an empty table.

Some minor improvements:

  • "Reported By" now shows System when a report has no reporterId (rule-engine, NCMEC, system enqueues) instead of a misleading Unknown. Falls back to the raw reporter id, then Unknown reporter, only when there was a reporterId we couldn't resolve. The investigation external-link icon is hidden for system reports.
  • "Reported For" now renders the policy name as a link to /dashboard/policies/form/ (same destination PoliciesDashboard uses), opened in a new tab with the same external-link icon pattern as "Reported By".
  • Empty Reported For / Reason render as — instead of blank cells.

The table now spans the full width of its container and the wrapper has symmetric padding so the Hide button isn't flush against the edge.

After:
Screenshot 2026-05-14 at 8 01 08 PM

Summary by CodeRabbit

  • Bug Fixes
    • Improved report identification and filtering in the manual review interface by using a specific primary report identifier
    • Enhanced display of report metadata including associated policies with clearer policy links
    • Refined handling of missing reasons and system-generated reports with clearer labeling
    • Fixed reporter investigation link resolution so links appear only when reporter info is present
    • Improved table layout and container styling for more consistent display

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 61911d19-2887-43d3-a73e-1edcb235c2ca

📥 Commits

Reviewing files that changed from the base of the PR and between 5d30d4f and c151dd3.

📒 Files selected for processing (1)
  • client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx

📝 Walkthrough

Walkthrough

Replaces timestamp-based primary report selection with ID-based selection. MergedReportsComponent accepts primaryReportId, filters other reports by ID (or drops the first), rebuilds display info from remaining reports, and updates table row rendering and the ManualReviewJobReview call site.

Changes

Primary Report Identification and Data Resolution

Layer / File(s) Summary
Props contract and call-site update
client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx, client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobReview.tsx
Props changed from primaryReportedAt: Date | string to primaryReportId?: string | null. Call site now passes reportHistory[0]?.reportId instead of job.createdAt.
Primary filtering and display-info remapping
client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx
otherReports is derived by excluding the entry matching primaryReportId (or dropping the first entry). reportHistoryWithDisplayInfo now maps over otherReports; memo deps updated accordingly.
Table row construction and rendering updates
client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx
tableData row logic rewritten to: resolve reportedFor via data.myOrg.policies, compute reportedBy with System / Unknown reporter fallbacks and typed prefix, conditionally render reporter investigation links when reporterId exists, normalize reason with .trim() and default to '—', and adjust container/Table classNames and props (containerClassName="w-full").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • cassidyjames
  • julietshen
  • vinaysrao1
  • dom-notion

Poem

🐰
I hop through rows and chase an ID,
No timestamps now to hide the guide.
Policies linked and reasons neat,
System or names — the table's sweet.
A rabbit smiles: the view's aligned.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: addressing the missing display of report information in the other reports table.
Description check ✅ Passed The description includes Context (with issue link), Tests section (describing testing approach), and optional Rollout Plan section as per template.
Linked Issues check ✅ Passed The PR fully addresses issue #450 by fixing the timestamp-based filtering bug, preventing duplicate primary reports, and ensuring merged reports display correct metadata (reporter, policy, reason, timestamp).
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the merged reports display issue. The "Reported By" improvements (showing System for system reports), "Reported For" policy links, em-dash defaults, and table styling are all closely related enhancements supporting the core fix.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-450-missing-report-information-from-table

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx`:
- Line 166: The fallback only handles null/undefined so empty strings still
render blank; update the mapping in MergedReportsComponent where `reason:
report.reason ?? '—'` is set to treat empty strings as missing (e.g., use a
conditional like `report.reason && report.reason.trim() ? report.reason : '—'`
or use `((report.reason ?? '').trim() || '—')`) so blank or whitespace-only
reasons render as '—'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2382d2bd-ab20-4089-bb7b-bf779314fb15

📥 Commits

Reviewing files that changed from the base of the PR and between d56a398 and 0b5af00.

📒 Files selected for processing (2)
  • client/src/webpages/dashboard/mrt/manual_review_job/ManualReviewJobReview.tsx
  • client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx

Comment thread client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx Outdated
@julietshen
Copy link
Copy Markdown
Member

thank you! much better :) great catch

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx`:
- Around line 34-48: The otherReports useMemo currently returns the full
reportHistory when primaryReportId is provided but not found, which can
reintroduce duplication; update the branch inside the useMemo (the matchIdx >= 0
check) so that if matchIdx < 0 you return reportHistory.slice(1) instead of
reportHistory, ensuring the first item (assumed primary) is omitted; reference
the symbols primaryReportId, reportHistory, matchIdx and the otherReports
useMemo to locate and modify the logic.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9b7f27d7-3c91-4a0b-8441-ca7e17d3f99e

📥 Commits

Reviewing files that changed from the base of the PR and between 0b5af00 and 5d30d4f.

📒 Files selected for processing (1)
  • client/src/webpages/dashboard/mrt/manual_review_job/MergedReportsComponent.tsx

@juanmrad juanmrad merged commit 0ec3523 into main May 16, 2026
11 checks passed
@juanmrad juanmrad deleted the fix-450-missing-report-information-from-table branch May 16, 2026 02:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number of reports missing information

2 participants