Skip to content

feat: resolve remote example assets at build time (sha256-verified, globally cached) #1354

Description

@zackees

Summary

Add build-time resolution of remote example assets, so large binary payloads live in FastLED/assets instead of the FastLED source tree, and fbuild fetches them during the build.

Current state

fbuild resolves remote toolchain/platform archives today (ci/boards.py is full of https://github.com/pioarduino/...platform-espressif32.zip style URLs). There is no equivalent for example data assets. Any sketch needing a binary payload must commit it into the FastLED repo.

Concretely, examples/Fx/FxLedmapper32x32/data/ currently carries ~10 MB of binaries (a 6.05 MB video1.rgb and a 4.10 MB .zip that duplicates it). That is the case this issue exists to eliminate.

Proposed

A declarative asset reference resolved before compile, e.g. an assets.json (or a [assets] block) beside the sketch:

{
  "video1.rgb": {
    "url": "https://raw.githubusercontent.com/FastLED/assets/main/examples/FxLedmapper32x32/video1.rgb",
    "sha256": "<digest>",
    "size_bytes": 6051840
  }
}

fbuild resolves each entry into the sketch's data/ dir at build time.

Requirements

  • Verify by content digest, not ETag. ETag is a server-chosen opaque validator, not a content hash — measured across four origins it ranges from the exact content MD5 (nodejs.org) to an Azure last-modified timestamp (GitHub Releases, "0x8DEFE5A52510C18"), which changes on re-upload of identical bytes. Integrity must come from sha256 in the manifest. See Add zccache fetch — global content-addressed cache for external tool downloads zackees/zccache#1469 for the full evidence.
  • Cache globally, keyed by digest — not per-repo, not per-worktree. Same rationale as Add zccache fetch — global content-addressed cache for external tool downloads zackees/zccache#1469; ideally the same CAS.
  • Conditional GET for revalidation — measured 304 in 0.14s / 0 bytes vs 200 in 16.0s / 29.7 MB on a comparable payload.
  • Segmented download — raw.githubusercontent.com advertises Accept-Ranges: bytes; measured 3.7x on a 29.7 MB payload (14.2s → 3.9s at 8 connections).
  • Offline / air-gapped path — a populated cache must build with no network.
  • Deterministic failure — a digest mismatch fails the build loudly; it must never silently fall back to a stale or partial file.

Manifest format

Prefer consuming zackees/manifest.json rather than inventing a format. Its Index → Catalog → Release tiers with OCI-style {url, sha256, size_bytes} descriptors already give integrity-chained federation across repos and CDNs, which is exactly the shape needed once FastLED/assets is served over a CDN.

Related

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions