Skip to content

Plugin Directory: Rebuild the Plugin Check Slack alert with Block Kit - #788

Closed
obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:update/plugin-check-slack-alert
Closed

Plugin Directory: Rebuild the Plugin Check Slack alert with Block Kit#788
obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:update/plugin-check-slack-alert

Conversation

@obenland

@obenland obenland commented Aug 12, 2026

Copy link
Copy Markdown
Member

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:

  • Sender — displays as Plugin Check (Gandalf alerts show as Gandalf), so the channel tells the feeds apart by name.
  • Header block — plugin name and scanned ref (Flex Fields trunk), entity-decoded, capped at Slack's 150-char header limit.
  • Summary section*9 errors* · 10+ active installs (installs bold at ≥10,000). No button on this feed.
  • Context linkswp-admin · Source · Plugin page, replacing the three raw labeled URLs.
  • Error table — a divider, then the error-code table in a code block, with the code column sized to the longest name instead of a fixed 80 characters (typically half as wide), rows sorted by error count, capped at 10 with an …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.
  • Pure blocks, no attachments — PCP errors carry no risk score, so nothing needs a color bar; this also avoids Slack's "Added by" attribution label entirely.
  • Accurate count — the headline derives from the displayed summary instead of totals.errors, which could disagree with the table (the current alert can say "Found 1 errors" above a table listing 9).
  • Fallback textPlugin 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-changed against 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-upgraded slack_dm() would JSON-encode the array into text and Slack would reject the payload.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 12, 2026 00:10
@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.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@obenland
obenland force-pushed the update/plugin-check-slack-alert branch from 717a13e to 013f7fa Compare August 12, 2026 00:16
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>
@obenland
obenland force-pushed the update/plugin-check-slack-alert branch from 013f7fa to 94a4e76 Compare August 12, 2026 00:22
@obenland
obenland requested a lite review from Copilot August 12, 2026 00:27
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>
@obenland
obenland force-pushed the update/plugin-check-slack-alert branch from b0b7963 to 13c6156 Compare August 12, 2026 00:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 $fallback and $table, which are Slack-escaped via htmlspecialchars(). This means the CLI log can show entity sequences like &amp;, &lt;, 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 by errors. 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., by files, then code) keeps the output stable and easier to scan.
		usort(
			$codes,
			static function ( $a, $b ) {
				return $b['errors'] <=> $a['errors'];
			}

@bazza bazza closed this in 909328a Aug 12, 2026
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