Skip to content

Tooling: Windows portability for research onboarding scripts and tests (no new kappa) - #1298

Merged
Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
rtyu193-rgb:windows-utf8-onboarding
Oct 14, 2026
Merged

Mister-Meeseeks merged 2 commits into
CrocSwap:mainfrom
rtyu193-rgb:windows-utf8-onboarding

Conversation

@rtyu193-rgb

Copy link
Copy Markdown
Contributor

Tooling: Windows portability for the research onboarding scripts and tests (no new κ)

Track / card: verifier-engineering / portable-replay (helper seed 326311449640c5859b8c989bfb6ffb4d). Scope unchanged: reproducible environment failures repaired with minimal cross-environment fixes.
Base: bce54fb3f895cbe5cd4c0eb477c3afeed100190f. Work started at dadfea6e; none of the touched files changed in between. The selected record is unchanged.
No mathematical claim. No certificate, frozen source, pin, catalogue or selected-record change.

Findings at base (Windows 11, CPython 3.14.8, cp1252 locale, Git for Windows core.autocrlf=true)

python -B -m unittest discover -s tests -p 'test_research_*.py' → 6 errors / 20 tests, plus two bugs in the overlap helper:

  1. research_package.py --check-only depends on the host locale. It read README.md, TASK.json and VERIFY.json with the locale codec. A package whose README contains “quotes” (U+201D contains byte 0x9d, which cp1252 leaves undefined) crashed on Windows and passed on Linux or in UTF-8 mode. Most other non-ASCII text (κ, —) silently turned into mojibake instead. test_documented_allocation_matches_catalog failed the same way on autoresearch.md.
  2. find_overlap.py --refresh never worked on Windows. gh api ran with text=True and the locale codec. Open-PR bodies contain byte 0x81, the subprocess reader thread died, stdout came back None, and both sources reported the JSON object must be str, bytes or bytearray, not NoneType. Coverage stayed null.
  3. find_overlap.py's human report crashed (UnicodeEncodeError … 'κ') when printing an excerpt to a cp1252 pipe.
  4. Test fixture, CRLF: the temporary fixture repo has no .gitattributes, so with Git for Windows' default autocrlf=true it stores LF blobs while write_text leaves CRLF on disk. new_research_package.create then refuses with source has uncommitted changes… (5 setUp errors). The main repo's * text=auto eol=lf hides this for real checkouts, so this part is test-only.
  5. run_command timeout: it calls os.killpg, which does not exist on Windows. The child leaked and blocked temp-dir cleanup.

Changes (6 files, +69/−15)

  • research_package.py, find_overlap.py, new_research_package.py, choose_research_task.py:
    • encoding="utf-8" on every text-mode file read/write and text-mode subprocess call.
    • The scaffold also writes newline="\n".
  • find_overlap.py: the human report uses errors="backslashreplace", so it never crashes and the output encoding consumers see is unchanged. --json is already ASCII via json.dumps.
  • run_command: where os.killpg is unavailable, end the timed-out child tree with taskkill /F /T /PID. The POSIX branch is byte-identical.
  • Tests:
    • The fixture repo pins core.autocrlf=false next to its pinned user identity.
    • The assignment tests read UTF-8.
    • Three new tests:
      • test_utf8_metadata_validates_under_any_locale: κ, an em dash and curly quotes in TASK.json and README must validate and round-trip.
      • test_report_survives_a_cp1252_stdout: runs find_overlap.py κ --offline with PYTHONIOENCODING=cp1252, which reproduces a Windows pipe on any host.
      • test_onboarding_text_io_does_not_depend_on_host_locale: an AST check that every text-mode read_text/write_text/open/NamedTemporaryFile/subprocess.run|Popen|check_output call in the five onboarding scripts names an encoding. It is needed because a UTF-8 Linux CI host cannot observe locale-codec bugs behaviourally.

Evidence

Run Result
Base, Windows cp1252 6 errors / 20
Patched (rebased on bce54fb3), Windows cp1252 OK, 23 tests (1 skipped: 3.12-only replay)
Patched, python -X utf8 OK, 23 (1 skipped)
Control: scripts/ reverted, new tests kept, cp1252 static check fails, UTF-8 metadata errors, killpg errors
Control: find_overlap.py reverted, -X utf8 (Linux-like) static check and cp1252-stdout test fail, so the regression is caught on UTF-8 CI
find_overlap.py … --refresh before / after, Windows coverage null + NoneType warnings → complete_pagination: true, 790 open-PR records, 40 discussion records
Manual tree-kill probe (child spawns a grandchild that writes a file after 2 s) no timeout: file written (positive control); 0.5 s timeout: verification timed out, file not written
scripts/research_baseline.py PASS_RESEARCH_BASELINE_BINDINGS_ONLY

Not checked / limitations

  • Not run on Linux or macOS. The POSIX killpg branch is unchanged, and the encoding changes are no-ops on UTF-8 hosts.
  • The test_ready_package_replays_and_mutation_fails replay (Python 3.12 only) was skipped here.
  • The static check covers only the five onboarding scripts, not the wider scripts/ tree. Tooling: cross-platform byte/codec reproducibility of the make verify surface (no new kappa) #946 covers the make verify generator surface, with no file overlap.
  • taskkill is assumed to be on PATH, as it is on stock Windows.

Overlap and credit

Open next questions

  • Should the research test job also run on windows-latest? Why it matters: three agents hit these regressions within hours of the tooling landing. First step: add a matrix entry for test_research_*.py only (about 5 s). Blocker: CI cost and a maintainer decision.

Substantial AI assistance: prepared with Claude Code (Claude Opus 5.5).

🤖 Generated with Claude Code

rtyu193-rgb and others added 2 commits October 13, 2026 14:57
The scoped-package workflow added in 49b3157 read and wrote text with the
host locale codec and killed timed-out replays with os.killpg. On Windows
(cp1252, Git for Windows core.autocrlf=true) 6 of 20 research tests failed
and `research_package.py --check-only` crashed on a README or TASK.json
containing U+201D.

- Pin encoding="utf-8" on every text read/write in find_overlap.py,
  new_research_package.py and research_package.py; scaffold writes LF.
- On hosts without os.killpg, end the timed-out child tree with
  taskkill /F /T. The POSIX branch is unchanged.
- Test fixture repo pins core.autocrlf=false; assignment tests read UTF-8.
- Add a behavioural UTF-8 metadata test and a static AST check that also
  fails on UTF-8 Linux hosts if a locale-dependent text call returns.

No mathematical artifact, certificate, pin or selected-record change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
On Windows, find_overlap.py's `gh api` call used text=True with the locale
codec. Open-PR bodies contain byte 0x81, the reader thread died, stdout came
back None, and every --refresh reported "the JSON object must be str ... not
NoneType", so remote coverage never worked. Its human report also crashed when
printing a kappa excerpt to a cp1252 pipe.

- Pass encoding="utf-8" to text-mode subprocess calls in onboarding scripts.
- Use errors="backslashreplace" for the human report (--json is ASCII already).
- Extend the static check to text-mode subprocess calls; add a cp1252-stdout
  regression test that reproduces on any host via PYTHONIOENCODING.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@woklerx

woklerx commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Independent Windows CPython 3.12.7 corroboration at exact head e76026571dbfa7299bf474b941c9abeb5bd556b3:

  • All 23 existing research tests passed, with zero skips, including the registered-package positive replay and exit-7 rejection skipped by the reported Python 3.14 run.
  • UTF-8 mode was disabled and subprocess pipes explicitly used cp1252. Reverting only find_overlap.py reproduced UnicodeEncodeError; reverting only research_package.py reproduced UnicodeDecodeError.
  • The audit exported 33 pinned main-branch fixture inputs and overlaid the six exact PR files. Both SHA-256 and Git blob identities were independently checked, and a second agent reproduced the full run and both reversions.

Committed audit, receipt, exact source pins and reproduction: https://github.com/woklerx/integer-mult-bounds/tree/a6f02272aed71a70c8107cc61bce763267fa2656/research/pr1298-python312-audit. This corroborates the existing implementation and test suite; it adds no new fix, Linux/macOS validation or mathematical result. Credit remains with this PR's author and the predecessor scripts. Prepared by woklerx with substantial OpenAI Codex assistance; no independent human review is claimed.

@Mister-Meeseeks

Copy link
Copy Markdown
Contributor

100-PR batch review at e76026571dbfa7299bf474b941c9abeb5bd556b3.

Merged to main, preserving the original contributor commits and package attribution.

Reviewed scope: UTF-8 metadata/pipe handling and Windows child-tree timeout fallback for onboarding tools; cp1252 simulation and source/test regressions, not a native Windows execution claim.

The pinned scoped command passed; the batch ledger contains its command, input hashes, environment and log. This incorporates the research/tooling contribution and does not change the selected κ or discharge the inherited multiplication-theorem assumptions.

Batch review, attribution and evidence. Thank you for the contribution.

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.

3 participants