Skip to content

fix: record with pcov only, drop the Xdebug opt-in (SEL-120) - #2

Merged
natevick merged 4 commits into
mainfrom
natevick/sel-120-tracer-capability
Nov 24, 2026
Merged

natevick merged 4 commits into
mainfrom
natevick/sel-120-tracer-capability

Conversation

@natevick

@natevick natevick commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Recording is pcov only. Fixes the client side of SEL-120.

The Xdebug opt-in (SELECTIVE_TEST_MAP_XDEBUG=1) is removed. It never advertised record, so the server never asked an Xdebug runner to record. Making it advertise record wasn't worth it: on an earlier head of this branch (87d7164) that change made the three recording conformance scenarios (test_map_fragment, upload_stall, signal_keeps_close_status) time out under Xdebug, 3 of 3 runs. The first recorded test took ~9s. CodeCoverage::stop() runs with an empty filter and processes ~290 vendor files (7.6s measured). Excluding vendor with xdebug_set_filter didn't help, because PHPUnit's files are compiled before the filter is set.

What changed

  • Capability::canRecord() is the one predicate (pcov loaded). testMap(), Tracer::available() and the "no tracer" warning in Session all use it. The Xdebug driver fallback and the env-var branch are gone.
  • composer.json suggests ext-pcov. README says pcov is required to record and isn't installed with the client; no Xdebug mention.
  • Unit tests run testMap() in a bare php -n: no pcov, pcov, Xdebug in each of three modes plus the old env var, and DISABLE.

Proof

testMap() / Tracer::available(), containers on PHP 8.4:

case main branch
no pcov, no Xdebug select / false select / false
pcov record / true record / true
Xdebug coverage + old env var select / true select / false
Xdebug develop or off + old env var select / true select / false
DISABLE=1 0 0

Main's available() was true for Xdebug plus the env var, with or without coverage mode. It now matches what is advertised.

  • CI command (php tests/harness/play.php plus the per-scenario conformance loop) on 6 rows, all pcov: 8.2/10.5.66, 8.2/11.5.57, 8.3/12.5.40, 8.4/13.4.3, 8.5/12.5.40, 8.5/13.4.3. Each: play rc 0, 71 tests (62 on main), conformance 26 passed, 0 failed, 0 n/a. The 3 skips are the Xdebug cases, which need an Xdebug build.
  • Without pcov (Xdebug build plus env var): 23 ok, 3 n/a ("client advertises test_map=select"), 0 timeouts. Same as main.
  • In an Xdebug image, the 3 Xdebug unit cases run and pass. Re-adding || SELECTIVE_TEST_MAP_XDEBUG=1 to canRecord() fails the env-var test.

Not run: the Laravel job. A bare php:8.4-cli image also fails sigterm_after_failure (no kill), on main too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RhRfiMBEZfMLrhpYsH7DSF

Capability::testMap() only looked for pcov, so a runner using Xdebug with
SELECTIVE_TEST_MAP_XDEBUG=1 advertised select and the server never asked it
to record, even though Tracer could. Tracer::available() and the "no tracer"
warning in Session each carried their own copy of the check, and neither
looked at xdebug.mode: with Xdebug loaded and the opt-in set but no coverage
mode, the client would take a recording and write nothing.

One predicate now, Capability::canRecord(): pcov is loaded, or Xdebug 3.1+
reports the coverage mode (xdebug_info('mode'), so XDEBUG_MODE is honored)
and the opt-in is set. testMap(), Tracer::available() and Session use it.
SELECTIVE_TEST_MAP_DISABLE still wins.

Also suggest ext-pcov in composer.json and say in the README that pcov is
required to record and is not installed with the client, plus the Xdebug
opt-in.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhRfiMBEZfMLrhpYsH7DSF
@natevick natevick changed the title fix: advertise record when the Xdebug opt-in can record (SEL-120) fix: record with pcov only, drop the Xdebug opt-in (SEL-120) Nov 9, 2026
Advertising record for Xdebug (the previous commit) makes the three
recording conformance scenarios time out under Xdebug, 3 of 3 runs. The
first recorded test takes ~9s: CodeCoverage::stop() runs with an empty
filter and processes ~290 vendor files (7.6s measured). Excluding vendor
with xdebug_set_filter does not help, since PHPUnit's files are compiled
before the filter is set.

So the Xdebug path is removed. Capability::canRecord() is now just
extension_loaded('pcov'), still the one predicate behind testMap(),
Tracer::available() and the "no tracer" warning. The XdebugDriver fallback
and the SELECTIVE_TEST_MAP_XDEBUG branch are gone, the README no longer
mentions Xdebug, and the tests cover pcov, no pcov, Xdebug in each mode
with the old env var, and DISABLE.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RhRfiMBEZfMLrhpYsH7DSF
@natevick
natevick marked this pull request as ready for review November 9, 2026 17:00
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T18:52:04.902372Z 777385e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@natevick
natevick marked this pull request as draft November 9, 2026 17:02
@natevick
natevick marked this pull request as ready for review November 9, 2026 18:49
@natevick

Copy link
Copy Markdown
Contributor Author

Reviewed 777385e8 with grok and Opus. Both SHIP, no P1s.

Merged main (#3) into the branch as dd648a4. The two earlier runs on 777385e8 were red with 3 of 6 matrix jobs missing. All 8 jobs are green on dd648a4.

Opus checked it in pcov, Xdebug and no-extension containers. Without pcov the client advertises select, runs the tests and uploads nothing, which matches #438's pcov-only rule.

Not fixing here; all three are filed as SEL-434:

  • pcov.enabled=0 still advertises record (main does the same).
  • The pcov.directory ini_set in Tracer::start() does nothing at runtime.
  • No test covers Tracer::available().

Behaviour change: SELECTIVE_TEST_MAP_XDEBUG is now ignored. The client isn't published, so this only matters in a mixed pcov/Xdebug fleet, and there it is safe: those tests always run.

@natevick
natevick merged commit c40fcec into main Nov 24, 2026
16 checks passed
@natevick
natevick deleted the natevick/sel-120-tracer-capability branch November 24, 2026 17:55
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.

1 participant