Skip to content

air: Skip purged runs in air list --all-status - #7517

Closed
abdulkareem-db wants to merge 2 commits into
databricks:mainfrom
abdulkareem-db:air-list-skip-purged-runs
Closed

abdulkareem-db wants to merge 2 commits into
databricks:mainfrom
abdulkareem-db:air-list-skip-purged-runs

Conversation

@abdulkareem-db

@abdulkareem-db abdulkareem-db commented Nov 11, 2026 •

Copy link
Copy Markdown

Changes

databricks air list --all-status no longer fails when one of the listed runs has been purged. hydrateJobRuns now drops runs whose runs/get call returns apierr.ErrResourceDoesNotExist, alongside the existing 403/404 handling, and returns the per-run error without wrapping it a second time.

Why

runs/get reports a purged run as 400 INVALID_PARAMETER_VALUE "Run does not exist." rather than 404, so hydrateJobRuns treated it as a systemic error and the errgroup failed the whole listing:

$ databricks air list --all-status
Error: failed to get run <id>: failed to get run <id>: Run <id> does not exist.

The Go SDK already maps that response (scoped to GET /api/2.x/jobs/runs/get) to ErrResourceDoesNotExist, so matching the sentinel avoids string-matching the message. Other errors (5xx, other INVALID_PARAMETER_VALUE responses, auth) still fail the batch. The doubled "failed to get run" prefix came from wrapping in both fetchJobRun and hydrateJobRuns; the outer wrap is removed.

Tracked internally as CNXT-2565.

Tests

  • New unit tests in cmd/air/joblist_test.go against an httptest server (so the SDK's error mapping is exercised): purged (400 "does not exist"), 403 and 404 runs are dropped and the rest keep their order; a 500 and an unrelated 400 still fail with a single failed to get run N: prefix. Both tests fail on the previous code.
  • go test ./cmd/air/... and go test ./acceptance -run TestAccept/air/list pass.
  • Manually: with a purged run in the user's history, the released CLI fails as above; this build lists all remaining runs and exits 0.

This pull request and its description were written by Isaac.

runs/get reports a purged run as 400 INVALID_PARAMETER_VALUE "Run <id>
does not exist.", which the SDK maps to ErrResourceDoesNotExist.
hydrateJobRuns only dropped 403/404, so one purged run failed the whole
listing. Drop ErrResourceDoesNotExist too, and stop wrapping the error a
second time ("failed to get run X: failed to get run X: ...").

Fixes CNXT-2565.

Co-authored-by: Isaac <no-reply@databricks.com>
@abdulkareem-db
abdulkareem-db requested review from a team as code owners November 11, 2026 22:21
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution! This pull request was opened from a fork.

If you're a member of the Databricks organization, please request access to the cli-contrib team and open your pull request from a branch in this repository instead of a fork — fork PRs don't run integration tests automatically and have reduced CI access.

If you're an external contributor, no action is needed; a maintainer will review your pull request.

@github-actions github-actions Bot added the AIR Databricks AI Runtime CLI label Nov 11, 2026
Co-authored-by: Isaac <no-reply@databricks.com>
@abdulkareem-db
abdulkareem-db force-pushed the air-list-skip-purged-runs branch from eea15ed to d939850 Compare November 11, 2026 22:23
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 7517
  • Commit SHA: d939850e725cb2555b809a126adc647db15207a7

Checks will be approved automatically on success.

@caroline-db caroline-db 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.

code change lgtm but please open a new PR directly without going through a fork

@abdulkareem-db

Copy link
Copy Markdown
Author

Superseded by #7523, reopened from a branch in this repository so CI can run (fork PRs can't get the OIDC token for the package proxy).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AIR Databricks AI Runtime CLI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants