Skip to content

Run kindex on Windows - #89

Open
VelitRicardo wants to merge 23 commits into
wandercom:mainfrom
VelitRicardo:windows-port
Open

VelitRicardo wants to merge 23 commits into
wandercom:mainfrom
VelitRicardo:windows-port

Declare the modern Claude hook modules ES modules

98254f6
Select commit
Loading
Failed to load commit list.
adaptcom / Adapt Review failed Oct 20, 2026 in 13m 31s

Confidence 2/5

Confidence Score: 2/5

Summary

Windows port via a new platform_io seam; design is sound and POSIX paths are largely unchanged, but the Linux suite (Python 3.12) now has 7 PR-caused failures, and the Windows ledger cap breaks on Python <3.13.

Important Files Changed

File Overview
src/kindex/platform_io.py New seam: nofollow open, msvcrt lock, home/expanduser, kill_tree, Git sh discovery
src/kindex/actions.py Windows _run_process variant with threads, taskkill, Git-sh runner via env var
src/kindex/config.py platform_io home/expanduser; Windows degraded-ledger cap via move-aside (unguarded os.fchmod)
src/kindex/cli.py errors=replace on stdout/stderr; run_crontab; platform_io expanduser
src/kindex/setup.py run_crontab fallback; merge driver quoted with shlex.join (duplicates _find_kin_path)
src/kindex/code_map.py Resolve Windows paths on Windows instead of lexical relative_to
src/kindex/adapters/code.py Module keys use as_posix() for cross-platform code-map ids
src/kindex/store.py open_nofollow for migration lock; pre-epoch naive bound fallback
src/kindex/sim.py shell_can_run and platform_io.expanduser for sim/advocate commands
src/kindex/supervisor.py platform_io lock/open_nofollow; shell_can_run in preflight
src/kindex/subscription_review.py platform_io lock, fsync_directory, kill_tree, essential_environment
src/kindex/scheduling.py Blocking platform_io lock; run_crontab
src/kindex/dream.py platform_io lock; closes fd on contention
src/kindex/attention.py platform_io non-blocking lock replaces fcntl fallback
src/kindex/daemon.py Cron lock through platform_io
src/kindex/repo_memory.py open_nofollow + platform_io lock for artifact lock
src/kindex/project_store.py open_nofollow for .gitignore append; platform_io home
src/kindex/ingest.py Audience inference reads POSIX form of project path
src/kindex/sessions.py normalize_project_path via platform_io.expanduser
src/kindex/supervisor_health.py open_nofollow and platform_io home
src/kindex/supervisor_health_activity.py platform_io.home for agent state roots
src/kindex/supervisor_display.py platform_io.home for Claude root and ~ shortening
src/kindex/mcp_lite.py platform_io.expanduser in repo scope
src/kindex/mcp_server.py platform_io.expanduser for profile data_dir compares
src/kindex/kinbase.py platform_io.expanduser for repo roots
src/kindex/routing.py platform_io.expanduser for cwd/profile roots
src/kindex/reminders.py platform_io.expanduser for codex home and cwd
src/kindex/secret_mask.py Default resolver uses platform_io.expanduser
src/kindex/snapshots.py platform_io.home for XDG state fallback
src/kindex/analytics.py platform_io.home for archive db candidate
src/kindex/vectors.py platform_io.expanduser in project path normalization
src/kindex/adapters/claude_web.py DEFAULT_DIR via platform_io.home
src/kindex/adapters/codex_sessions.py platform_io.expanduser availability check
src/kindex/adapters/conversations.py platform_io.expanduser for --directory
src/kindex/adapters/sessions.py platform_io.expanduser availability check
src/kindex/claude_modern/hooks/package.json Declares hook modules ESM; copied by copytree install
tests/test_platform_io.py New contract tests; six fail on Linux because os.name is monkeypatched
tests/test_run_process_portable.py Interpreter-based _run_process contract tests; pass on Linux
tests/test_cli_output_encoding.py ASCII-strict stdout must not crash CLI
tests/test_hook_scope_fail_open.py Three tests for the Windows ledger cap, run on every platform
tests/test_mcp_lite.py Loopback connects allowed; ip_address() raises on hostnames
tests/test_graph_transfer.py kin executable suffix derived from sys.executable (breaks for python3.12)
tests/test_kin_merge.py Quoted driver; new quoting test
tests/test_scheduling.py posix_shell harness; redundant inner platform_io import
tests/test_setup.py run_crontab missing-binary test; platform_io.home patch
tests/test_cron_reliability.py Patch platform_io.home instead of Path.home
tests/test_clone_config_authority.py Quoted markers; Git bash on Windows
tests/test_claude_install.py posix_shell harness; package.json type assertion
tests/test_sessions.py normalize_project_path for expected identities
tests/test_snapshots.py Compare details.path field; normalized project paths
tests/test_prime_surfaces.py Descriptor leak via lowest free fd
tests/test_project_config.py data_dir expectation via project / '/tmp/...'
tests/test_integrations_review.py Scope path matched in JSON-escaped form
tests/test_implicit_scope.py Windows PATH keeps git dir only
tests/test_ollama_review_contract.py platform_io lock; essential env in child
tests/test_v8_ledger_race.py platform_io lock replaces fcntl
tests/test_v8_config_seam.py re.escape on path match
tests/test_dream.py platform_io lock in contention test
tests/test_reminder_action_safety.py Quoted marker path
tests/test_sim.py Quoted sim command path
tests/test_release_metadata.py UTF-8 reads
tests/test_admission_notification_contract.py essential_environment in closed env
tests/test_historical_native_contract.py essential_environment in closed env
tests/test_sim_queue_contract.py essential_environment in closed env
tests/supervisor_acceptance/test_supervisor_acceptance.py Windows PATH uses tool dirs instead of symlinks

Findings

  • tests/test_platform_io.py:236 — Patching os.name to 'nt' makes pathlib build WindowsPath, which cannot be instantiated on POSIX: six tests here fail on Linux 3.12; gate Windows branches on a patchable module flag instead.
  • src/kindex/platform_io.py:52 — Top-level import subprocess reaches config.py's import chain; test_budget_concurrency fakes msvcrt so subprocess imports _winapi and fails on Linux. Import subprocess lazily in kill_tree.
  • src/kindex/config.py:1541 — os.fchmod does not exist on Windows before Python 3.13 (requires-python >=3.10); it raises after the ledger was moved aside, leaving it stranded. Guard with hasattr like store.py.
  • src/kindex/config.py:1514 — Any failure after the move-aside leaves entries only in .capping, invisible to readers until the ledger regrows past the cap; restore aside to path on the error path.
  • src/kindex/platform_io.py:68 — Refusing every reparse point also refuses OneDrive/cloud placeholder files; restrict to st_reparse_tag symlink and mount-point tags.
  • src/kindex/platform_io.py:62 — all omits shell_can_run, which sim.py and supervisor.py call; add it.
  • tests/test_mcp_lite.py:365 — ipaddress.ip_address raises ValueError for a hostname before forbidden() records the attempt, so a swallowed hostname connect now passes; catch ValueError and treat as forbidden.
  • tests/test_graph_transfer.py:446 — Path(sys.executable).suffix is '.12' for /usr/bin/python3.12, so the test looks for kin.12; use '.exe' if os.name == 'nt' else ''.
  • src/kindex/setup.py:1472 — Reimplements _find_kin_path; use shlex.join([*_kin_command_parts(_find_kin_path()), 'merge-kin']) so the two cannot drift.
  • tests/test_scheduling.py:424 — Redundant inner import; platform_io is already imported at module top.
  • CHANGELOG [Unreleased] has no entry for Windows support or the two cross-platform behavior changes (merge-driver quoting, CLI errors='replace').

Reviewed 23490c5...98254f6 · ↻ Re-run review · View in Adapt

Annotations

Check warning on line 236 in tests/test_platform_io.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

tests/test_platform_io.py#L236

Patching os.name to 'nt' makes pathlib build WindowsPath, which cannot be instantiated on POSIX: six tests here fail on Linux 3.12; gate Windows branches on a patchable module flag instead.

Check warning on line 52 in src/kindex/platform_io.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/platform_io.py#L52

Top-level `import subprocess` reaches config.py's import chain; test_budget_concurrency fakes msvcrt so subprocess imports _winapi and fails on Linux. Import subprocess lazily in kill_tree.

Check warning on line 1541 in src/kindex/config.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/config.py#L1541

os.fchmod does not exist on Windows before Python 3.13 (requires-python >=3.10); it raises after the ledger was moved aside, leaving it stranded. Guard with hasattr like store.py.

Check warning on line 1514 in src/kindex/config.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/config.py#L1514

Any failure after the move-aside leaves entries only in .capping, invisible to readers until the ledger regrows past the cap; restore aside to path on the error path.

Check warning on line 68 in src/kindex/platform_io.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/platform_io.py#L68

Refusing every reparse point also refuses OneDrive/cloud placeholder files; restrict to st_reparse_tag symlink and mount-point tags.

Check warning on line 62 in src/kindex/platform_io.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/platform_io.py#L62

__all__ omits shell_can_run, which sim.py and supervisor.py call; add it.

Check warning on line 365 in tests/test_mcp_lite.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

tests/test_mcp_lite.py#L365

ipaddress.ip_address raises ValueError for a hostname before forbidden() records the attempt, so a swallowed hostname connect now passes; catch ValueError and treat as forbidden.

Check warning on line 446 in tests/test_graph_transfer.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

tests/test_graph_transfer.py#L446

Path(sys.executable).suffix is '.12' for /usr/bin/python3.12, so the test looks for kin.12; use '.exe' if os.name == 'nt' else ''.

Check warning on line 1472 in src/kindex/setup.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

src/kindex/setup.py#L1472

Reimplements _find_kin_path; use shlex.join([*_kin_command_parts(_find_kin_path()), 'merge-kin']) so the two cannot drift.

Check warning on line 424 in tests/test_scheduling.py

See this annotation in the file changed.

@adaptcom adaptcom / Adapt Review

tests/test_scheduling.py#L424

Redundant inner import; platform_io is already imported at module top.