Skip to content

Only count a socket the scenarios can find as available - #434

Open
swissspidy wants to merge 1 commit into
mainfrom
claude/wordpress-core-testing-automation-yrlybg
Open

swissspidy wants to merge 1 commit into
mainfrom
claude/wordpress-core-testing-automation-yrlybg

Conversation

@swissspidy

@swissspidy swissspidy commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #357, from a CodeRabbit finding on wp-cli/config-command#239.

@require-mysql-socket counted a socket path given as the suffix of WP_CLI_TEST_DBHOST (for example localhost:/path/to/mysql.sock) as available. The scenarios carrying the tag can't use that path: the one in config-command runs a find-socket.php that only checks WP_CLI_TEST_DBSOCKET (through {DB_SOCKET}), /var/run/mysqld/mysqld.sock and /tmp/mysql.sock. So in a setup where the host was the only source of a socket, the tag let the scenario run and it still failed with "No socket found".

has_mysql_socket() now checks exactly the places those scenarios do. The tag should follow what the test can use, not the other way round.

The new unit test fails without the change (the tag isn't filtered out) and passes with it. It skips itself on a machine that has a socket at one of the default paths, since that counts as available regardless of the host. The other six tag tests still pass, and lint and phpcs are clean.


Generated by Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • The @require-mysql-socket tag no longer treats a socket path embedded in the database host setting as evidence that a MySQL socket is available. Detection continues to check the dedicated socket setting and the standard socket locations.

@require-mysql-socket treated a socket path given as the suffix of
WP_CLI_TEST_DBHOST as available. The scenarios carrying the tag look
for the socket in WP_CLI_TEST_DBSOCKET and the two default locations
only, so where the host was the only source, the tag let the scenario
run and it still failed with "No socket found".

The tag now looks in exactly the places those scenarios do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CE81GsxUY597AdaMP1NXzk
@swissspidy
swissspidy requested a review from a team as a code owner November 27, 2026 13:15
Copilot AI balanced review requested due to automatic review settings November 27, 2026 13:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Socket detection no longer treats a non-numeric suffix in WP_CLI_TEST_DBHOST as a socket path. A test verifies that this host value alone does not satisfy @require-mysql-socket.

Changes: MySQL socket detection

Layer / File(s) Summary
Socket detection and regression test
utils/behat-tags.php, tests/tests/TestBehatTags.php
has_mysql_socket() no longer checks a socket path from WP_CLI_TEST_DBHOST. The test verifies that such a path alone does not satisfy @require-mysql-socket; it skips when either standard socket path exists.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: claude, schlessera

Merge Risk: Minimal · up to acd82

The @require-mysql-socket tag now counts only socket locations the tagged scenarios can find, which avoids "No socket found" failures. Merge risk is minimal, and the change only affects test tooling.

Security architecture risk: Minimal · up to acd82

The test gate now checks the socket locations the scenarios can use. A setup that supplies a socket path only through the database host setting may skip these scenarios rather than run them and fail to find the socket.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main behavior change: @require-mysql-socket now counts only sockets that the scenarios can find. The raw summary confirms that has_mysql_socket() stops checking the suffix of WP_CL…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main behavior change: @require-mysql-socket now counts only sockets that the scenarios can find. The raw summary confirms that has_mysql_socket() stops checking the suffix of WP_CLI_TEST_DBHOST and keeps the WP_CLI_TEST_DBSOCKET, /var/run/mysqld/mysqld.sock, and /tmp/mysql.sock checks. The added test covers the same behavior. The title is specific and matches the objectives.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dd02342c-2974-4abc-8c57-c37c823c06ee
Commits

Reviewing files that changed from the base of the PR and between 6057bfa and acd82fe.

Files selected for processing: 2

  • tests/tests/TestBehatTags.php
  • utils/behat-tags.php
Files with no reviewable changes: 1

  • utils/behat-tags.php

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

@github-actions github-actions Bot added automated-pr bug Something isn't working scope:testing Related to testing labels Nov 27, 2026
@codecov

codecov Bot commented Nov 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-pr bug Something isn't working scope:testing Related to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants