Skip to content

fix(preflight): decode async scanner source as UTF-8 - #10715

Merged
undivisible merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-async-scanner-utf8
Jul 30, 2026
Merged

undivisible merged 2 commits into
BasedHardware:mainfrom
tianmind-studio:codex/windows-async-scanner-utf8

Conversation

@tianmind-studio

@tianmind-studio tianmind-studio commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • decode Python source files as UTF-8 in the async blocker scanner
  • add a regression test that records the explicit source encoding
  • normalize an existing diff-scope fixture path so the scanner test suite runs natively on Windows

Root cause

scan_async_blockers.py opened repository source files without an explicit encoding. On Windows, Python therefore used the active ANSI code page (GBK on the reproduced machine) and crashed on valid UTF-8 source before the preflight scan could run. The first observed failure was the em dash in backend/agent-proxy/main.py.

Repository Python sources are UTF-8, so the scanner now declares that contract at the file boundary. The regression test fails against the previous implementation on every platform because it verifies the encoding passed to open.

The adjacent scope test also constructed its key with native separators while production findings are normalized to POSIX separators. Normalizing the fixture removes an unrelated Windows-only failure and keeps the production path unchanged.

Validation

  • production scanner, without PYTHONUTF8: 452 def and 115 async def functions scanned; zero selected or legacy findings
  • backend/tests/unit/test_scan_async_blockers.py and backend/tests/unit/test_async_resource_correctness.py: 33 passed
  • Black and git diff --check
  • pr_preflight.py --suggest: no product invariants; Failure-Class: none

Failure class

Failure-Class: none

Review in cubic

@Git-on-my-level Git-on-my-level added candidate-clean-pr Small, safe, well-scoped, well-tested contribution; model clean PR workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior needs-maintainer-review Needs a human maintainer to sign off before merge labels Jul 27, 2026
@Git-on-my-level

Copy link
Copy Markdown
Member

Thanks for the focused fix. I reviewed the scanner change and the regression coverage.

This looks like the right direction: opening scanner inputs with encoding="utf-8" makes the preflight behavior deterministic across Windows locales, and the new test verifies the actual file boundary rather than only checking parsed output. The adjacent path normalization update is also consistent with the scanner's POSIX-normalized scope keys and removes a Windows-only fixture mismatch without changing production scope logic.

I also ran the targeted unit file locally in a clean env with only the missing test dependency installed:

env -i HOME=$HOME PATH=$PATH PYTHONPATH=/workspace/omi-pr-10715-review/backend .venv/bin/python -m pytest tests/unit/test_scan_async_blockers.py -q

Result: 26 passed, 1 warning in 0.12s.

I am leaving this as a positive maintainer signal rather than a formal approval because this touches a preflight/automation scanner path and the automation approval gate requires human sign-off for workflow-sensitive changes before merge.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@tianmind-studio

tianmind-studio commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Fresh native-Windows integration evidence on current main: with this head stacked into the Windows preflight series, backend-async-blockers scanned 455 sync and 134 async endpoints, reported 0 selected blockers, and passed. The complete official make preflight then passed all 30 selected checks in 223.41s. The effective GitHub checks shown by gh pr checks are also green/skipped; the stale red count comes from earlier cancelled duplicate Repo Checks runs.

@undivisible undivisible 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.

Reviewed the UTF-8 source handling and its focused regression coverage.

@undivisible
undivisible merged commit 2367980 into BasedHardware:main Jul 30, 2026
39 of 43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

candidate-clean-pr Small, safe, well-scoped, well-tested contribution; model clean PR needs-maintainer-review Needs a human maintainer to sign off before merge workflow-review Needs maintainer review for workflow, automation, hooks, or CI behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants