Skip to content

fix(config): close Windows portability gaps in memu init - #636

Open
xnne-bot wants to merge 4 commits into
NevaMind-AI:feat/config-env-commandfrom
XnneHangLab-Mirror:fix/windows-config-portability
Open

fix(config): close Windows portability gaps in memu init #636
xnne-bot wants to merge 4 commits into
NevaMind-AI:feat/config-env-commandfrom
XnneHangLab-Mirror:fix/windows-config-portability

Conversation

@xnne-bot

@xnne-bot xnne-bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

📝 Pull Request Summary

Fix the Windows portability gaps found while validating the init and config work in #632, without adding elevation, ACL mutation, or authorization prompts.


✅ What does this PR do?

  • Keeps POSIX 0600 / 0700 assertions on POSIX and tests the intended inherited-ACL behavior on Windows.
  • Preserves pathless platform certificate stores before falling back to certifi, so Windows system and corporate roots remain available.
  • Reads UTF-8 BOM, UTF-16 BOM, and legacy Windows ANSI config.env files through one shared loader, then normalizes them to UTF-8 on the next write.
  • Replaces the inaccurate byte-identical merge claim with the actual logical-line preservation guarantee.

🤔 Why is this change needed?

PR #632 currently passes its Linux-only CI but has Windows-specific gaps:

  • POSIX permission-bit tests fail on Windows even though the implementation deliberately inherits Windows ACLs.
  • get_default_verify_paths() exposes no file path on Windows, causing a healthy OS certificate store to be replaced by certifi.
  • Existing config files produced by Windows PowerShell 5.1 or legacy text writers can raise UnicodeDecodeError before init can migrate them.
  • Cross-platform newline and encoding normalization contradicts the documented byte-identical guarantee.

Validated on Windows 11 with Python 3.13. The affected suite passes with 59 passed, 2 skipped; both skips are the expected POSIX-only permission tests. Pre-commit, ruff, mypy, deptry, and lock checks pass.

Parent PR: #632
Tracking notes: MrXnneHang/xnnehang.top#111


🔍 Type of Change

  • Bug fix
  • New feature
  • Documentation update
  • Refactor / cleanup
  • Other (please explain)

✅ PR Quality Checklist

  • PR title follows an allowed format (for example feat:, fix:, docs:, memory base:)
  • Changes are limited in scope and easy to review
  • Documentation updated where applicable
  • No breaking changes (or clearly documented)
  • Related issues or discussions linked

📌 Optional

  • Screenshots or examples added (if applicable)
  • Edge cases considered
  • Follow-up tasks mentioned

The POSIX-shaped local database path examples in the install guides remain a non-blocking follow-up suggestion; this patch does not expand into a multi-host documentation rewrite.

🤖 Generated with Claude Code

Keep POSIX mode-bit assertions on POSIX, and verify on Windows that config writes inherit ACLs without invoking chmod or elevation.\n\nCo-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Probe the platform default SSL context before falling back to certifi when no cafile or capath is exposed. This keeps the Windows certificate store, including corporate roots, while retaining certifi for a true trust vacuum.\n\nCo-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Decode UTF-8 BOM, UTF-16 BOM, and Windows ANSI config files through one shared reader so init guards and runtime loading agree. Normalize legacy files to canonical UTF-8 on the next write, even when no logical value changes.\n\nCo-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Replace the byte-identical claim with the behavior the writer actually guarantees: unmanaged text, order, and comments survive while encoding and line endings may be normalized.\n\nCo-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.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.

2 participants