fix(desktop): probe py -3.12 launcher as fallback in _known_good_python() - #5864
Conversation
…on() (#5859) When Python 3.12 is installed system-wide (not at the per-user LOCALAPPDATA path that _winget_install_python writes), the existing code returned None immediately — causing the interpreter retry to abort and bootstrap_python_version to stay at "3.11", which is exactly what repeated field-failure telemetry showed. The py launcher with an explicit version pin (`py -3.12`) finds Python 3.12 wherever it lives without risking the "newest interpreter" trap that bare `py` poses. Closes #5859 Co-Authored-By: ClawMetry Autofix Bot <bot-autofix@clawmetry.dev> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QngcJH4PkF4SgSdHs1UoV8
|
E2E Gate failure — not this PR's code. The gate timed out after 3600 s because Every check that actually ran before the cancellation passed:
The cancelled checks (MOAT Keystone, pip install matrix, API Tests, E2E Browser, MOAT Verifier, Entitlement API, Store invariants, Wheel install) need a fresh run against this commit. Re-running now. Generated by Claude Code |
|
…ood_python() Blueprint 'Desktop Application Distribution' requires _known_good_python() to work "by path, never by re-probing" and to avoid any py launcher usage. The previous fallback (py -3.12) violated this constraint as flagged by Drift Bot. Replace the py-launcher fallback with a Windows Registry lookup: python.org's installer writes the exact install path under SOFTWARE\Python\PythonCore\<minor>\InstallPath in both HKCU (per-user) and HKLM (system-wide), giving a direct filesystem path with no launcher or re-probing involved. Tests updated to mock winreg (injected into sys.modules) rather than shutil.which/py, and renamed to match the new mechanism: - test_known_good_python_falls_back_to_registry_for_system_install - test_known_good_python_returns_none_when_no_candidates Closes #5859 Co-Authored-By: ClawMetry Autofix Bot <bot-autofix@clawmetry.dev> Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QngcJH4PkF4SgSdHs1UoV8
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
Two test functions in test_desktop_bootstrap_resilience.py were renamed (py-launcher variants → registry variants) in the previous commit. The ratchet script detected the improvement (unlisted: 930 vs 931) and requires the baseline to be updated. Run: python3 scripts/check_ci_test_coverage.py --update-baseline Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QngcJH4PkF4SgSdHs1UoV8
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
|
This branch has a merge conflict with The PR touches
Once pushed, CI will re-run automatically. Generated by Claude Code |
Take main's updated baseline (total=1143, listed=213, unlisted_max=930); the branch modifies an existing test file, not adding new test files, so main's ratchet values are correct after the merge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012WV68rruvmF4vapEVEzoZY
✅ Drift Bot (ClawMetry): no drift detectedDrift Bot analyzed the changed files against this project's blueprints and requirements and found no drift. |
Summary
Fixes the recurring
no_distributionWindows field failure (issue #5859) where_known_good_python()only checked one hardcoded per-userLOCALAPPDATApath for Python 3.12, returningNoneimmediately for system-wide installs — leavingbootstrap_python_versionstuck at"3.11"across multiple consecutive days of telemetry.Root cause:
_known_good_python()probed exactly one path (%LOCALAPPDATA%\Programs\Python\Python312\python.exe). When Python 3.12 was installed system-wide (or via a corporate IT policy, or the user's own python.org installer in all-users mode), the path didn't exist, the function returnedNone, and_retry_on_known_good_python()aborted without a retry interpreter.Fix: After the per-user path check, fall through to
py -3.12. The py launcher with an explicit minor version pin finds Python 3.12 wherever it lives — per-user, system-wide, or another path — without risking the "newest interpreter" trap that barepyposes (barepywould return Python 3.14, the very interpreter whose wheels are missing).Changes
desktop/app.py: Extended_known_good_python()with ashutil.which("py")+py -3.12fallback (per-user path is tried first; fallback runs only when that path is absent or fails the probe).tests/test_desktop_bootstrap_resilience.py: Added two new tests:test_known_good_python_falls_back_to_py_launcher_for_system_install— asserts that a system-wide Python 3.12 (not at the LOCALAPPDATA path) is found viapy -3.12.test_known_good_python_skips_py_launcher_when_absent— asserts that whenpyis not on PATH, no subprocess is spawned andNoneis returned cleanly.Test plan
pytest tests/test_desktop_bootstrap_resilience.py— 65 passed (includes 2 new tests)%LOCALAPPDATA%) — bootstrap should succeed and reportbootstrap_python = 3.12Closes #5859
No-PRD: field-failure hotfix — directly traceable to auto-filed telemetry issue with a single, narrow code path change.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QngcJH4PkF4SgSdHs1UoV8
Generated by Claude Code