Skip to content

fix(test): use php://stdout|stderr streams in smoke tests so they run under the Playground SAPI#2824

Open
chubes4 wants to merge 1 commit into
mainfrom
sweep-smoke-stdout
Open

fix(test): use php://stdout|stderr streams in smoke tests so they run under the Playground SAPI#2824
chubes4 wants to merge 1 commit into
mainfrom
sweep-smoke-stdout

Conversation

@chubes4

@chubes4 chubes4 commented Jun 30, 2026

Copy link
Copy Markdown
Member

Summary

Closes #2823.

The STDOUT / STDERR PHP constants only exist under the CLI SAPI. The host smoke harness runs these tests under the WP Codebox Playground web SAPI, where they are undefined, so any test reaching such a write throws Fatal error: Undefined constant "STDOUT" (or STDERR).

This is a purely mechanical sweep: replace every fwrite( STDOUT, ... ) / fwrite( STDERR, ... ) call with the equivalent fopen( 'php://stdout'|'php://stderr', 'w' ) stream target. Message arguments, formatting, indentation, and assertion logic are unchanged — only the stream target moves. This matches the form already in use by tests/conversation-compaction-policy-resolver-smoke.php on main (the reference fix).

Scope

  • Files swept: 47
  • Call sites replaced: 75 (68 STDERR + 7 STDOUT)
  • Only fwrite( STDOUT|STDERR, ... ) stream targets touched. No assertions, no behavior, no non-test files.

Verification

  • grep -rE "fwrite\(\s*STD(OUT|ERR)" tests/no matches (clean).
  • php -l clean on all 47 changed files.
  • homeboy lint --changed-since origin/mainpassed, 0 findings.
  • Spot-ran two changed smoke tests via CLI SAPI, both print expected pass lines and exit 0:
    • php tests/runtime-agent-bundle-reconcile-smoke.phpRuntime agent bundle reconcile smoke passed.
    • php tests/content-addressed-data-packets-smoke.phpcontent-addressed-data-packets-smoke: ok

Transformation applied

-fwrite( STDOUT, "...\n" );
+fwrite( fopen( 'php://stdout', 'w' ), "...\n" );

-fwrite( STDERR, "...\n" );
+fwrite( fopen( 'php://stderr', 'w' ), "...\n" );

Single quotes chosen to match the existing convention in tests/ (all pre-existing fopen calls and the reference fix on main use single quotes).

Notes

  • Did not introduce a shared helper — the inline replacement keeps the diff obvious and low-risk, as the issue suggests is preferred.
  • CI sandbox provisioning is currently flaky (homeboy#7065); if a check fails with internal.io_error / "Setup command failed with exit code 100" / "No command results produced", that is infra, not this change.

… under the Playground SAPI

The STDOUT/STDERR PHP constants only exist under the CLI SAPI. The host
smoke harness runs these tests under the WP Codebox Playground web SAPI
where they are undefined, causing any reaching test to throw
'Undefined constant STDOUT'.

Replace every `fwrite( STDOUT, ... )` / `fwrite( STDERR, ... )` call in
the smoke suite with the equivalent `fopen( 'php://stdout'|'php://stderr', 'w' )`
stream target. Message arguments and formatting are unchanged; only the
stream target moves. This matches the form already in use by
tests/conversation-compaction-policy-resolver-smoke.php on main.

Mechanical sweep: 47 files, 75 call sites. Verified via
`grep -rE "fwrite\(\s*STD(OUT|ERR)" tests/` returning no matches and
php -l clean on every changed file.

Closes #2823
@homeboy-ci

homeboy-ci Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Homeboy Results — data-machine

Lint

lint — passed

ℹ️ Full options: homeboy docs commands/lint
Deep dive: homeboy lint data-machine --changed-since a1f242f

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-lint-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-lint-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/28453767544

Test

test — failed

ℹ️ No tests ran — the runner failed before producing results. See raw_output.stderr_tail / raw_output.stdout_tail for the underlying error (bootstrap failure, missing deps, DB connection, etc.).
ℹ️ To run specific tests: homeboy test data-machine -- --filter=TestName
ℹ️ Auto-fix lint issues: homeboy refactor data-machine --from lint --write
ℹ️ Collect coverage: homeboy test data-machine --coverage
ℹ️ Analyze failures: homeboy test data-machine --analyze
ℹ️ Pass args to test runner: homeboy test -- [args]
ℹ️ Full options: homeboy docs commands/test
Deep dive: homeboy test data-machine --changed-since a1f242f

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-test-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-test-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/28453767544

Audit

audit — passed

  • audit — 515 finding(s)
  • Total: 515 finding(s)

Deep dive: homeboy audit data-machine --changed-since a1f242f

Artifacts and drill-down
  • CI results artifact: homeboy-ci-results-data-machine-audit-quality-Linux-node24 contains immediate command JSON for this action invocation.
  • Observation artifact: homeboy-observations-data-machine-audit-quality-Linux-node24 contains exported Homeboy run history for deeper queries.
  • Drill-down: download the observation artifact, then run homeboy runs import <dir>, homeboy runs list, and homeboy runs findings <run-id>.
  • Artifacts are attached to the workflow run: https://github.com/Extra-Chill/data-machine/actions/runs/28453767544
Tooling versions
  • Homeboy CLI: homeboy 0.271.0+2380b123a86e+b205427f
  • Extension: wordpress from https://github.com/Extra-Chill/homeboy-extensions
  • Extension revision: 52fe41c3
  • Action: unknown@unknown

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.

tech-debt: 47 smoke tests use bare STDOUT/STDERR constants — crash under the Playground SAPI

1 participant