Skip to content

[RAPTOR-19349] add offset to workload/artifact list - #784

Open
ScottOglesby wants to merge 1 commit into
datarobot-oss:mainfrom
ScottOglesby:scott/r-19349-dr-artifact-list
Open

[RAPTOR-19349] add offset to workload/artifact list#784
ScottOglesby wants to merge 1 commit into
datarobot-oss:mainfrom
ScottOglesby:scott/r-19349-dr-artifact-list

Conversation

@ScottOglesby

@ScottOglesby ScottOglesby commented Aug 18, 2026

Copy link
Copy Markdown

RATIONALE

Add --offset to the list commands for artifacts and workloads. --limit already exists, but not having --offset made listing items beyond the first page impossible.

CHANGES

  • Added --offset to the list commands for artifacts and workloads
  • added and updated tests

Testing

Ran task lint, task test

PR Automation

Comment-Commands: Trigger CI by commenting on the PR:

  • /trigger-smoke-test or /trigger-test-smoke - Run smoke tests
  • /trigger-install-test or /trigger-test-install - Run installation tests

Labels: Apply labels to trigger workflows:

  • run-smoke-tests or go - Run smoke tests on demand (only works for non-forked PRs)

Important

For Forked PRs: The run-smoke-tests label won't work. A required Smoke Tests check will block merge until a maintainer acts:

  • A maintainer uses /approve-smoke-tests to run smoke tests (results will set the check)
  • A maintainer uses /skip-smoke-tests to bypass the check without running tests

Please comment requesting a maintainer review if you need smoke tests to run.


Note

Low Risk
Backward-compatible CLI pagination wired to existing list APIs; default offset preserves prior behavior and changes are limited to list/query plumbing.

Overview
Adds --offset (default 0) to dr workload list and dr artifact list so users can skip past the first page of results alongside existing --limit.

The list commands validate that offset is non-negative, pass offset into ListWorkloads and ListArtifacts, and include it in telemetry. ListWorkloads also rejects negative offset before building the API query; artifact listing appends offset to the artifacts API URL. Internal callers that only need the first page (deploy name-conflict lookup, workload config wizard picker) now pass 0 for offset. Tests cover invalid --offset on both commands and updated ListWorkloads call signatures.

Reviewed by Cursor Bugbot for commit 1799239. Configure here.

@ScottOglesby
ScottOglesby requested review from a team as code owners August 18, 2026 00:05
@datarobot-pr-review-router

Copy link
Copy Markdown

🎫 Jira: RAPTOR-19349dr artifact list caps at 100 and never sends offset, so older artifacts are unreachable from the CLI

@datarobot-pr-review-router

Copy link
Copy Markdown

👋 Thanks so much for contributing to the DataRobot community!

As a quick heads-up on how our team handles reviews: if you're still iterating on
this code or running tests, please feel free to convert this to a Draft PR.
We rely heavily on GitHub Drafts to give contributors a stress-free sandbox to experiment!

Once everything is finalized and you're ready for feedback, just click "Ready for review"
and the maintainers will be notified to jump in. (And if this PR is already 100% ready
to go, no action needed, we'll take a look soon!)

@datarobot-pr-review-router

Copy link
Copy Markdown

Code Ownership

Cli Maintainers

  • cmd/artifact/list/cmd.go
  • cmd/artifact/list/cmd_test.go

Workload Cli

  • cmd/workload/list/cmd.go
  • cmd/workload/list/cmd_test.go
  • internal/workload/artifact.go
  • internal/workload/up/run.go
  • internal/workload/up/run_test.go
  • internal/workload/wizard/screens.go
  • internal/workload/workload.go
  • internal/workload/workload_test.go

Review requested from the teams above. Labels will be removed automatically upon approval.

@ajalon1

ajalon1 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

/approve-smoke-tests

@github-actions

Copy link
Copy Markdown
Contributor

🔐 Fork PR smoke tests triggered by @ajalon1

⚠️ Security Notice: This will run tests with access to repository secrets.

What happens next:

  1. Security scans will run automatically (Trivy, gosec)
  2. If security scans pass, smoke tests will run
  3. Results will be posted as PR comments

⚠️ Important: Review the PR code carefully before approving!

@github-actions

Copy link
Copy Markdown
Contributor

🔐 Fork smoke tests started by maintainer

⏳ Security scans passed. Running smoke tests...

Commit: 17992391b3404b105df501c36d3092944cb7f4f8
View run

@github-actions

Copy link
Copy Markdown
Contributor

All smoke tests passed! (Fork PR)

✅ Security Scan: success
✅ Linux: success
✅ Windows: success

View run details

@ajalon1 ajalon1 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.

Hey @ScottOglesby 👋🏽
Pretty good. I've got a lot of small nits and observations here, that are really just stretch goals, that are coming up as we're maturing this codebase. I just like making general suggestions.

I would approve after you update ListArtifacts in the internal API module to validate limit and offset. Anything else is up to the the Workload team.

Comment thread cmd/artifact/list/cmd.go

workload.AddStatusFlag(cmd, &status)
cmd.Flags().IntVar(&limit, "limit", 100, "Maximum number of artifacts to return")
cmd.Flags().IntVar(&offset, "offset", 0, "Number of artifacts to skip before returning results")

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.

Probably not your intention, but I'm happy to see that this is backwards-compatible. Not a breaking change. 😆

@@ -410,7 +410,7 @@ func TestListWorkloads_FollowsNextAndTruncatesToLimit(t *testing.T) {

func TestListWorkloads_RejectsNonPositiveLimit(t *testing.T) {

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.

Add a TestListWorkloads_RejectsNegativeOffset() test

func ListArtifacts(limit int, status Status) ([]Artifact, error) {
endpoint := "/api/v2/artifacts/?limit=" + strconv.Itoa(limit)
func ListArtifacts(limit, offset int, status Status) ([]Artifact, error) {
endpoint := "/api/v2/artifacts/?limit=" + strconv.Itoa(limit) + "&offset=" + strconv.Itoa(offset)

@ajalon1 ajalon1 Aug 18, 2026

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.

Could consider switching this over to use url.Values{} like ListWorkloads() does as that would be a better pattern than building this by hand.

Absolutely not your problem. If you do tackle it I'd suggest doing this in a followup PR.

Something closer to this:

query := url.Values{}
query.Set("limit", strconv.Itoa(limit))
query.Set("offset", strconv.Itoa(offset))
if status != "" {
    query.Set("status", string(status))
}
pageURL, err := config.GetEndpointURL("/api/v2/artifacts/")

Comment on lines +409 to +417
func ListWorkloads(limit, offset int, statuses []string) ([]Workload, error) {
if limit <= 0 {
return nil, fmt.Errorf("invalid limit %d: must be positive", limit)
}

if offset < 0 {
return nil, fmt.Errorf("invalid offset %d: must be non-negative", offset)
}

@ajalon1 ajalon1 Aug 18, 2026

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.

I think ListArtifacts() in the internal module should validate limit and offset the way ListWorkloads() does.

Comment thread cmd/artifact/list/cmd.go
Comment on lines +63 to +65
if offset < 0 {
return fmt.Errorf("invalid --offset %d: must be non-negative", offset)
}

@ajalon1 ajalon1 Aug 18, 2026

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.

Another suggestion for a followup PR would be refactoring this to a custom pflag.Value. We do this already in cmd/internal/pollflags/pollflags.go.

Absolutely Not blocking, since the current if-return-error is widespread throughout the repo, but would be a nice update. Would also have the benefit of moving the validation from runtime to parsetime.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants