fix: skip marker-constrained uninstalled packages in Python requirements#459
Conversation
Review Summary by QodoSkip marker-constrained uninstalled packages in Python requirements
WalkthroughsDescription• Skip PEP 508 marker-constrained uninstalled packages in Python requirements • Detect environment markers using tree-sitter marker_spec nodes • Check installed packages cache before processing requirements • Add comprehensive test suite for marker handling with mocked pip output Diagramflowchart LR
A["requirements.txt with markers"] -->|tree-sitter parse| B["Detect marker_spec nodes"]
B -->|hasMarker flag| C["Check pip freeze cache"]
C -->|marker + not installed| D["Skip package"]
C -->|marker + installed| E["Include in SBOM"]
C -->|no marker| E
File Changes1. src/providers/python_controller.js
|
Code Review by Qodo
|
Verification Report for TC-4043 (commit fb7d0e3)
Overall: PASSAll checks pass. The one review comment from qodo-code-review[bot] suggests evaluating markers locally rather than trusting pip's installed-package cache, but this contradicts the explicit design decision in the task spec and parent feature TC-4042 which uses "pip's behavior as the source of truth." The Test Quality WARN is advisory only — the minor findings are in pre-existing code, not the PR's additions. This comment was AI-generated by sdlc-workflow/verify-pr v0.6.1. |
When a requirements.txt contains packages with PEP 508 environment markers (e.g., `pywin32==306 ; platform_system == "Windows"`), pip only installs packages whose markers match the current platform. Previously, the JavaScript client scanned ALL packages from the manifest regardless of markers, throwing an error when a marker- constrained package was not installed. This fix uses tree-sitter to detect `marker_spec` nodes on each requirement and skips packages that have a marker but are absent from the installed packages cache (`pip freeze`). Packages with markers that ARE installed are still included in the SBOM. Implements TC-4043 Assisted-by: Claude Code Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Transitive dependencies (idna, charset-normalizer, urllib3, certifi, pysocks) were resolved live from PyPI, causing test failures when new versions are published (e.g. idna 3.11 -> 3.12). Pin all deps with == in the test pyproject.toml, matching the lock file approach used by uv and poetry tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
pywin32==306 ; platform_system == "Windows") that are not installed because the marker didn't match are now silently skipped instead of throwing an errorDetails
Uses tree-sitter
marker_specnode detection in#parseRequirements()and checks against the installed packages cache (pip freeze) before processing each requirement. The fix follows the same decision logic as pip itself: if a package has a marker and pip didn't install it, skip it.Implements TC-4043
Test plan
pip freeze/pip showoutput🤖 Generated with Claude Code