Skip to content

feat: show cockpit run artifacts#2017

Merged
yottahmd merged 4 commits intomainfrom
feat-cockpit-artifacts
Apr 20, 2026
Merged

feat: show cockpit run artifacts#2017
yottahmd merged 4 commits intomainfrom
feat-cockpit-artifacts

Conversation

@yottahmd
Copy link
Copy Markdown
Collaborator

@yottahmd yottahmd commented Apr 19, 2026

Summary

  • add artifact availability to DAG-run summaries so cockpit cards can render artifact affordances
  • add a cockpit artifact icon that opens a modal with recursive artifact listing, refresh, and download actions
  • cover the card click isolation, modal loading, and updated summary fixtures in tests

Testing

  • make api
  • pnpm gen:api
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • pnpm exec eslint src/features/cockpit/components/ArtifactListModal.tsx src/features/cockpit/components/KanbanCard.tsx src/features/cockpit/components/KanbanColumn.tsx src/features/cockpit/components/KanbanBoard.tsx src/features/cockpit/components/MobileKanbanBoard.tsx src/features/cockpit/components/DateKanbanSection.tsx src/features/cockpit/components/DateKanbanList.tsx src/features/cockpit/components/tests/ArtifactListModal.test.tsx src/features/cockpit/components/tests/KanbanCard.test.tsx src/features/cockpit/components/tests/KanbanCounts.test.tsx src/features/cockpit/components/tests/DateKanbanSection.test.tsx src/features/cockpit/components/tests/DateKanbanList.test.tsx
  • make api-validate
  • make bin
  • go test ./internal/service/frontend/api/v1

Summary by CodeRabbit

  • New Features

    • Added artifact viewing and downloading capabilities to DAG runs. Users can now view a run's artifact directory structure and download individual files through a dedicated modal interface.
    • Artifacts are now indicated as available or unavailable in run summaries.
  • Tests

    • Updated test fixtures and added new test coverage for artifact functionality.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 19, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e16001e1-46d7-4573-b74e-81c0bc2cd285

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The PR extends the DAG run API to include artifact availability tracking. The backend now sets an ArtifactsAvailable flag based on whether an archive directory exists for a run. The UI integrates a new modal component for browsing and downloading artifacts, wired through the Kanban board component hierarchy.

Changes

Cohort / File(s) Summary
API Schema & Generated Code
api/v1/api.yaml, api/v1/api.gen.go, ui/src/api/v1/schema.ts
Added artifactsAvailable: boolean field to DAGRunSummary and removed duplicate definition from DAGRunDetails (now inherited). Regenerated Go API code and TypeScript schema types.
Backend Transformation Logic
internal/service/frontend/api/v1/transformer.go, internal/service/frontend/api/v1/transformer_test.go
Updated toDAGRunSummary() to set ArtifactsAvailable = true when ArchiveDir is present. Extended test to verify the new field is populated correctly.
New Artifact Modal Component
ui/src/features/cockpit/components/ArtifactListModal.tsx, ui/src/features/cockpit/components/__tests__/ArtifactListModal.test.tsx
Introduced new modal component that renders artifact directory trees, manages loading/error states, handles recursive artifact fetching, and implements blob-based file downloads with filename parsing from Content-Disposition headers. Added comprehensive test coverage.
Kanban Board Component Integration
ui/src/features/cockpit/components/DateKanbanList.tsx, ui/src/features/cockpit/components/DateKanbanSection.tsx, ui/src/features/cockpit/components/KanbanBoard.tsx, ui/src/features/cockpit/components/KanbanColumn.tsx, ui/src/features/cockpit/components/MobileKanbanBoard.tsx
Propagated new onArtifactsClick callback prop through component hierarchy. Integrated modal invocation in DateKanbanList with state management for selected run.
Kanban Card Enhancement
ui/src/features/cockpit/components/KanbanCard.tsx
Added optional onArtifactsClick callback prop. Implemented conditional "View artifacts" icon button when run.artifactsAvailable is true. Converted top-level button to accessible div with keyboard handling.
Test Infrastructure Updates
ui/src/features/cockpit/components/__tests__/DateKanbanList.test.tsx, ui/src/features/cockpit/components/__tests__/DateKanbanSection.test.tsx, ui/src/features/cockpit/components/__tests__/KanbanCard.test.tsx, ui/src/features/cockpit/components/__tests__/KanbanCounts.test.tsx, ui/src/features/dag-runs/components/common/__tests__/DAGRunActions.test.tsx, ui/src/features/dag-runs/components/dag-run-list/__tests__/..., ui/src/features/dag-runs/hooks/__tests__/useBulkDAGRunSelection.test.tsx, ui/src/features/dags/components/common/__tests__/DAGActions.test.tsx
Added artifactsAvailable: false to test fixtures and mocked DAG run objects across multiple test suites. Updated framer-motion mock to filter animation props. Added new test for artifact button click behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'feat: show cockpit run artifacts' directly and clearly summarizes the main change: adding artifact display functionality to the cockpit UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat-cockpit-artifacts

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.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
internal/service/frontend/api/v1/transformer_test.go (1)

23-34: Consider adding a negative-case assertion for ArtifactsAvailable.

The current test only validates the true branch (non-empty ArchiveDir). A symmetric assertion for a run with empty ArchiveDir (e.g., in TestToDAGRunSummaryOmitsAutoRetryLimitWhenUnconfigured or a new dedicated test) would lock in the false branch and guard against regressions in the mapping.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@internal/service/frontend/api/v1/transformer_test.go` around lines 23 - 34,
Add a negative-case assertion that verifies ArtifactsAvailable is false when
ArchiveDir is empty by calling toDAGRunSummary with a status that has ArchiveDir
set to "" (e.g., in TestToDAGRunSummaryOmitsAutoRetryLimitWhenUnconfigured or a
new test in transformer_test.go), assert that summary.ArtifactsAvailable is
false, and ensure you still validate other relevant fields (ScheduleTime,
AutoRetryCount/Limit) so the test covers both true and false branches of
toDAGRunSummary's artifact availability mapping.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/service/frontend/api/v1/transformer.go`:
- Around line 194-212: The ArtifactsAvailable boolean is currently set from
s.ArchiveDir != "" (a configuration flag set at enqueue time) which
misrepresents actual artifact presence; change the mapping in the DAG run
transformers to reflect configuration semantics instead of availability: replace
ArtifactsAvailable with a clearly named field (e.g. ArtifactsEnabled or
ArchiveDirConfigured) in the api.DAGRunSummary and in ToDAGRunDetails, and set
it to (s.ArchiveDir != ""); update the API type references and any callers/UI
usage to check the new name (or, if you prefer the current name, instead compute
it strictly by checking terminal status via s.Status.IsFinished() and doing a
cheap os.Stat/non-empty-dir check before setting ArtifactsAvailable in
toDAGRunsPageResponse and ToDAGRunDetails—choose one approach and apply it
consistently).

In `@ui/src/features/cockpit/components/ArtifactListModal.tsx`:
- Around line 246-294: handleDownload has multiple robustness issues: ensure the
download request is cancellable and guarded, check for empty responses, and use
a DOM-appended anchor with deferred revoke. Specifically, create an
AbortController (reusing the component's cancel pattern or new controller) and
pass its signal to client.GET so the request can be aborted; guard
setDownloadingPath/setDownloadError calls with a mounted/cancelled flag before
updating state; after verifying request.error is falsy, assert request.data
(blob) exists and throw a clear Error('Empty response') if not; append the
created <a> to document.body before link.click() and call
URL.revokeObjectURL(objectUrl) inside a setTimeout(..., 0) (or after a short
delay) to avoid revoking while the download starts; optionally improve
Content-Disposition parsing in handleDownload to handle unquoted filename and
RFC5987 filename* forms before falling back to node.name.
- Around line 180-244: The effect currently sets setIsLoading(true) on every
refresh, which hides stale artifacts; change it to only show the full-page
loading state on the initial load by computing const isInitialLoad =
(tree.length === 0) at the top of the effect and call
setIsLoading(isInitialLoad) instead of always true inside fetchTree, and in the
finally block only call setIsLoading(false) when !cancelled && isInitialLoad;
also add tree to the effect dependency array so the effect sees the current tree
length. Update references in fetchTree/finally accordingly (functions:
fetchTree, setIsLoading, setTree).

In `@ui/src/features/cockpit/components/KanbanCard.tsx`:
- Around line 86-115: The outer interactive wrapper (the <div role="button">
handled by onClick and handleKeyDown in KanbanCard) contains a nested <button>
(the artifacts button rendered when showArtifacts and invoking
onArtifactsClick), which violates ARIA; move the artifacts control out of the
role="button" wrapper so it is not an interactive descendant—either render the
artifacts button as a positioned sibling (e.g., absolutely positioned inside the
card container but outside the clickable div) or change the outer wrapper to a
native <button> and redesign layout so the artifacts control is not nested;
update the layout CSS and keep onClick/handleKeyDown behavior on the card
wrapper while removing the need for event.stopPropagation on the artifacts
button and ensure keyboard focus order and aria-label (aria-label={`View
artifacts for ${run.name}`}) remain correct.

---

Nitpick comments:
In `@internal/service/frontend/api/v1/transformer_test.go`:
- Around line 23-34: Add a negative-case assertion that verifies
ArtifactsAvailable is false when ArchiveDir is empty by calling toDAGRunSummary
with a status that has ArchiveDir set to "" (e.g., in
TestToDAGRunSummaryOmitsAutoRetryLimitWhenUnconfigured or a new test in
transformer_test.go), assert that summary.ArtifactsAvailable is false, and
ensure you still validate other relevant fields (ScheduleTime,
AutoRetryCount/Limit) so the test covers both true and false branches of
toDAGRunSummary's artifact availability mapping.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cc47adc8-6110-42be-bb12-b74da46806b8

📥 Commits

Reviewing files that changed from the base of the PR and between 93bbbc8 and e23f812.

📒 Files selected for processing (22)
  • api/v1/api.gen.go
  • api/v1/api.yaml
  • internal/service/frontend/api/v1/transformer.go
  • internal/service/frontend/api/v1/transformer_test.go
  • ui/src/api/v1/schema.ts
  • ui/src/features/cockpit/components/ArtifactListModal.tsx
  • ui/src/features/cockpit/components/DateKanbanList.tsx
  • ui/src/features/cockpit/components/DateKanbanSection.tsx
  • ui/src/features/cockpit/components/KanbanBoard.tsx
  • ui/src/features/cockpit/components/KanbanCard.tsx
  • ui/src/features/cockpit/components/KanbanColumn.tsx
  • ui/src/features/cockpit/components/MobileKanbanBoard.tsx
  • ui/src/features/cockpit/components/__tests__/ArtifactListModal.test.tsx
  • ui/src/features/cockpit/components/__tests__/DateKanbanList.test.tsx
  • ui/src/features/cockpit/components/__tests__/DateKanbanSection.test.tsx
  • ui/src/features/cockpit/components/__tests__/KanbanCard.test.tsx
  • ui/src/features/cockpit/components/__tests__/KanbanCounts.test.tsx
  • ui/src/features/dag-runs/components/common/__tests__/DAGRunActions.test.tsx
  • ui/src/features/dag-runs/components/dag-run-list/__tests__/DAGRunGroupedView.test.tsx
  • ui/src/features/dag-runs/components/dag-run-list/__tests__/DAGRunTable.test.tsx
  • ui/src/features/dag-runs/hooks/__tests__/useBulkDAGRunSelection.test.tsx
  • ui/src/features/dags/components/common/__tests__/DAGActions.test.tsx

Comment thread internal/service/frontend/api/v1/transformer.go
Comment thread ui/src/features/cockpit/components/ArtifactListModal.tsx Outdated
Comment thread ui/src/features/cockpit/components/ArtifactListModal.tsx Outdated
Comment thread ui/src/features/cockpit/components/KanbanCard.tsx Outdated
@yottahmd yottahmd merged commit a727f8b into main Apr 20, 2026
11 checks passed
@yottahmd yottahmd deleted the feat-cockpit-artifacts branch April 20, 2026 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant