Skip to content

Fix Windows path separators and console encoding#83

Open
dc995 wants to merge 1 commit into
NVIDIA:mainfrom
dc995:fix/windows-path-and-console-encoding
Open

Fix Windows path separators and console encoding#83
dc995 wants to merge 1 commit into
NVIDIA:mainfrom
dc995:fix/windows-path-and-console-encoding

Conversation

@dc995

@dc995 dc995 commented Jun 16, 2026

Copy link
Copy Markdown

Summary

Fixes three Windows-specific portability bugs discovered while running the test suite and CLI on Windows.

1. Path separators in �uild_context (product bug)

�uild_context emitted component and file-cache paths using the OS-native separator (e.g. scripts\helper.py on Windows) instead of forward slashes. This broke SARIF output and any consumer/test expecting POSIX-style paths. Fixed by normalizing relative paths with Path.as_posix().

2. Console encoding crash in the CLI (product bug)

The terminal report crashed on Windows consoles (cp1252) with UnicodeEncodeError when rendering box-drawing characters/icons. Fixed by reconfiguring stdout/stderr to UTF-8 (errors="replace") at CLI startup.

3. Test helpers (test-only)

Five test helpers built fixture file-caches with str(path), producing backslash keys on Windows. Normalized them with .as_posix() to match the product behavior.

Validation

  • Unit tests: 600 passed, 11 skipped (was 11 failing on Windows before this fix)
  • Lint (ruff check), format (ruff format --check), build (python -m build): all pass
  • Scans across dir/single-file/zip inputs and terminal/json/markdown/sarif outputs: all work; SARIF validates against 2.1.0; exit codes correct (1 risk>50, 0 safe, 2 error)
  • Integration tests (run against a real gpt-4o endpoint): the previously credential-blocked tests pass; a small number of semantic-judgment tests are nondeterministic across runs (model calibration), independent of this change

Notes

Changes are surgical: path-separator normalization and stdout encoding only. No behavior change to analysis logic.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

build_context emitted component/file-cache paths using the OS-native
separator (e.g. scripts\helper.py on Windows), which broke SARIF output
and tests that expect POSIX-style paths. Normalize relative paths with
Path.as_posix() so analysis output is identical across platforms. Apply
the same �s_posix() normalization to the five test helpers that build
file caches from fixture directories.

The CLI terminal report also crashed on Windows consoles (cp1252) with
UnicodeEncodeError when rendering box-drawing characters and icons.
Reconfigure stdout/stderr to UTF-8 (errors="replace") at startup so the
report renders without crashing on any platform.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant