Skip to content

test(bench-beacon-hoist): pin utf-8 on three subprocess calls - #20145

Merged
javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-bench-beacon-hoist
Oct 14, 2026
Merged

javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-bench-beacon-hoist

Conversation

@javenciu

Copy link
Copy Markdown
Contributor

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.run with no explicit encoding= 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.py keeps 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:255 runs a sys.executable -c import probe.
  • test/test_agent_import_hoist.py:54 runs sys.executable -c imports in a fresh interpreter.
  • test/test_beacon.py:37 runs bash 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.py names 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

  • No change to what any of the three tests asserts, and no change outside the three calls and their baseline entries.
  • No other baseline entry.
  • No **UTF8_TEXT splat and no new import: these files already spell their UTF-8 reads as encoding="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", after text=True,.
  • test/test_agent_import_hoist.py (call at :54): encoding="utf-8", after text=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 entries 1 test/test_agent_import_hoist.py, 1 test/test_beacon.py and 1 test/test_bench_cli.py are removed. The file is byte-identical to what python3 scripts/check_subprocess_encoding.py --update-baseline writes (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:

$ RATCHET_SCOPE_WHOLE_TREE=1 python3 scripts/check_subprocess_encoding.py
  test/test_agent_import_hoist.py:54
  test/test_beacon.py:37
  test/test_bench_cli.py:255

subprocess-encoding gate FAILED: 3 new offender(s), 0 grown count(s), 0 file(s) with new calls on added lines, 0 entr(y/ies) to prune.
exit 1

Each baseline line deleted alone also exits 1 with 1 new offender(s).

GREEN:

  • python3 scripts/check_subprocess_encoding.py --test exits 0 (9 flagged probes, 9 clean probes).
  • python3 scripts/check_subprocess_encoding.py exits 0 in the PR's scope (4 changed files) and over the whole tree.
  • pytest -n0 on each file, before then after: test/test_agent_import_hoist.py 5 then 5 passed, test/test_beacon.py 156 then 156 passed, test/test_bench_cli.py 10 then 10 passed.
  • The gate's own test/test_subprocess_encoding_gate.py and the other tests the scoped runner relates to the diff: 157 passed.
  • One process at -n0, the three files first and then test/test_taskrunner_atomic_persistence.py, test/test_taskrunner_execution_capture_async.py, test/test_unattended_slot_guardrails.py and test/test_wheel_apply.py: 283 passed. No test here patches a module global; the run is a leak check for the record.
  • flake8, isort --check-only, scripts/check_black_formatting.py (with the pinned black), scripts/check_comment_history.py and scripts/check_agent_sdk_boundary.py pass.

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

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality (no new functionality; the existing gate is the check)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable) (not applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

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.
@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners October 14, 2026 05:48
@javenciu
javenciu requested a review from mbriones98 October 14, 2026 05:48
@github-actions github-actions Bot added the readiness: action required A blocking check or review needs attention label Oct 14, 2026
@javenciu

Copy link
Copy Markdown
Contributor Author

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).

@javenciu javenciu closed this Oct 14, 2026
@javenciu javenciu reopened this Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11 ships no reviewable capability (docs, tests or generated files only), so there is nothing to inventory. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 493eaca

Verdict parsed from the review's SHA-scoped output markers for commit 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 493eaca

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 493eaca8c5e09c1fb6e4e28c121c9b6dd851bf11: <one-sentence reason>

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Oct 14, 2026
@javenciu
javenciu enabled auto-merge (squash) October 14, 2026 09:47

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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.

@javenciu
javenciu merged commit f6a0cf2 into main Oct 14, 2026
107 of 174 checks passed
@javenciu
javenciu deleted the test/subprocess-encoding-bench-beacon-hoist branch October 14, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

readiness: passed Eligible automated validation passed for the current revision

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants