Repository navigation
test(bench-beacon-hoist): pin utf-8 on three subprocess calls - #20145
Conversation
Three text-mode subprocess calls in the test suite had no explicit encoding, so they decode the child's output with the locale code page (mojibake on Windows, #5249). Pin encoding="utf-8" on each and drop their entries from the shrink-only subprocess-encoding baseline. - test/test_bench_cli.py: the fresh-interpreter import probe - test/test_agent_import_hoist.py: the fresh-interpreter import runner - test/test_beacon.py: the bash stamp-distribution.sh runner The beacon call goes to one argument per line because the added argument would push the single-line form past the 100 column limit.
|
Closing and reopening so CI runs on hosted runners: same-repo runs from this account queue on the fleet label without a runner (details on #19683). |
First Principles Review (Opus 5.5) — ⏭️ skippedRevision |
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing to check. [DESIGN-REVIEWED] 493eaca Description read[DESCRIPTION-READ] c59fae2b420489bccab0f5f2820bda2ac637a3a6ecbe2d8baba73961fd55ad4b That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: test (4 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, security checklist all-NO, no reviewer-lane findings, readiness signal fresh for this head SHA, declared category matches the diff. Category: test-only change; pins encoding=utf-8 on three test subprocess calls and drops their subprocess-encoding baseline entries.
Problem / Motivation
Goal: Three test helpers that spawn a child process decode its output as UTF-8 on every platform instead of the host's locale code page.
A text-mode
subprocess.runwith no explicitencoding=decodes the child's output with the locale's code page, so any non-ASCII byte comes back as mojibake (or a decode error) on Windows (#5249).scripts/check_subprocess_encoding.pykeeps new offenders out and records the existing ones as<count> <path>lines in.github/subprocess-encoding-baseline.txt, a list that can only shrink (the ratchet from #5378). Three test files still hold one offender each:test/test_bench_cli.py:255runs asys.executable -cimport probe.test/test_agent_import_hoist.py:54runssys.executable -cimports in a fresh interpreter.test/test_beacon.py:37runsbash scripts/stamp-distribution.sh.The children are this repository's own interpreter and its own script, the kind of child
src/kiro_crew/subprocess_utf8.pynames as correct to pin to UTF-8.Why it matters
Each unpinned call is a Windows-only decode path in a test that otherwise behaves the same everywhere, and each keeps an entry on the baseline. Fixing the three shrinks the baseline by three entries.
Not a goal
**UTF8_TEXTsplat and no new import: these files already spell their UTF-8 reads asencoding="utf-8", and the gate accepts that keyword on its own.What changed (motivation → approach → change)
The gate's own message prescribes the fix for these calls: pin
encoding="utf-8"at each one, then record the progress in the baseline.test/test_bench_cli.py(call at :255):encoding="utf-8",aftertext=True,.test/test_agent_import_hoist.py(call at :54):encoding="utf-8",aftertext=True,.test/test_beacon.py(_run_stamp, call at :37):encoding="utf-8"added. With it the one-line argument list would be 106 characters against the repo's 100-column limit, so the call is written one argument per line, as black formats it..github/subprocess-encoding-baseline.txt: the entries1 test/test_agent_import_hoist.py,1 test/test_beacon.pyand1 test/test_bench_cli.pyare removed. The file is byte-identical to whatpython3 scripts/check_subprocess_encoding.py --update-baselinewrites (checked on a copy).Backwards compatibility
Compatible: test-only change; no runtime code is touched and the three tests assert the same things.
Removes nothing: the three baseline entries go because the calls they grandfathered are now pinned.
Tests
In short: with the files untouched and their baseline entries deleted, the gate fails on exactly these three calls; with the pin it passes, and each test file passes the same number of tests before and after.
RED, three baseline lines deleted and the files untouched. The whole-tree scope is set with
RATCHET_SCOPE_WHOLE_TREE=1, because the default scope is the committed diff:Each baseline line deleted alone also exits 1 with
1 new offender(s).GREEN:
python3 scripts/check_subprocess_encoding.py --testexits 0 (9 flagged probes, 9 clean probes).python3 scripts/check_subprocess_encoding.pyexits 0 in the PR's scope (4 changed files) and over the whole tree.pytest -n0on each file, before then after:test/test_agent_import_hoist.py5 then 5 passed,test/test_beacon.py156 then 156 passed,test/test_bench_cli.py10 then 10 passed.test/test_subprocess_encoding_gate.pyand the other tests the scoped runner relates to the diff: 157 passed.-n0, the three files first and thentest/test_taskrunner_atomic_persistence.py,test/test_taskrunner_execution_capture_async.py,test/test_unattended_slot_guardrails.pyandtest/test_wheel_apply.py: 283 passed. No test here patches a module global; the run is a leak check for the record.isort --check-only,scripts/check_black_formatting.py(with the pinned black),scripts/check_comment_history.pyandscripts/check_agent_sdk_boundary.pypass.Not run: a Windows host. The gate is the proof that the decode is pinned.
Manual verification
N/A — unit coverage sufficient: the gate and the three files' own tests exercise the changed calls on Linux.
Related Issues
No issue exists; burn-down of the subprocess-encoding baseline (precedents: #5378, the gate's own PR, and #14648, #14664, #16447, which pinned UTF-8 and dropped baseline entries).
Pattern harvest
Rule candidate: lint — already enforced by
scripts/check_subprocess_encoding.py; this change burns down three of its baselined entries.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement