Plugin Directory: Rebuild the Plugin Check Slack alert with Block Kit - #788
Plugin Directory: Rebuild the Plugin Check Slack alert with Block Kit#788obenland wants to merge 2 commits into
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
Pull request overview
Rebuilds the Plugin Check (PCP) Slack alert in the Plugin Directory scanner to use Slack Block Kit (matching the newer Gandalf alert style) instead of the legacy text/table format, improving readability and consistency in the review channel.
Changes:
- Replace the legacy text + fixed-width table Slack payload with a Block Kit message (
header,summary,context links,error list). - Compute the headline error total from the displayed per-code summary (avoiding mismatches with
$results['totals']['errors']). - Add fallback notification text and set Slack sender username to “Plugin Check”.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
717a13e to
013f7fa
Compare
Matches the design language of the Gandalf alert while staying distinguishable: sender "Plugin Check", a header block with the plugin name and scanned ref, an error/install summary line, wp-admin, Source, and Plugin page context links, and the error-code table in a code block with columns sized to the content instead of a fixed 80 characters, sorted by error count and capped at 10 rows. Pure blocks, no buttons or attachments, so no "Added by" attribution appears. The headline error count is derived from the displayed summary rather than the PCP totals, which could disagree with the table. Entity-encoded post titles are decoded, the‼️ wall is gone, and untrusted strings are escaped for mrkdwn or URL-encoded. Requires the notify_slack() array support in the private repository to deploy first, same as WordPress#782. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
013f7fa to
94a4e76
Compare
A code containing backticks could terminate the surrounding code block, and an arbitrarily long code would widen every table row, potentially pushing the section past Slack's 3,000-character block limit and getting the whole alert rejected. Strip backticks, collapse whitespace, and cap codes at 80 characters before building the table. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
b0b7963 to
13c6156
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
Suppressed comments (2)
wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-scan.php:363
- The cron log output uses
$fallbackand$table, which are Slack-escaped viahtmlspecialchars(). This means the CLI log can show entity sequences like&,<, etc., which contradicts the intent of keeping the cron echo in plain text and makes logs harder to read when titles/tags include&,<, or>.
}
if ( defined( 'PLUGIN_REVIEW_ALERT_SLACK_CHANNEL' ) && function_exists( 'slack_dm' ) ) {
slack_dm(
[
wordpress.org/public_html/wp-content/plugins/plugin-directory/jobs/class-plugin-scan.php:268
- The
usort()comparator only sorts byerrors. When multiple codes have the same error count, the resulting order is not deterministic (PHP's sort is not stable), which can make the Slack table (and cron logs) reorder between runs even when the underlying data is unchanged. Adding a tiebreaker (e.g., byfiles, thencode) keeps the output stable and easier to scan.
usort(
$codes,
static function ( $a, $b ) {
return $b['errors'] <=> $a['errors'];
}
Companion to #782. The Plugin Check (PCP) alert in the review channel still used the original text format: raw labeled URLs, the
:bangbang:install wall, and a fixed 80-column table. This rebuilds it in the same Block Kit design language as the Gandalf alert while keeping the two feeds visually distinguishable:Flex Fields trunk), entity-decoded, capped at Slack's 150-char header limit.*9 errors* · 10+ active installs(installs bold at ≥10,000). No button on this feed.wp-admin · Source · Plugin page, replacing the three raw labeled URLs.…and N more error types.trailer — staying well inside the 3,000-char section limit. Codes are escaped; the scanned tag is URL-encoded in the Source link.totals.errors, which could disagree with the table (the current alert can say "Found 1 errors" above a table listing 9).Plugin Check found 9 errors in Flex Fields trunk, escaped, for notifications; the cron log echo keeps the same content in plain text.Verified in a rendering harness against the current alert's real-world example (Flex Fields), an entity-encoded title with 18 error codes (row cap + bold installs + tag-based Source URL), hostile strings (
<!channel>in titles and codes,</>/|in the tag), and the closed-plugin no-op.phpcs-changedagainst trunk reports no new violations on changed lines.Deploy-order dependency: same as #782 — requires the
notify_slack()array-message support in the private dotorg repository first; an un-upgradedslack_dm()would JSON-encode the array intotextand Slack would reject the payload.🤖 Generated with Claude Code