Skip to content

fix(python): generate portable binding bytes - #80

Merged
viktar-b merged 3 commits into
mainfrom
codex/windows-bindings
Sep 30, 2026
Merged

viktar-b merged 3 commits into
mainfrom
codex/windows-bindings

Conversation

@viktar-b

@viktar-b viktar-b commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

Why

Windows binding generation uses native path separators and text-mode writes, which change the source closure and invalidate existing numerical references. Fixes #77.

Scope

  • Generate forward-slash path literals and UTF-8/LF bytes, then compare and replace those exact bytes.
  • Pin Python sources and stubs to LF in the repository and generated projects. Preserve exact-byte capture and existing references.
  • Add byte-drift, Unicode, ownership, and archive-backed Git checkout regressions.

Verification

  • Installed-wheel binding tests reproduced CRLF freshness failures before the fix and pass afterward.
  • All five initializer package tests pass, including Git checkout with core.autocrlf=true from an installed archive.
  • All 113 Python tests pass against a rebuilt installed wheel. Initializer lint and typecheck pass.
  • CLI build and all three canonical demo integration tests pass. A fresh checkout with core.autocrlf=true retains the canonical closure hash and passes the original untouched reference.
  • Native Windows verification remains pending.

@vercel

vercel Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
calculation-source-object Ready Ready Preview Sep 30, 2026 9:25am UTC

Request Review

@viktar-b

Copy link
Copy Markdown
Owner Author

Independent verifier verdict: PASS+NOTES

Reviewed PR 80 at head ef6cfc547bf9c33913f2ca91aa919f048b179f91 against base 48672ce0c0788561c9570aa571f2067c2be1fc4a. Stable patch ID: 4794e9fcc77113f3eb47eb6561b1203f8dcea451.

I found no correctness, ownership, or test-boundary defect in the five-file patch. The implementation keeps binding generation in cso-python, stores expected generated files as bytes, converts the generated runtime import path to /, compares freshness as bytes, writes atomically in binary mode, and preserves authored non-UTF-8 files. The root and initializer-template attributes pin tracked Python and stub files to LF. The package test uses a synthetic temporary source; canonical examples remain in root integration coverage.

Live proof

  • Built wheels from the base and head, installed them into separate venvs, and ran the same nested Unicode binding probe. Both wheels generated callable UTF-8/LF bindings with no BOM and identical hashes: café.py 90c808463e059d103da1fffc2127b990f183af79a2f0736b56a5a44cd65a2090; café.pyi cbe4c21f8f60cfd17e9caa65d5a92308dbcd2456d27557c4a85d087515f36c13.
  • After replacing LF with CRLF, the base wheel reproduced the defect with ok=true and stale=[]. The head wheel returned ok=false, listed both runtime and stub as stale, left them unchanged in check mode, and regenerated their exact original hashes.
  • The installed head wheel passed the Python package suite: 113 tests. create-cs-object passed its archive-backed package suite: 5 tests, including core.autocrlf=true checkout of generated-project .py and .pyi files. Its lint and typecheck passed after the fresh checkout's core/react declarations were built.
  • npm pack --workspace create-cs-object included template/.gitattributes with exactly *.py text eol=lf and *.pyi text eol=lf.
  • A disposable copy of examples/two-panel generated bindings, passed bindings --check, and verified width 2 against the unchanged reference. Receipt: entry hash f68b3e04ef696441bf328127a4f438d34ae373e63c7f054b4b817f98bf2a18d3, closure efd06bb6a77b704d0d342d465602659d8c2e81a45dd3d1239797be711035f0bd, sourceToDocumentConsistency: passed, and independentReferenceAgreement: passed with 7 checked symbols.
  • Native run 36694359668 checked out this exact head with core.autocrlf=true on Windows Server 2025, Node 24.21.0, and Python 3.11.9. bindings-bytes passed the three byte/callability/freshness tests. bindings-canonical passed the canonical width-2 receipt and stale-reference tests.
  • All five required PR checks are green: quality, isolation, installed-packages, dependency-review, and pr-title. CodeQL's Actions, JavaScript/TypeScript, and Python analyses are also green. The only PR conversation item is the Vercel status comment; there are no unresolved review findings.

Diff and comment audit

The scoped diff adds no TypeScript, lint, or Python suppressions. It adds no phase comments or workaround explanations that need removal. pstack:no-comments results: 0 deletions, 0 restorations, 0 encoding offers, and no open comment constraints. No production edits were made during review.

Notes before merge

PR 80 is now behind main after unrelated CI-policy work landed at 91282ab0836dfbba579b2f5e65c1d672119205a2. Update the branch, rerun required checks on the resulting head, and compare its patch ID before using this verdict. A changed patch needs fresh review. The native evidence is Windows Server 2025 under PowerShell 7; it does not establish Windows 11, PowerShell 5.1, foreground Ctrl+C behavior, or human PDF inspection.

Commands

npm ci; create .venv; build and install the head wheel; build and install the base wheel from git archive; run each wheel against .scratch/windows-support/pr80-review/probe.py; .venv/bin/python packages/cso-python/tests/run.py; npm test --workspace create-cs-object; npm run lint --workspace create-cs-object; npm run build:lib; npm run typecheck --workspace create-cs-object; npm pack --workspace create-cs-object; build the CLI; run bindings and verify on a disposable canonical copy; inspect gh run view 36694359668 --job ... --log; and query gh pr checks 80 --required plus current PR comments and reviews.

@viktar-b

Copy link
Copy Markdown
Owner Author

Root verification PASS at 19dced29b703051891294d4b6104379e20252989 against main 91282ab0836dfbba579b2f5e65c1d672119205a2.

The independent non-author review is recorded above. I fetched the refreshed branch and verified its stable patch ID remains 4794e9fcc77113f3eb47eb6561b1203f8dcea451. The update absorbs the CI policy only. The reviewed binding patch is unchanged.

Exact-patch native Windows proof passed binding bytes, freshness, callability and canonical reference agreement with Windows Git conversion enabled. Current-head quality, isolation, installed-packages, dependency-review, PR-title and CodeQL all pass. GitHub reports CLEAN and MERGEABLE. No unresolved review threads were found. The user authorized merging after CI/CD passes. Normal protected merge is authorized for this head only.

@viktar-b
viktar-b merged commit ea04d2d into main Sep 30, 2026
12 checks passed
@viktar-b
viktar-b deleted the codex/windows-bindings branch September 30, 2026 09:34

This branch was successfully deployed

1 active deployment
Preview — 19dced29 Deployed Sep 30, 2026 by vercel[bot]
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.

fix(python): Windows bindings invalidate canonical reference hashes

1 participant