Skip to content

fix(auditor): add aggregated auditor artifacts endpoint - #1190

Merged
parkanzky merged 3 commits into
mainfrom
nvbug6562262-agg-artifacts
Aug 7, 2026
Merged

fix(auditor): add aggregated auditor artifacts endpoint#1190
parkanzky merged 3 commits into
mainfrom
nvbug6562262-agg-artifacts

Conversation

@parkanzky

@parkanzky parkanzky commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Connect the auditor artifacts download endpoint to tarball.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with documentation updates
  • Documentation only
  • Contributor tooling or automation
  • CI, build, or test infrastructure

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Documentation updated for user-visible behavior
  • Documentation not applicable — justification: QA found that the documentation covered this phantom functionality, so it already exists.

Verification

  • Pull request title follows the repository's Conventional Commit format
  • Every commit includes an appropriate Signed-off-by: trailer
  • uv run pre-commit run -a passes, or any blocked checks are identified below
  • Targeted tests pass, or tests are marked not applicable above
  • No secrets, API keys, or credentials are included

Summary by CodeRabbit

  • New Features

    • Added an authorized endpoint to download available audit report artifacts as a single .tar.gz archive.
    • Artifacts are included in the configured result order.
    • Missing optional artifacts are skipped automatically.
    • Returns a clear 404 response when no artifacts are available.
  • Documentation

    • Documented the download endpoint, required parameters, response format, and validation errors.

@parkanzky
parkanzky requested review from a team as code owners August 7, 2026 21:55
@github-actions github-actions Bot added the fix label Aug 7, 2026
@parkanzky
parkanzky force-pushed the nvbug6562262-agg-artifacts branch from 9663c74 to 44f1126 Compare August 7, 2026 21:55
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from coderabbitai Bot Aug 7, 2026
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Caution

CodeRabbit couldn't update its existing comment. The review summary may be out of date.

Error details
Not Found - https://docs.github.com/rest/issues/comments#update-an-issue-comment

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between e32287b and 44f1126.

📒 Files selected for processing (5)
  • plugins/nemo-auditor/openapi/openapi.yaml
  • plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py
  • plugins/nemo-auditor/src/nemo_auditor/jobs/audit.py
  • plugins/nemo-auditor/src/nemo_auditor/service.py
  • plugins/nemo-auditor/tests/test_api_artifacts.py
💤 Files with no reviewable changes (1)
  • plugins/nemo-auditor/src/nemo_auditor/jobs/audit.py

Comment thread plugins/nemo-auditor/openapi/openapi.yaml
Comment thread plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Caution

CodeRabbit couldn't update its existing comment. The review summary may be out of date.

Error details
Not Found - https://docs.github.com/rest/issues/comments#update-an-issue-comment

@parkanzky

Copy link
Copy Markdown
Contributor Author

/nvskills-ci

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Auditor artifact download

Layer / File(s) Summary
Route contract and registration
plugins/nemo-auditor/openapi/openapi.yaml, plugins/nemo-auditor/src/nemo_auditor/service.py
The API contract and workspace-scoped router expose the aggregate artifact download endpoint.
Artifact retrieval and archive streaming
plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py, plugins/nemo-auditor/tests/test_api_artifacts.py, plugins/nemo-auditor/src/nemo_auditor/jobs/audit.py
The authorized endpoint queries ordered audit results, skips missing artifacts, creates artifacts.tar.gz, returns 404 when no artifacts exist, streams the archive, and cleans temporary files. Tests cover these behaviors and route precedence. The audit job file also removes an empty line.

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
Loading

Possibly related PRs

Suggested labels: test

Suggested reviewers: mmogallapalli

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the auditor artifact aggregation endpoint added by this pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch nvbug6562262-agg-artifacts

Comment @coderabbitai help to get the list of available commands.

@parkanzky
parkanzky requested a review from ironcommit August 7, 2026 22:11

@ironcommit ironcommit left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@parkanzky

Copy link
Copy Markdown
Contributor Author

/nvskills-ci

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 lift

Guarantee temporary-directory cleanup on cancellation and failed sends.

except Exception does not catch cancellation on supported Python versions. Starlette 1.3.1 runs background tasks only after FileResponse completes all send calls. A cancellation or failed send can therefore leave temporary directories allocated. Use one idempotent cleanup path in a response/stream finally block, 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

📥 Commits

Reviewing files that changed from the base of the PR and between 28f0e98 and 53b0743.

📒 Files selected for processing (1)
  • plugins/nemo-auditor/src/nemo_auditor/api/v2/artifacts.py

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 31701/40325 78.6% 63.3%
Integration Tests 18434/38256 48.2% 20.9%

@parkanzky

Copy link
Copy Markdown
Contributor Author

/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>
@parkanzky
parkanzky force-pushed the nvbug6562262-agg-artifacts branch from 75a0974 to ed601ea Compare August 7, 2026 22:56
@parkanzky
parkanzky enabled auto-merge August 7, 2026 22:57
@parkanzky
parkanzky added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 95eb8c5 Aug 7, 2026
54 checks passed
@parkanzky
parkanzky deleted the nvbug6562262-agg-artifacts branch August 7, 2026 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants