Skip to content

test(push-guard): pin utf-8 on the test_push_guard subprocess call - #20141

Merged
javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-push-guard
Oct 14, 2026
Merged

javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-push-guard

Conversation

@javenciu

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: The git helper in test/test_push_guard.py decodes its output as UTF-8 on every platform, and one more entry leaves .github/subprocess-encoding-baseline.txt.

_git (test/test_push_guard.py:129) calls subprocess.run(..., text=True) with no encoding=. A text-mode subprocess call without an explicit encoding decodes the child's output with the locale's code page: UTF-8 on POSIX, the legacy ANSI code page on Windows, so a non-ASCII byte from the child comes back as mojibake there (#5249). scripts/check_subprocess_encoding.py is the ratchet for this class: every remaining offender is listed in .github/subprocess-encoding-baseline.txt as <count> <path>, and the counts may only shrink. This file is listed as 1 test/test_push_guard.py.

Why it matters

_git is the file's shared helper for running git in its fixture repositories (482 call sites), so a decode that depends on the host code page sits under every one of them. This is burn-down of the ratchet, not a fix for an observed failure. On a UTF-8 locale nothing changes. The baseline goes from 198 known calls in 93 files to 197 in 92.

Not a goal

  • No other subprocess call, in this file or elsewhere: each remaining baseline entry is its own change.
  • No **UTF8_TEXT splat and no errors= policy. The file pins encoding="utf-8" inline on its file reads and writes and does not import UTF8_TEXT; the mapping also carries text=True, which this call already passes, and errors="replace", which would loosen the decode.
  • No change to what any test asserts.

What changed (motivation → approach → change)

  • Symptom: the _git helper's subprocess.run is text-mode with no encoding, so the gate lists the file in the baseline.
  • Cause: the call defers to the locale code page. The child is git, which emits UTF-8 (see src/kiro_crew/subprocess_utf8.py).
  • Change: encoding="utf-8", is added after text=True, in _git (test/test_push_guard.py:129), and the line 1 test/test_push_guard.py is removed from .github/subprocess-encoding-baseline.txt. Two files, +1 / -1 lines.

Backwards compatibility

Removes nothing: a keyword argument on one test helper. No production code, public API or protocol changes, and on a UTF-8 locale the decode is the same strict UTF-8 as before.

Tests

Proof, run on this branch (Linux):

  • Red: with the baseline line removed and the test file untouched, RATCHET_SCOPE_WHOLE_TREE=1 python3 scripts/check_subprocess_encoding.py exits 1 (1 new offender(s), test/test_push_guard.py:129).
  • Green: python3 scripts/check_subprocess_encoding.py --test exits 0 (9 flagged probes, 9 clean probes). python3 scripts/check_subprocess_encoding.py exits 0 on the diff scope with both files in scope, and with RATCHET_SCOPE_WHOLE_TREE=1 (197 known calls in 92 files, was 198 in 93).
  • pytest test/test_push_guard.py -q: 235 passed before, 235 passed after.
  • One process at -n0 with test/test_taskrunner_atomic_persistence.py and test/test_taskrunner_execution_capture_async.py after it: 271 passed.
  • flake8 test/test_push_guard.py exits 0. GITHUB_BASE_REF=main python scripts/check_black_formatting.py exits 0 (Black 26.3.1). scripts/check_comment_history.py exits 0.

Manual verification

N/A: the change is one keyword argument on a test helper, covered by the gate and the file's own tests. Windows was not run here.

Related Issues

No issue exists; burn-down of the subprocess-encoding baseline (precedents: the gate's own PR #5378, and the earlier burn-downs #14648, #14664 and #16447).

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title
  • Existing tests pass and new tests added for new functionality (no new test: the gate and the file's own tests cover the change)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@javenciu
javenciu requested review from a team and KiroCrewCaptain as code owners October 14, 2026 05:32
@javenciu
javenciu requested a review from mbriones98 October 14, 2026 05:32
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ⏭️ skipped

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

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 0127b6810dc3a82e95f6b8a9285f2eb5027a59d4 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

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] 0127b68

Description read

[DESCRIPTION-READ] 167bd554c36780c328e77adc84b1fc4057da5d5f8b3509289b725a79767860f9

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

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 0127b6810dc3a82e95f6b8a9285f2eb5027a59d4 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 0127b68

Verdict parsed from the review's SHA-scoped output markers for commit 0127b6810dc3a82e95f6b8a9285f2eb5027a59d4.

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

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 0127b6810dc3a82e95f6b8a9285f2eb5027a59d4 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 0127b68

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

@github-actions github-actions Bot added the readiness: checking Automated validation is still running 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 github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@javenciu
javenciu force-pushed the test/subprocess-encoding-push-guard branch from 1a18301 to 0127b68 Compare October 14, 2026 11:09
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels 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 github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@javenciu
javenciu enabled auto-merge (squash) October 14, 2026 13:17

@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 (2 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: pins utf-8 decoding on one test subprocess call and drops that file from the subprocess-encoding baseline.

@javenciu
javenciu merged commit c163cd1 into main Oct 14, 2026
112 of 174 checks passed
@javenciu
javenciu deleted the test/subprocess-encoding-push-guard branch October 14, 2026 14: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