close
Skip to content

Fix failed comment moderation badge rendering#568

Merged
dkotter merged 1 commit into
WordPress:developfrom
ekamran:shifteq/fix-comment-moderation-failed-status
May 18, 2026
Merged

Fix failed comment moderation badge rendering#568
dkotter merged 1 commit into
WordPress:developfrom
ekamran:shifteq/fix-comment-moderation-failed-status

Conversation

@ekamran
Copy link
Copy Markdown
Contributor

@ekamran ekamran commented May 18, 2026

What?

Keeps failed Comment Moderation analysis visible after the comments page is reloaded.

Why?

When comment analysis fails during lazy analysis, the comments table briefly shows the expected red Failed badge. However, after reloading the page, the same saved failed analysis status is rendered as .

This makes a failed analysis look the same as a comment that has not been analyzed.

How?

  • Renders the existing failed analysis status in the Sentiment and Toxicity columns.
  • Reuses the existing ai-badge--failed styling.
  • Adds integration test coverage for failed status rendering in both columns.

Use of AI Tools

AI assistance: Yes
Tool(s): ChatGPT / Codex
Used for: Repository review, reproduction planning, implementation guidance, test updates, and local verification. I reviewed the changes, tested the behavior locally, and take responsibility for the final submission.

Testing Instructions

  1. Enable AI features and the Comment Moderation experiment.
  2. Create or use a comment with _wpai_analysis_status set to failed.
  3. Open Comments in wp-admin.
  4. Confirm the Sentiment and Toxicity columns show Failed.
  5. Reload the page.
  6. Confirm the Sentiment and Toxicity columns still show Failed instead of .

Automated checks run locally:

npm run test:php -- --filter Comment_ModerationTest
npm run lint:php -- includes/Experiments/Comment_Moderation/Comment_Moderation.php tests/Integration/Includes/Experiments/Comment_Moderation/Comment_ModerationTest.php

Screenshots or screencast

Before

Failed analysis is shown immediately after lazy analysis fails, but reloading the comments page changes the same failed status back to .

Before

After

Failed analysis remains visible as Failed after the comments page is reloaded.

After Open WordPress Playground Preview

@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ekamran <ekamran@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.37%. Comparing base (8337322) to head (918aa93).

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #568      +/-   ##
=============================================
+ Coverage      71.21%   71.37%   +0.16%     
- Complexity      1151     1154       +3     
=============================================
  Files             67       67              
  Lines           5565     5573       +8     
=============================================
+ Hits            3963     3978      +15     
+ Misses          1602     1595       -7     
Flag Coverage Δ
unit 71.37% <100.00%> (+0.16%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@dkotter dkotter added this to the 1.0.0 milestone May 18, 2026
@dkotter dkotter merged commit 54b981d into WordPress:develop May 18, 2026
18 checks passed
@dkotter dkotter mentioned this pull request May 18, 2026
42 tasks
@ekamran ekamran deleted the shifteq/fix-comment-moderation-failed-status branch May 19, 2026 05:56
simison pushed a commit to simison/ai that referenced this pull request May 25, 2026
Fixed - Show a failed badge when comment analysis fails.

Co-authored-by: ekamran <ekamran@git.wordpress.org>
Co-authored-by: dkotter <dkotter@git.wordpress.org>
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.

2 participants