fix(embed): satisfy ty on Windows-only subprocess attrs#1263
Open
grimmjoww wants to merge 1 commit intovectorize-io:mainfrom
Open
fix(embed): satisfy ty on Windows-only subprocess attrs#1263grimmjoww wants to merge 1 commit intovectorize-io:mainfrom
grimmjoww wants to merge 1 commit intovectorize-io:mainfrom
Conversation
`subprocess.DETACHED_PROCESS` and `subprocess.CREATE_NEW_PROCESS_GROUP` are Windows-only constants. The existing code is already guarded by `if platform.system() == "Windows":`, but `ty`'s static analysis doesn't track platform-conditional branches, so it flags both attributes as `unresolved-attribute` on the Linux CI runner — failing `verify-generated-files`. Switching to `getattr(subprocess, "DETACHED_PROCESS", 0)` keeps the same runtime behavior on Windows (constant is present, returned as-is) and avoids the static-analysis false positive on Linux/macOS where the attribute access would never execute anyway. Same fix pattern documented in cpython subprocess docs and used widely in cross-platform Python codebases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
verify-generated-files(the `ty-embed` lint job) currently fails on `main` because `hindsight_embed/daemon_embed_manager.py:55` references `subprocess.DETACHED_PROCESS` and `subprocess.CREATE_NEW_PROCESS_GROUP` — both Windows-only constants.The code is already guarded with `if platform.system() == "Windows":` at line 53, so the attributes are never accessed on Linux/macOS at runtime. But `ty`'s static analysis doesn't track platform-conditional branches, so on the Linux CI runner it flags both as `unresolved-attribute` and the job fails.
Fix
Use `getattr(subprocess, "DETACHED_PROCESS", 0)` to avoid the static-analysis false positive while preserving identical runtime behavior on Windows. Same pattern documented in cpython subprocess docs and widely used in cross-platform Python codebases.
Why a separate PR
Spotted while debugging CI on #1258 (reindex-embeddings). That PR doesn't touch `hindsight_embed/` at all — its failing CI is the same unrelated pre-existing issue. Sending the lint fix as its own focused commit so:
After this lands, #1258's CI should go green on rebase.
Test plan
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com