fix: include streamed artifacts in SBOM output for --stream scans#672
fix: include streamed artifacts in SBOM output for --stream scans#672mldangelo merged 3 commits intopromptfoo:mainfrom
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughAdds a nested helper Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@modelaudit/cli.py`:
- Around line 955-965: The helper _track_streaming_paths_for_sbom collects
streamed artifact paths but is only used for HuggingFace/local-directory; update
the PyTorch Hub and cloud-storage code paths that call final_scan_and_delete (or
otherwise merge streaming_result) to also invoke
_track_streaming_paths_for_sbom(streaming_result, fallback_path) right after you
obtain the streaming_result and before finalizing/deleting, so scanned_paths is
populated for SBOM; ensure scanned_paths is in scope (or passed/returned) where
you add the call and keep the same fallback_path behavior.
In `@tests/test_cli.py`:
- Around line 781-783: The test function
test_scan_huggingface_streaming_sbom_contains_all_components is missing type
hints; update its signature to include a return type of -> None, annotate
tmp_path as tmp_path: Path, and type the mocked fixtures (e.g.,
mock_scan_streaming, mock_download_streaming, mock_is_hf_url) as Mock or Any
(from typing or unittest.mock) so the signature looks like: def
test_scan_huggingface_streaming_sbom_contains_all_components(mock_scan_streaming:
Mock, mock_download_streaming: Mock, mock_is_hf_url: Mock, tmp_path: Path) ->
None; ensure necessary imports (Path, Mock/Any) are present at the top of the
test file.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 3c6e1521-c6cd-4e91-87b2-bdd774910997
📒 Files selected for processing (2)
modelaudit/cli.pytests/test_cli.py
|
Thank you @Daketey! Please reach out if you'd like some promptfoo swag! |
|
@mldangelo Thanks for the Merge. Let me know the best way to reach out to you! |
email me at michael @ promptfoo.dev |
Summary
Fixed issue #671 where scan
--stream--sbomdid not include streamed model artifacts as SBOM components.User impact:
Before: streaming scans could emit an SBOM with only a top-level/source component.
After: streamed artifact paths are captured and included, so SBOM output correctly lists model files/components discovered during streaming.
Also added a test in
test_cli.pyto verify streamed assets appear in SBOM output, and fixed line-length formatting in that new test.Validation
uv run ruff format --check modelaudit/ tests/uv run ruff check modelaudit/ tests/uv run mypy modelaudit/uv run pytest -n auto -m "not slow and not integration" --maxfail=1Checklist
AGENTS.md.Summary by CodeRabbit
Bug Fixes
Tests