Skip to content

fix(nodeenv): preserve surrogateescaped activation content - #451

Open
jihtsan wants to merge 2 commits into
ekalinin:masterfrom
jihtsan:codex/442-surrogateescape-activation
Open

jihtsan wants to merge 2 commits into
ekalinin:masterfrom
jihtsan:codex/442-surrogateescape-activation

Conversation

@jihtsan

@jihtsan jihtsan commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Closes #442.

Encode generated text with UTF-8 surrogateescape so undecodable filesystem bytes survive writing activation scripts. Ordinary Unicode still uses UTF-8, byte content is unchanged, and unrelated invalid surrogates still raise an error. Add overwrite/append regressions and a Linux-only test that activates an environment in a real non-UTF-8 path.

Validation on macOS, Python 3.12.14:

  • New focused tests: 7 passed; Linux filesystem-path test skipped.
  • Full non-integration suite: 415 passed, 11 skipped, 2 expected failures, with urllib.request.getproxies disabled in the test process. The normal invocation fails one existing localhost connection-refused test with HTTP 503; the unchanged base reproduces the same failure because macOS system proxy settings intercept it. Original logs are retained.
  • Real nodeenv --node=system --prompt=<raw byte 0xe9> creation and bash activation preserve the raw prompt byte after this change; the original code raises UnicodeEncodeError.
  • flake8 --extend-ignore=E127 nodeenv.py tests setup.py and git diff --check pass.

This macOS filesystem rejects non-UTF-8 filenames, so the real raw-path activation test is provided for Linux CI and was not executed locally. Other Python/OS versions and download/build integration tests were not run.

AI-assisted implementation and review.

This branch has not been deployed

No deployments
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.

activate isn't written when the environment path isn't valid UTF-8

1 participant