fix(cli): re-exec the hash seed pin as a module, not by replaying argv[0] - #3780
Closed
ayushcodes10 wants to merge 3 commits into
Closed
ayushcodes10 wants to merge 3 commits into
ayushcodes10 wants to merge 3 commits into
Conversation
The previous form replayed sys.argv[0] as the script path to run, which happens to work for a POSIX console script wrapper or a python dash m invocation, both of which are real, runnable Python content. It does not work for a uv, pip, or pipx console script launcher on Windows, which installs as a native executable stub with no such content, so the interpreter has nothing to open and every affected command failed outright the moment it tried to pin the seed. Re execing through the module flag instead never depends on argv[0] being anything runnable at all, so a launcher stub that is not even a real file no longer matters, and this now matches the exact invocation shape the end to end test for this function already exercised and proved working. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
The existing probe assertions now expect the module flag form. A new test drives the probe with a launcher stub path that is not even a real file in place of argv zero, confirming the fix no longer depends on it being anything runnable, the exact shape of the Windows uv launcher regression this closes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh
Member
|
Shipped in v0.9.67 (on PyPI). Cherry-picked with authorship preserved. Thanks @ayushcodes10! This fixes the Windows regression the 0.9.66 hash-seed pin introduced — the |
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.
Fixes #3779 — a regression in my own #3743 (issue #3641), reported within a day of the 0.9.66 release shipping. Sorry about that.
_pin_hash_seed_if_neededre-execs like this:This replays
sys.argv[0]as the script path for the interpreter to run. That works for a POSIX console-script wrapper or apython -m graphifyinvocation — both real, runnable Python content — but not for a uv/pip/pipx console-script launcher on Windows, which installs as a native.exestub with no such content. The interpreter has nothing to open, and every command this function touches (update/extract/cluster-only/label) failed outright withcan't open filethe moment it tried to pin the seed.Fix (the issue's own suggestion, which is correct and minimal): re-exec via
-m graphifyinstead, which never depends onargv[0]being anything runnable at all:This also now matches the exact invocation shape the existing end-to-end test for this function (
test_update_still_runs_end_to_end_with_hashseed_unset) was already exercising.Verified the failure mode empirically before touching anything — simulated a non-Python launcher stub path as
argv[0]and confirmed it broke pre-fix (can't open file) and is fixed post-fix. Updated the existing probe assertions to the new argv shape and added a dedicated regression test that drives the probe with a launcher stub path that isn't even a real file, confirming the fix no longer depends on it being runnable — the exact shape of the Windows uv-launcher scenario. Full suite is green aside from 16 pre-existing failures in the newly-added Erlang/R/Solidity/VB.NET extractor tests, caused by their optional grammar packages not being installed in my dev environment — unrelated to this change (confirmed viapython -c "import tree_sitter_r"etc. all failing withModuleNotFoundError, and confirmed these packages weren't needed by any branch cut before the 0.9.66 release landed).🤖 Generated with Claude Code
https://claude.ai/code/session_017qfdzgbA5KedGEjD1AayNh