fix(auditor): add aggregated auditor artifacts endpoint - #1190
Conversation
9663c74 to
44f1126
Compare
|
Caution CodeRabbit couldn't update its existing comment. The review summary may be out of date. Error details |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@plugins/nemo-auditor/openapi/openapi.yaml`:
- Around line 337-347: Update the response definition near the existing 200
response to document the archive as application/gzip with a binary schema
instead of application/json, and add the endpoint’s 404 no-artifacts response
while preserving the existing 422 validation response. Regenerate the OpenAPI
specification using the project’s documented refresh command so the generated
file remains synchronized with the API definitions.
In `@plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py`:
- Around line 76-80: Move the blocking archive creation currently inside the
async artifact route into a worker thread, including tarfile.open and each
tar.add operation. Keep the existing tar_path and artifact_tmps inputs and
ensure the route awaits the offloaded operation without performing synchronous
disk I/O on the event loop.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: dd8fca0f-d799-44c1-8400-b9fde3f06322
📒 Files selected for processing (5)
plugins/nemo-auditor/openapi/openapi.yamlplugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.pyplugins/nemo-auditor/src/nemo_auditor/jobs/audit.pyplugins/nemo-auditor/src/nemo_auditor/service.pyplugins/nemo-auditor/tests/test_api_artifacts.py
💤 Files with no reviewable changes (1)
- plugins/nemo-auditor/src/nemo_auditor/jobs/audit.py
|
Caution CodeRabbit couldn't update its existing comment. The review summary may be out of date. Error details |
|
/nvskills-ci |
📝 WalkthroughWalkthroughThe PR adds a workspace-scoped endpoint that retrieves available audit report artifacts, packages them into a gzip-compressed tar archive, streams the archive, and removes temporary files. OpenAPI documentation and endpoint tests are included. ChangesAuditor artifact download
Sequence Diagram(s)sequenceDiagram
participant Client
participant AuditorRouter
participant download_audit_artifacts
participant AsyncNeMoPlatform
participant ResultManager
Client->>AuditorRouter: Request workspace/job artifact archive
AuditorRouter->>download_audit_artifacts: Route request
download_audit_artifacts->>AsyncNeMoPlatform: Query configured audit results
AsyncNeMoPlatform-->>download_audit_artifacts: Result metadata
download_audit_artifacts->>ResultManager: Download available artifacts
ResultManager-->>download_audit_artifacts: Artifact files
download_audit_artifacts-->>Client: Stream artifacts.tar.gz or return 404
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
/nvskills-ci |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py (1)
96-107: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftGuarantee temporary-directory cleanup on cancellation and failed sends.
except Exceptiondoes not catch cancellation on supported Python versions. Starlette 1.3.1 runs background tasks only afterFileResponsecompletes allsendcalls. A cancellation or failed send can therefore leave temporary directories allocated. Use one idempotent cleanup path in a response/streamfinallyblock, and add tests for cancellation and interrupted sends.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py` around lines 96 - 107, Update the artifact response flow surrounding _cleanup and FileResponse so temporary directories are released from a single idempotent cleanup path in a response/stream finally block, including cancellation and failed sends that bypass except Exception. Preserve successful-response cleanup and ensure cleanup cannot run destructively more than once; add coverage for cancellation and interrupted sends.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py`:
- Around line 96-107: Update the artifact response flow surrounding _cleanup and
FileResponse so temporary directories are released from a single idempotent
cleanup path in a response/stream finally block, including cancellation and
failed sends that bypass except Exception. Preserve successful-response cleanup
and ensure cleanup cannot run destructively more than once; add coverage for
cancellation and interrupted sends.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 454799c7-1234-41b6-850a-dbcc7bbfb94c
📒 Files selected for processing (1)
plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py
|
|
/nvskills-ci |
Signed-off-by: Paul A. Parkanzky <parkanzky@users.noreply.github.com>
Signed-off-by: Paul A. Parkanzky <parkanzky@users.noreply.github.com>
Signed-off-by: Paul A. Parkanzky <parkanzky@users.noreply.github.com>
75a0974 to
ed601ea
Compare
Summary
Connect the auditor artifacts download endpoint to tarball.
Type of Change
Quality Gates
Verification
Signed-off-by:traileruv run pre-commit run -apasses, or any blocked checks are identified belowSummary by CodeRabbit
New Features
.tar.gzarchive.404response when no artifacts are available.Documentation