Skip to content

test(deploy): pin utf-8 on the test_deploy_web_profiles subprocess call - #20140

Merged
javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-deploy-web-profiles
Oct 14, 2026
Merged

javenciu merged 1 commit into
mainfrom
test/subprocess-encoding-deploy-web-profiles

Conversation

@javenciu

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Make one test's subprocess call decode its output as UTF-8 on every platform instead of the host code page, and take that file off the subprocess-encoding baseline.

test/test_deploy_web_profiles.py runs one text-mode subprocess.run (line 226, in test_create_aws_profile_writes_only_allowlisted_keys) with text=True and no encoding=. Without an explicit encoding Python decodes the child's output with the locale's code page: UTF-8 on POSIX, the legacy ANSI code page on Windows, where any non-ASCII byte comes back as mojibake (#5249 is the public reference for this class). scripts/check_subprocess_encoding.py keeps a shrink-only list of such calls in .github/subprocess-encoding-baseline.txt, and this file is listed there as 1 test/test_deploy_web_profiles.py.

Why it matters

Test-only: no shipped behaviour changes, and nothing fails today because the child prints ASCII JSON. The call is still a place where the Linux and Windows runs of this test could decode differently, and its baseline entry can only be removed by pinning it. With the entry gone, the ratchet holds this file at zero, so a new unpinned call added here later fails CI instead of passing as grandfathered.

Not a goal

  • No refactor, no reformatting of untouched lines, and no new helper.
  • No change to any other baselined file or to the gate.
  • The python -c credential helper that src/kiro_crew/deploy/profiles.py generates also calls aws in text mode. It is a string literal the gate does not scan, it is generated only on POSIX (the function returns early on Windows), and it is production code outside this test-only change.
  • No Windows run: the mojibake itself cannot be reproduced on Linux.

What changed (motivation → approach → change)

The call decoded with the locale because text=True was given without encoding=. The change is the argument the gate asks for: encoding="utf-8" on subprocess.run(parts, capture_output=True, text=True, env=env) at test/test_deploy_web_profiles.py:226, the same form test/test_deploy_round1_fixes.py already uses for its bash -n check. The child is the generated credential_process command (python -c, which runs a fake aws script found on PATH) and it prints ASCII JSON from json.dumps, which UTF-8 decodes identically on every platform. The baseline line 1 test/test_deploy_web_profiles.py is deleted in the same change. Two files change: one edited call and one removed baseline line.

Backwards compatibility

Removes nothing: a test-only edit plus one removed baseline entry; no shipped code, API or data changes.

Tests

  • Baseline line deleted with the test file untouched, judged over the whole tree (RATCHET_SCOPE_WHOLE_TREE=1 python3 scripts/check_subprocess_encoding.py): exit 1, "1 new offender(s)", test/test_deploy_web_profiles.py:226. The plain run judges only the committed diff, so it needs the override to see this.
  • With the edit committed: python3 scripts/check_subprocess_encoding.py --test exit 0, and python3 scripts/check_subprocess_encoding.py exit 0 with both files in scope.
  • pytest test/test_deploy_web_profiles.py -q: 20 passed before, 20 passed after. Run in one process at -n0 with test/test_taskrunner_atomic_persistence.py and test/test_taskrunner_execution_capture_async.py after it (the file first, to expose a leaked patch): exit 0.
  • flake8 clean on the touched file. GITHUB_BASE_REF=main python3 scripts/check_black_formatting.py exit 0 under the pinned black (26.3.1). The file is already in .github/black-baseline.txt; no formatter hunk touches the edited line, which is 91 characters against the limit of 100.
  • On POSIX the locale encoding is UTF-8, so this change alters no result on Linux or macOS. The ratchet is the proof that the call no longer depends on the locale.

Manual verification

N/A — the ratchet and the file's own tests are sufficient; the Windows decode itself cannot be exercised on Linux.

Screenshots / video

N/A — test-only change, no user-visible UI.

Related Issues

No issue exists; burn-down of the subprocess-encoding baseline (precedents: the gate's own PR #5378, and #8443, which shrank the same baseline).

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; no new functionality, so no new tests (the ratchet is the check)
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable): N/A, no docs describe this call
  • 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

UX Review (Opus 5.5) — ⏭️ skipped

Revision fef96758d54023122f6c60b5e4337f5cb4a30dc7 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

First Principles Review (Opus 5.5) — ⏭️ skipped

Revision fef96758d54023122f6c60b5e4337f5cb4a30dc7 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

Design Review (Opus 5.5) — ✅ PASS

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

Design-Verdict: PASS

Nothing to check.

[DESIGN-REVIEWED] fef9675

Description read

[DESCRIPTION-READ] c2c96cf5b267d18e2d414ca007ddb1ebf53bc2ccb32e75c53eef65fc3754586a

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 fef96758d54023122f6c60b5e4337f5cb4a30dc7 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fef9675

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

False positive or not applicable? A repository writer can comment:
/ai-review override fable fef96758d54023122f6c60b5e4337f5cb4a30dc7: <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 fef96758d54023122f6c60b5e4337f5cb4a30dc7 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fef9675

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fef96758d54023122f6c60b5e4337f5cb4a30dc7: <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: 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 08:48

@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 on one test subprocess call and drops its line from the encoding baseline.

@javenciu
javenciu merged commit c39d739 into main Oct 14, 2026
112 of 174 checks passed
@javenciu
javenciu deleted the test/subprocess-encoding-deploy-web-profiles branch October 14, 2026 09:06
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