fix: guard Unix-only grp import behind sys.platform check for Windows compatibility#7
Merged
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix Windows CLI startup failure caused by Unix-only grp import
fix: guard Unix-only Jul 16, 2026
grp import behind sys.platform check for Windows compatibility
MatthiasLew
approved these changes
Jul 16, 2026
MatthiasLew
left a comment
There was a problem hiding this comment.
Verified on native Windows 11 with Python 3.13.14 and PowerShell 5.1. The original blocking grp import issue is resolved: koru --help, koru --version, and koru --doctor --project . now start successfully. All 29 tests in tests/test_init.py pass. The remaining full-suite Windows failures are unrelated platform-specific issues and should be handled separately.
tom-sapletta-com
marked this pull request as ready for review
July 16, 2026 10:06
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
init_host_environment.pyunconditionally imports Python's built-ingrpmodule, which is Unix-only. On Windows this raisesModuleNotFoundErrorat import time, blocking the entire CLI before argument parsing —koru --help,--version, and--doctorall fail immediately.Changes
src/koru/init_host_environment.py— replace top-levelimport grpwith a platform-conditional import:Update
_uinput_snapshot()to guard thegrp.getgrgid()call with_grp is not None, falling back to the raw numeric GID string. On Windows/dev/uinputis absent anyway so the guard is never reached in practice.tests/test_init.py— two new tests:test_grp_sentinel_matches_platform: verifies_grpisNoneon Windows and the realgrpmodule elsewhere.test_uinput_snapshot_absent_device: verifies_uinput_snapshot()never raises and always returns a dict containing"present", regardless of platform.