Skip to content

Decide whether a bundle is CSP-safe in one parser, and write every bundle's notices once - #1245

Merged
max-sixty merged 2 commits into
mainfrom
consolidate-bundle-gate
Sep 27, 2026
Merged

max-sixty merged 2 commits into
mainfrom
consolidate-bundle-gate

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

scripts/browser/shipped.mjs now owns what a committed third-party bundle must be
and carry. scripts/browser/build.mjs and scripts/vendor.py both pass every
output through it:

  • CSP check. The acorn check that build.mjs ran on the framework and lit.js
    now runs on every module vendor.py writes, including Pierre (1.7MB, previously
    unchecked because its grammars carry import( as data), the Web Awesome chunks,
    and the published marked and sortable copies (previously unchecked). The
    substring check in vendor.py is gone. A static import may name any local path;
    whether its target exists stays with revision capture. The check also catches
    (0, eval)(…), globalThis.eval(…), and a string passed to setTimeout or setInterval, which the substring check partly and the
    old parser never did. Refusals name the file, line, and reason.
  • License notices. One writer replaces three (vendor.py's package_notices,
    Pierre's build.mjs, and the framework build's own format). Each bundle's notices
    list the packages whose code reached an output, read from esbuild's metafile, so
    the hand-kept package tuples for Agentic Mermaid, Floating UI, and Web Awesome are
    gone. A package's NOTICE, THIRD_PARTY_NOTICES, and LICENSES/ files come with it,
    which is how Agentic Mermaid's extra notices now arrive.

Behaviour that moved:

  • Every vendored bundle now carries a <bundle>.LICENSES.txt: codemirror,
    highlight, jsdiff, marked, plot, sortable, and the MCP App's page-app gain one.
    Plot's lists the d3 modules it bundles. Page vendoring and exports carry about
    65KB more notice text (the export embeds non-script resources).
  • browser-runtime.LICENSES.txt takes the shared format, and the framework
    manifest's bundledDependencies drops lit, whose re-export modules contribute
    no bytes (lit-html and lit-element, which do, remain).
  • Existing notices change only in their title line and ordering; their package sets
    are unchanged. No bundle's JavaScript bytes changed.

This was written by Claude Code on behalf of max-sixty

🤖 Generated with Claude Code

…ndle's notices once

`scripts/browser/shipped.mjs` now owns what a committed third-party bundle must be
and carry. `scripts/browser/build.mjs` and `scripts/vendor.py` both pass every
output through it:

- **CSP check.** The acorn check that `build.mjs` ran on the framework and `lit.js`
  now runs on every module `vendor.py` writes, including Pierre (1.7MB, previously
  unchecked because its grammars carry `import(` as data), the Web Awesome chunks,
  and the published `marked` and `sortable` copies (previously unchecked). The
  substring check in `vendor.py` is gone. A static import may name any local path;
  whether its target exists stays with revision capture. The check also catches
  `(0, eval)(…)` and `globalThis.eval(…)`, which the substring check partly and the
  old parser never did. Refusals name the file, line, and reason.
- **License notices.** One writer replaces three (`vendor.py`'s `package_notices`,
  Pierre's `build.mjs`, and the framework build's own format). Each bundle's notices
  list the packages whose code reached an output, read from esbuild's metafile, so
  the hand-kept package tuples for Agentic Mermaid, Floating UI, and Web Awesome are
  gone. A package's NOTICE, THIRD_PARTY_NOTICES, and `LICENSES/` files come with it,
  which is how Agentic Mermaid's extra notices now arrive.

Behaviour that moved:

- Every vendored bundle now carries a `<bundle>.LICENSES.txt`: codemirror,
  highlight, jsdiff, marked, plot, sortable, and the MCP App's `page-app` gain one.
  Plot's lists the d3 modules it bundles. Page vendoring and exports carry about
  65KB more notice text (the export embeds non-script resources).
- `browser-runtime.LICENSES.txt` takes the shared format, and the framework
  manifest's `bundledDependencies` drops `lit`, whose re-export modules contribute
  no bytes (lit-html and lit-element, which do, remain).
- Existing notices change only in their title line and ordering; their package sets
  are unchanged. No bundle's JavaScript bytes changed.

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

@leaf-agent leaf-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSP gate accepts string timer callbacks: checkModule('setTimeout("document.body.dataset.ready=1", 0)') returns normally. Leaf's export policy omits unsafe-eval, so the browser blocks that callback; the same applies to setInterval. A dependency update could therefore pass vendoring but fail only in an exported page. The CSP specification lists both string timers as compilation sinks.

Comment thread scripts/browser/shipped.mjs Resolved
A timer given a string compiles it, which the export's CSP refuses as it
refuses eval. The gate now refuses a literal, template, or concatenated
string as a timer's first argument; a function stays allowed.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit ddc0731 into main Sep 27, 2026
5 checks passed
@max-sixty
max-sixty deleted the consolidate-bundle-gate branch September 27, 2026 00:22
max-sixty added a commit that referenced this pull request Sep 27, 2026
The concept survey's drifted duplicates now each have one owner
(#1214–#1221, #1223, #1228, #1231, #1235, #1244, #1245, #1247, #1250,
#1251, #1254, #1260), so the survey note never lands. What it found and
nobody has taken becomes `TODO.md` entries:

- **Shared definitions** (new section under Next): re-addressing
resource references in one pass instead of `http.py`'s regex scopers and
three head composers; `tests/render_harness.py` `told()` beside
`pageReadiness`'s `data` and `log` stages (#1250), which answer the same
question; Python still naming a thread's identity a root
(`thread_roots`, `FrozenThreadReading.roots`) now that the runtime keys
threads on the served `id` (#1260).
- **Requests**: the existing "Decide whether requests earn their weight"
entry now says kept requests need one owner for seat availability, which
four runtime modules restate.
- **Implementation candidates**: the unresolved-gesture ledger as one
state machine, deferred until a change has to touch it, since nothing
there has drifted and it is the hottest race path.

The survey's small undrifted items and its list of deliberate splits are
dropped: none has drifted, and the splits are intended.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

> _This was written by Claude Code on behalf of max-sixty_

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.

2 participants