Repository navigation
Open
Labels
enhancementNew feature or request
Description
Context
The upload page runs the BIDS validator in a Web Worker (#161, ADR 0028, PR #473).
The worker is a 10 MB file built with Deno from the pinned jsr:@bids/validator release and committed under public/vendor/bids-validator/<version>/, because Bun cannot install a jsr: specifier and Cloudflare's build has no Deno.
ADR 0028 ("Alternatives considered") records a second route and calls it viable but not taken.
The JavaScript Registry (JSR) also serves an npm-compatible registry, npm.jsr.io, and Bun installs @jsr/bids__validator from it with an [install.scopes] entry in bunfig.toml.
This issue is to build that route and, if it holds, replace the committed bundle with it.
What was measured
bun installfromnpm.jsr.ioworks with the scope entry, and puts 108 packages innode_modulesfor entry points that use a fraction of them.bun buildof the two entry points the worker imports (@bids/validator/files/browserand@bids/validator/validate) gave a bundle that, run in Node on five datasets made from the repository's fixtures, reported the same findings as the Deno build, messages included.- It was not built through Astro and Vite, which is the part this issue has to settle.
Why it may be worth doing
- No 10 MB generated file in git history, and no re-vendor each time nemar-cli moves its pin (about monthly; each re-vendor is roughly 1.5 MB of history and needs Deno on a maintainer's machine).
- No Deno anywhere in the repository's workflow.
- A pin move becomes a copy of
validator-version.jsonand an ordinary dependency update.
What stands in the way
- The worker's Content-Security-Policy is a header rule on a fixed path (
/vendor/bids-validator/*inpublic/_headers), and it is where the validator's'unsafe-eval'lives, kept off the page's own policy.
Astro and Vite give built files hashed names, so the build has to put the worker at a stable, versioned path, or the rule has to match a hashed one without widening. - Cloudflare's build would depend on
npm.jsr.iobeing up, and on its packages not being replaced.
Today the bytes are pinned by a committed Deno lock with integrity hashes, aSHA256SUMSfile, a provenance record and the licence text of every package; a Bun lock has to carry the same guarantees, and the tests that check them (test/bids-validator-vendor.test.ts) have to check what is built instead. - The HED validator is most of the bundle, and splitting it would make the output depend on the bundler's chunk names; a single file is what the Deno route settled on.
Done when
- The worker is built from packages pinned in
bun.lockas part ofbun run build, at a stable versioned path that the_headersrule matches without widening. -
public/vendor/bids-validator/,scripts/vendor-bids-validator.ts, the Deno lock and the tests that guard the committed bytes are removed, or replaced by tests of what is built (integrity, the version marker, the licences). -
test/bids-validator-integration.test.tspasses on the built worker unchanged, which holds the protocol, the gate, the panel and the wording as they are. - CI passes without Deno, and the pin drift test still compares
validator-version.jsonwith nemar-cli. - A new ADR supersedes ADR 0028 on the distribution route, and the protocol, gate, panel and tests it names are said to carry over.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
docs: say what a re-vendor needs and changes
feat: browser BIDS validation on the upload page