Skip to content

Make the #669 Windows benchmark numbers visible on CI's Summary tab - #674

Merged
fdaviddpt merged 1 commit into
mainfrom
fix/673
Sep 12, 2026
Merged

fdaviddpt merged 1 commit into
mainfrom
fix/673

Conversation

@fdaviddpt

Copy link
Copy Markdown
Contributor

Closes #673

What was wrong

tests/test_session_start_windows_benchmark_669.py (#669) already measures cold/warm wall-time and spawn-count for session-start-hook.sh, for two scenarios (jq present, jq absent), on every leg of the existing 3-OS x 4-Python-version CI matrix. None of those numbers reached a human: record_property only lands in a JUnit XML this repo's .github/workflows/tests.yml never writes or uploads, and pytest only shows captured stdout for a failed test (no -s/-rA in this repo's addopts).

What changed

  • _format_benchmark_table(...): a small pure function building a Markdown table (platform, one row per cold/warm, wall-ms, spawn count) for one scenario.
  • _append_step_summary(table): appends that table to $GITHUB_STEP_SUMMARY when that env var is set. Degrades silently to a no-op when unset (the ordinary local pytest run). Lets a real OSError propagate uncaught when the var is set but the path is unwritable -- deliberately not caught, so a genuine CI misconfiguration is never silently swallowed.
  • _benchmark() (the existing helper both scenario tests call) now also prints the table to stdout and stderr (previously only a one-line summary to stdout), and calls _append_step_summary.
  • Four new unit tests pin the table's exact row count/values, that it's written when the path is writable, that it's silently skipped when unset, and that it raises loudly when the path is set-but-unwritable.
  • changelog.d/673.added.md.

The hidden judgment call, and why

The issue offered three routes: $GITHUB_STEP_SUMMARY, a --junitxml plus uploaded artifact, or a scoped -rA override. I picked $GITHUB_STEP_SUMMARY alone. It is literally zero workflow-file change -- confirmed by reading .github/workflows/tests.yml directly rather than trusting the issue's own framing: its one "Run tests" step is a bare run: pytest, and GitHub Actions hands that env var to every step's environment with no opt-in needed, so the child pytest process inherits it for free. It reaches all three OSes x four Python versions the same way the benchmark module itself already does. The junit/artifact route would need an actual workflow edit for a module whose own docstring already argues against paying a dedicated-CI-job cost for exactly this reason -- the same argument extends to a dedicated junit-upload step for one module. I judged the cheaper, already-sufficient fix correct rather than layering the other two on top.

The issue's own wording for the negative control ("the test still fails loudly ... when $GITHUB_STEP_SUMMARY is unwritable, e.g. unset, or a read-only path") reads as though unset and set-but-unwritable should both fail loudly. Taken literally, every ordinary local pytest run -- which never has this variable -- would start failing, breaking local dev with no CI benefit (CI always sets it). I split this into two deliberately different behaviours instead: unset degrades silently (matches every run before this issue existed, and keeps the existing CI matrix green exactly as before); set-but-genuinely-unwritable raises loudly and uncaught, because that is a real misconfiguration worth surfacing. This is the judgment call the brief asked me to make explicit -- see _append_step_summary's own docstring in tests/test_session_start_windows_benchmark_669.py.

Tests

Red (new test functions referencing then-undefined helpers): 4 failed, 3 deselected in 0.38s.
Green, targeted (-k step_summary): 4 passed, 3 deselected in 0.28s.
Green, whole module, GITHUB_STEP_SUMMARY set to a real writable temp file: 7 passed in 6.51s (and the file was confirmed to receive two well-formed Markdown tables, one per scenario).
Green, whole module, GITHUB_STEP_SUMMARY unset (the universal local-dev case): 7 passed in 5.35s.

Not run: the repo's full test_command (pytest) -- narrowed to the one changed test module per this plugin's own developer brief; CI is the gate for the full matrix.

Review

Both self-review spawns (Explore as a generalist reviewer, oss:auditor for the fixed cross-platform checklist) returned NO FINDINGS, classified via scripts/review_return.py rather than by eye. Platform-band verdict: clean, REASONED (no Windows/Linux machine available to this lane; all claims are a static read of the diff, cross-checked against what CI's own matrix already exercises).

Generated with Claude Code: https://claude.com/claude-code
https://claude.ai/code/session_01ScdCn6Xq622o2cRQhzVhi5

[AI-generated]

The cold/warm wall-time and spawn-count numbers `test_session_start_windows_benchmark_669.py`
already measures on every run reached no human: `record_property` only lands in a JUnit XML
this repo's workflow never writes, and pytest only shows captured stdout for a failed test.

Append a small Markdown table to `$GITHUB_STEP_SUMMARY` from the test itself -- zero workflow
change, since GitHub Actions already hands that env var to every step of every job -- and print
the same table to stdout and stderr so it also lands in the job log. Appending degrades silently
to a no-op when the variable is unset (the ordinary local pytest run); a genuinely unwritable
path raises loudly instead of dropping the table a second time.

Closes #673

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01ScdCn6Xq622o2cRQhzVhi5
@fdaviddpt
fdaviddpt merged commit dd062f9 into main Sep 12, 2026
16 checks passed
@fdaviddpt
fdaviddpt deleted the fix/673 branch September 12, 2026 04:13
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.

Windows benchmark numbers are invisible in a passing CI run: emit them to the job summary (Part of #660, follow-up to #669)

1 participant