Skip to content

feat(ci): fold all asset declaration parsing into one scanner - #3990

Merged
zackees merged 1 commit into
masterfrom
feat/unify-asset-scanner
Aug 23, 2026
Merged

zackees merged 1 commit into
masterfrom
feat/unify-asset-scanner

Conversation

@zackees

@zackees zackees commented Aug 22, 2026

Copy link
Copy Markdown
Member

Problem

Three parsers existed for the same concept, and they had drifted into mutually unreadable formats:

Parser Format Consumer
ci/compiler/asset_scanner.py text .lnk WASM manifest
fbuild lnk/format.rs JSON .lnk build-time blob fetch
a third draft parser JSON .lnk + assets.json —

The consequence is concrete: examples/AudioUrl/data/track.mp3.lnk is text, so anything written by fbuild lnk add (JSON) was invisible to the scanner, and vice versa. A sketch could not be read by both toolchains.

Change

asset_scanner becomes the single Python entry point and accepts every form in use:

  • *.lnk text — first non-comment line is the URL, then key=value metadata. Unchanged; still mirrors the C++ runtime (fl::parse_lnk_with_metadata() in src/fl/stl/url.h).
  • *.lnk JSON — {"v": 1, "url": ..., "sha256": ..., "size": ..., "extract": ...}, what fbuild lnk add writes.
  • assets.json — several assets declared in one file.

Format detection sniffs the first non-blank, non-comment character: { means JSON, anything else is text. A .lnk overrides an assets.json entry of the same name, so a sketch can override one entry of a shared manifest without editing it.

The redundant third parser is deleted rather than kept in sync. Materialization stays fbuild's job (fbuild lnk pull); this module only parses and emits the manifest.

Compatibility

AssetEntry gains size and extract (JSON-only fields), but the emitted manifest keeps its exact previous shape: url/sha256/fallback always present including nulls, and the new keys emitted only when actually set. A text-format .lnk serializes byte-identically to before, so existing WASM consumers see no change.

Verification

Both committed .lnk files parse through the one scanner, zero warnings:

examples/AudioUrl:
   data/track.mp3 -> https://www.soundhelix.com/...  sha=- size=None
examples/Fx/FxLedmapper32x32:
   data/video1.rgb -> https://raw.githubusercontent.com/FastLED/assets/...  sha=164804d94802 size=6051840
  • bash compile wasm --examples AudioUrl — build successful (exercises the manifest path)
  • 24 tests pass — the 12 pre-existing ones unchanged, 12 new covering the JSON .lnk schema, assets.json, both formats coexisting in one sketch, .lnk precedence, malformed-input warnings that don't fail the build, and a guard that the real committed .lnk keeps parsing
  • bash lint clean

Refs #3986, FastLED/fbuild#1357

🤖 Generated with Claude Code

Three parsers for the same concept had drifted apart:

  - ci/compiler/asset_scanner.py  text `.lnk` (mirrors the C++ runtime)
  - fbuild lnk/format.rs          JSON `.lnk`
  - a third draft parser          JSON `.lnk` + assets.json

The formats are mutually unreadable, so a sketch using one toolchain's
format was invisible to the other. examples/AudioUrl (text) and any
sketch using `fbuild lnk add` (JSON) could not both be scanned.

asset_scanner is now the single Python entry point and accepts every form:

  - `*.lnk` text  — first non-comment line is the URL, then key=value
  - `*.lnk` JSON  — {"v":1,"url":...,"sha256":...,"size":...,"extract":...}
  - `assets.json` — several assets declared in one file

Format detection sniffs the first non-blank, non-comment character. A
`.lnk` overrides an assets.json entry of the same name, so a sketch can
override one entry of a shared manifest.

AssetEntry gains `size` and `extract` (JSON-only fields). The emitted
manifest keeps its exact previous shape — url/sha256/fallback always
present including nulls, the new keys emitted only when set — so existing
WASM consumers see no change.

The redundant third parser is deleted rather than kept in sync.
Materialization stays fbuild's job (`fbuild lnk pull`); this only parses.

Verified: both committed `.lnk` files parse through the one scanner with
zero warnings, and `bash compile wasm --examples AudioUrl` succeeds.
24 tests (12 pre-existing, all still passing).

Refs #3986, FastLED/fbuild#1357

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@coderabbitai

coderabbitai Bot commented Aug 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 2 minutes

Limit details: You’ve used all 8 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 461f85d8-c540-4ce8-8e0f-19b8c206da17

📥 Commits

Reviewing files that changed from the base of the PR and between 1abe3a9 and 2c19b15.

📒 Files selected for processing (2)
  • ci/compiler/asset_scanner.py
  • ci/tests/test_asset_scanner.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant