Skip to content

perf(cli): read artifact listing metadata in bulk - #14934

Merged
sipsma merged 4 commits into
dagger:mainfrom
grouville:perf/artifact-listing-metadata-20261028
Nov 2, 2026
Merged

sipsma merged 4 commits into
dagger:mainfrom
grouville:perf/artifact-listing-metadata-20261028

Conversation

@grouville

@grouville grouville commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Expanded listings currently create a DagQL Artifact result for every row, then resolve its URI, description, module name and path separately. With thousands of checks, that adds substantial cache and result bookkeeping after collection discovery.

I added an internal Artifacts.__listing projection that runs the same collection expansion and returns those metadata fields in one JSON response. The CLI uses it for expanded listings. It falls back to the existing API on older engines only when GraphQL validation reports that the new field is missing; discovery and resolver failures are returned without retrying. Check execution continues through the existing path.

For the full Go test listing:

dagger check --module go --check test --list --all

With the Go module unchanged, the latest isolated comparison measured 25.4s → 21.3s median: 4.1 seconds saved, 16% lower latency, with all 4,706 tests listed. Returning to the old CLI measured 26.7s; pooling the before/after controls gives 26.0s → 21.3s, or 18%. I use the conservative 16% figure because the controls drifted. An earlier independent bracket measured 25.5s → 21.8s, or 14.6%.

Raw warm timings, seconds:

Case Runs
Existing CLI, before 25.893, 24.877
Bulk metadata CLI 21.928, 20.616
Existing CLI, return 26.180, 27.162

Both arms used the same endpoint-capable engine, so the comparison isolates using this new API and its CLI consumer. The benchmark engine privately combines collection PR #14802 at 97a8621c57 with main at 5c4cdd243b; the Go module is the current dagger/go#84 head eecde50722. The code in this PR is based directly on main and does not include either collection implementation. The other Go/compiler improvements are now separate drafts; the combined result below is not this PR's standalone contribution.

Measurements use a warmed engine limited to 8 CPUs, a fresh CLI process, an ordinary source edit and a uniquely named added test before every run. Each run checks every expected test, ordering, complete normalized stdout, successful exit and normal session cleanup. Preparation runs are retained separately and excluded from warm medians. wcprof and CPU/allocation profiles were captured.

Validation completed:

  • Focused engine and CLI race tests on current main.
  • Typed/untyped address and metadata equivalence, empty output, errors, cancellation and no leaf evaluation.
  • Strict fallback tests covering structured HTTP validation errors and rejecting resolver/network failures, plus a real-server regression proving nested validation errors retain a response path and cannot trigger the missing-field fallback.
  • New CLI against the older engine: exact full 4,706-test output and a single-test filter.
  • Full and filtered listings on the collection engine.

Before the rebase below, CI was green: 92 successful checks and one skipped. The focused race tests also pass after the metadata protocol cleanup. The release note is included.

A local generation run using the collection benchmark engine produced unrelated collection-API diffs; I excluded all of those generated files. The CI SDK generation/staleness checks use the PR source and passed. This PR contains only the bulk metadata change, compatibility tests and release note.

Current-code combined check (2026-10-29): main 4342720d00 plus collection branch 636dd96749, with Go #84 at 1572fd4634, measured 15.505s median after adding the open bulk-listing, prepared-compilation and Go-index changes. Runs were 15.505 / 15.255 / 15.679s. Baseline runs were 28.339 / 26.209s before and 24.745 / 26.245s after. Using the faster control block gives 25.495s → 15.505s, 39% lower latency; pooled controls give 41%. Engine CPU is 116.32s → 35.73s.

That is the combined stack, not this PR's standalone contribution. Engine/CLI code is current; the workload is the same fixed 4,706-test root-Go fixture in all arms, with a fresh source edit and unique added test each time. Complete ordered stdout and normal cleanup pass. All arms also contain the identical small table-output buffering fix, prepared separately after the unmodified current CLI silently dropped stdout fragments. That shared prerequisite is not attributed to these performance changes. Telemetry batching and discovery-only scanning are absent from this combined result.

Update: rebased, plus two small fixes

Rebased onto current main (after #15035). Guillaume's two commits are unchanged. Two commits were added on top of them:

  • core: drop a listing test assertion that cannot fail. The parity test counted calls to a value field it installed itself. Nothing in the listing path calls that field, so the count was always zero. TestCollections already checks, through the real CLI, that expanded listings leave collection leaves unevaluated, and it now exercises __listing end to end.
  • cli: match a missing listing field only as the client reports it. Through the Go client, a validation failure always arrives as a graphql.HTTPError carrying the parsed GraphQL errors. The matcher's branches for bare gqlerror values and lists could not be reached, so they are gone, and the test cases use the real error shape.

Measured separately on dagger/dagger's own 4,953 Go tests (dagger check --go --check test -l --all), with the other three open PRs from this performance series applied in both arms, this PR saves about 2 s in every state: 6.2 → 4.3 s with nothing changed, 16.5 → 14.6 s after a source edit, and 84.0 → 82.4 s on a fresh engine. Those are medians of 3 paired runs on a 16-CPU machine. Every run's output matched go test -list and was byte-identical across runs.

The dropped stdout fragments mentioned above don't reproduce on current main. #14886, which makes command output wait for queue space instead of dropping it, landed after this PR's original base and is the likely fix.

@sipsma
sipsma force-pushed the perf/artifact-listing-metadata-20261028 branch from 80224ad to 095a48a Compare November 2, 2026 21:15
@sipsma
sipsma marked this pull request as ready for review November 2, 2026 21:15
grouville and others added 4 commits November 2, 2026 21:50
The listing test counted calls to a value field it installed itself,
but nothing in the listing path calls that field, so the count was
always zero. Collections integration tests already check that
expanded listings leave real collection leaves unevaluated.

Signed-off-by: Erik Sipsma <[email protected]>
The Go client returns a request that fails validation as an HTTP
error carrying the GraphQL errors. The matcher also accepted bare
gqlerror values and lists, which the client never returns for a
validation failure, so only the HTTP error case stays.

Signed-off-by: Erik Sipsma <[email protected]>
@sipsma
sipsma force-pushed the perf/artifact-listing-metadata-20261028 branch from 095a48a to a97eb9a Compare November 2, 2026 21:55
@sipsma
sipsma merged commit 12d0a38 into dagger:main Nov 2, 2026
93 checks passed
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.

2 participants