Skip to content

Bulk download of a build's images as one tar.zst: API and MCP (sc-8869, part 1) - #47

Merged
ndbroadbent merged 1 commit into
mainfrom
sc-8869
Dec 2, 2026
Merged

ndbroadbent merged 1 commit into
mainfrom
sc-8869

Conversation

@ndbroadbent

Copy link
Copy Markdown
Member

Part 1 of sc-8869: a build's images as one tar.zst, for reviewing big builds (pdf_engine's 3,600 images) on disk or with checks of your own. The CLI command and the web button follow in their own PRs.

  • visualci-core::bundle (the bundle feature, so the wasm build doesn't compile zstd's C), shared with sc-8868's bundle upload:
    • a streaming Writer;
    • unpack into a directory, refusing absolute paths and .., and skipping links;
    • for_each_entry, which yields path and bytes one at a time with a per-entry size cap.
  • Server:
    • A downloads table (migration 000043). A worker builds each archive and streams it to the bucket as a multipart upload in 16 MiB parts.
    • The archive holds <name>[@platform][/page-N]/{base,head,diff,regions}.png plus manifest.json. regions is the head cropped to the changed regions.
    • Over 2 GB it stops with an error that suggests a narrower glob.
    • The same build and filter within the hour gets the same download. A download stuck building for 15 minutes is replaced.
    • retention:prune deletes downloads older than a day, with their archives, under its existing heartbeat.
  • REST: POST /api/v1/builds/{id or number}/downloads (state, sides, glob) and GET /api/v1/downloads/{id}. A ready download has a url that lasts an hour.
  • MCP: download_build waits up to a minute, then returns the URL, files, size and a summary, never image bytes. When it's still building, call again.
  • Free: no credits.
  • Docs: the agents guide (with advice for big builds: contact_sheet to scan, then download) and the API reference. CLI 0.2.16, plugin 0.1.41.

Tests (on docspring-dev, against MinIO):

  • a_builds_changed_images_download_as_one_archive: the glob and state filter, the files written, the regions crop, the manifest, reuse within the hour, a bad filter refused, and pruning deleting the archive.
  • another_projects_token_can_not_download_a_build.
  • The bundle round trip, path safety and for_each_entry.

Clippy and fmt are clean.

@visualci-com

visualci-com Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

VisualCI

docspring/visualci · build #195 · 2 changed, 329 unchanged · approved by visualci coordinator agent (MCP) for Nathan Broadbent

PR #47 (sc-8869 part 1): the new download_build tool in both token kinds' tool lists, its schema (build, state, sides, glob, wait) and description.

This PR vs base: 6 changed since #171, across 4 builds

Snapshot Before After
json/mcp/lists_the_tools_each_kind_of_token_can_use/tools-list-project-token (changed) text text, see the build
json/mcp/lists_the_tools_each_kind_of_token_can_use/tools-list-user-token (changed) text text, see the build

Updated as builds change. Agents can review with VisualCI's MCP tools.

@ndbroadbent
ndbroadbent force-pushed the sc-8869 branch 2 times, most recently from d6dc131 to 33c96fd Compare December 2, 2026 12:38
…OST /api/v1/builds/{id or number}/downloads and GET /api/v1/downloads/{id}, MCP download_build (waits up to a minute, returns a URL and a summary); filtered by state, sides (base, head, diff, regions) and a name glob; a worker streams the archive to the bucket in parts (2 GB cap), reused within the hour, pruned after a day by retention:prune; visualci-core::bundle (streaming tar.zst writer, safe unpack, for_each_entry) shared with sc-8868; downloads table (migration 000048); docs; CLI 0.2.17; plugin 0.1.45
@ndbroadbent
ndbroadbent merged commit 1125f51 into main Dec 2, 2026
11 checks passed
@ndbroadbent
ndbroadbent deleted the sc-8869 branch December 2, 2026 13:01
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
ndbroadbent added a commit that referenced this pull request Dec 2, 2026
* app/: the domain tables and models (sc-8900, the data side): organizations, memberships, projects, builds, snapshots, pages, texts (lz4), build groups with the effective_snapshots view, baselines, renders, diffs, blobs, reviews, comments and the credit ledger, as docs/design-storage.md lays them out with its indexes; JSON arrays where Laravel Rust 0.1.4 has no PostgreSQL arrays; project tokens belong to a project; test fixtures; the auth tests use real rows

* app/: a new account gets its own organization (named after its forge login, numbered when taken) with its admin membership and a default project: the SignedUp listener

* app/: the downloads table (sc-8869, #47) in the domain baseline, with its model
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