Skip to content

feat(artifacts): follow signed-URL delivery for artifact and HTML report downloads#88

Open
riglar wants to merge 1 commit into
devfrom
feat/signed-url-artifact-delivery
Open

feat(artifacts): follow signed-URL delivery for artifact and HTML report downloads#88
riglar wants to merge 1 commit into
devfrom
feat/signed-url-artifact-delivery

Conversation

@riglar

@riglar riglar commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Client side of devicecloud-dev/dcd#1124 (API PR: devicecloud-dev/dcd#1128).

Why

The dcd API previously assembled artifact/report ZIPs in memory and streamed them through itself — ~558 GB/month of its egress and the dominant driver of its memory footprint. The API now supports assembling the bundle into object storage and returning a pre-signed URL, so the download bypasses the API entirely.

What

  • downloadArtifactsZip sends delivery: 'url' on POST /results/:uploadId/download; downloadReportGeneric adds ?delivery=url on GET /results/:uploadId/html-report (html only — junit stays inline, allure is a separate endpoint untouched by the API change).
  • New shared followSignedUrlDelivery helper: a JSON response (content-type sniff) means signed-URL delivery — parse { url }, fetch it without auth headers (it's pre-signed), and stream to disk. Any other content-type is the ZIP itself, streamed exactly as before.
  • Compatibility in both directions, no version negotiation needed:
    • Old API + new CLI: the API ignores the extra field/param and streams inline; the content-type sniff takes the legacy path.
    • New API without object storage (e.g. self-host without B2): responds 501; the CLI retries once inline.
    • New API + old CLI: no delivery field sent, API streams inline (still streamed server-side, so the memory win applies regardless).

Testing

  • Updated the pinned request-shape assertions in test/unit/report-download.service.test.ts
  • New unit tests: signed-URL flow (follows { url }, asserts auth headers are not sent to storage, file lands on disk) and the 501 inline fallback
  • pnpm typecheck, pnpm lint (32 warnings, same as baseline), full pnpm test suite: 169 passing

🤖 Generated with Claude Code


View with Codesmith Autofix with Codesmith
Need help on this PR? Tag /codesmith with what you need. Autofix is disabled.

…ort downloads

The dcd API can now deliver artifact bundles and HTML report ZIPs as
pre-signed object-storage URLs instead of proxying the bytes
(devicecloud-dev/dcd#1124), cutting its egress and memory. Opt in by
sending delivery:'url' on POST /results/:uploadId/download and
?delivery=url on GET /results/:uploadId/html-report, then follow the
returned { url } (no auth headers — it's pre-signed).

Backwards and forwards compatible: an older API ignores the extra
field/param and streams the ZIP inline (detected via content-type), and
a 501 (API supports url delivery but storage unconfigured) falls back
to an inline request.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@claude

claude Bot commented Jul 22, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

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