Skip to content

Pin every vendored bundle's JavaScript in package.json and build from its lock - #1084

Merged
max-sixty merged 1 commit into
mainfrom
js-pins-one-manifest
Sep 24, 2026
Merged

max-sixty merged 1 commit into
mainfrom
js-pins-one-manifest

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

JS versions lived in two manifests. scripts/vendor.py kept a PINS table and installed each bundle's packages into a throwaway npm directory. The browser framework build pinned Lit, Signals and esbuild in package.json, and #1011 and #1022 moved rows across one at a time. plot, pierre and mcp-app also took their transitive dependencies from whatever npm resolved on the day, so their bytes weren't reproducible.

Now package.json pins every package a bundle's own source imports, and package-lock.json settles the rest of each closure. vendor.py builds every bundle from the root node_modules that npm ci installs and reads banner versions from there. PINS, the throwaway installs, HELD_BY, REBUILDS and --pins are gone. A package that another package depends on is now held by that dependant's range and the lock, which is what HELD_BY used to approximate.

Testing the model. First I added every existing pin to package.json, and all of them resolved in one tree without conflict. Nested copies exist (marked 11 under Web Awesome, acorn under agentic-mermaid, entities 6 under parse5), but none of them reaches a bundle differently than it did before. Rebuilding from the root lock reproduced every tracked file byte for byte. The one exception is the Web Awesome shared chunk's name (chunk-SH2BVOI3.js → chunk-DGEFCNBY.js): esbuild's chunk hash covers input paths, and the content is identical. That new name is stable across runs. Then I trimmed package.json to direct imports only, and the lock kept every resolved version.

What moved:

  • CI's test job runs uv run scripts/vendor.py and fails on any diff, now that a rebuild reproduces exactly. Root AGENTS.md says wt merge doesn't run this check.
  • Dependabot now watches the root npm manifest, grouped weekly, with esbuild excluded. Its PR stays red until the bundles are rebuilt, and running-tend's weekly section says how.
  • browser-runtime.manifest.json records the lock hash and contributor dependencies, so it was regenerated.
  • Deleted test_the_tooling_instructions_place_every_vendored_bundle, since the reproducible/unreproducible split it enforced no longer exists. The MCP App banner test reads the lock.
  • Pierre's license walk resolves each package to the copy esbuild actually read, nested or not.

Verification: npm ci; npm run check:browser && npm run test:browser (64 pass); npm run test:runtime (91 pass); uv run scripts/vendor.py twice with a clean tree; uv run pytest tests (1353 passed).

🤖 Generated with Claude Code

… its lock

`scripts/vendor.py` kept its own PINS table and installed each bundle's
packages into a throwaway npm directory, while the browser framework build
pinned Lit, Signals and esbuild in `package.json`. Two manifests answered
"which version ships", and `plot`, `pierre` and `mcp-app` took their
transitive dependencies from whatever npm resolved that day.

`package.json` now pins every package a bundle's source imports, and
`package-lock.json` settles the rest of each closure. `vendor.py` builds
every bundle from the root `node_modules` that `npm ci` installs and reads
banner versions from it, so PINS, the throwaway installs, `HELD_BY`, and the
`--pins` report are gone. With the same versions, every bundle rebuilds
byte-identical; the one diff is the Web Awesome shared chunk's file name,
whose hash covers input paths, with identical content.

Behavior that moved:
- CI's `test` job rebuilds every bundle and fails on a diff, since a rebuild
  now reproduces exactly.
- Dependabot watches the root npm manifest (esbuild excepted); running-tend
  says how to rebuild on its PR.
- The test that sorted bundles into reproducible and not is deleted; the
  distinction no longer exists. The MCP App banner test reads the lock.
- Pierre's license notice resolves each package to the copy esbuild read,
  nested or not.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit e378181 into main Sep 24, 2026
5 checks passed
@max-sixty
max-sixty deleted the js-pins-one-manifest branch September 24, 2026 05:11
max-sixty added a commit that referenced this pull request Oct 25, 2026
Pierre's parsePatchFiles has run realignChangeContentBySimilarity since
@pierre/diffs 1.3.0, and 1.5.2 splits the test's rewrite into the same
three pieces as 1.6.1 (0/11, 4/4, 0/4). Leaf pinned 1.4.3 when it first
pinned Pierre (#1084), so the rewrite has read this way since then, not
since #3782.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty added a commit that referenced this pull request Oct 25, 2026
In a patch review at 1600x1000, lf-diff showed a rewrite's four deleted
lines between the 11th and 12th of its 19 added lines. That cut the new
function in two, and the re-indented lines 12-15 were painted as changed
words. Pierre's parser has re-paired such changes since 1.3.0, so the
diff has read this way since Leaf first pinned `@pierre/diffs` (1.4.3,
in #1084), not since the 1.6 bump in #3782: Leaf's vendored parser
before that bump splits this PR's test patch exactly as 1.6.1 does.

Pierre runs `realignChangeContentBySimilarity` on every parse. It splits
a change whose deleted and added line counts differ into pieces, so that
its most similar lines pair up. That helps a split view. Leaf draws only
the unified view, where the step moves deleted lines into the middle of
the added ones. In a fresh Opus 5.5 patch review, the pair judge
preferred plain HTML's removed-then-added diff both times, for "more
readable code".

lf-diff now joins the pieces after parsing, restoring git's order: each
change reads deletions, then additions. A git patch never puts two
changes side by side without context between them, so a one-sided change
next to another change can only be one of Pierre's pieces. Rows, line
numbers and comment coordinates are unchanged. Word highlights pair a
change's lines by position.

The join undoes a step the dependency runs itself. An option in Pierre
to skip realignment for the unified view would let this code go; that is
reported upstream in
[pierrecomputer/pierre#1229](pierrecomputer/pierre#1229).

Evidence (local, in the campaign worktree
`/Users/maximilian/workspace/leaf.agent-a10f091f355e3a600`):
- `.tmp/overnight/c7/rewrite-diff-base.png` and
`.tmp/overnight/c7/rewrite-diff-after.png` show the rewrite on main and
with the join.
- `.tmp/overnight/c7/difftest.html` reproduces it.

Checks, on this branch cherry-picked onto current main:
- `test_a_rewrite_reads_its_deletions_above_its_additions` fails with
main's `lf-diff.js`, where the rows read new1..new11, old1..old4,
new12.., and passes with the join.
- `tests/browser/widgets/test_diffs.py -k "rewrite_reads or comments or
selection or refresh or hunk"`: 9 passed.
- `tests/browser/test_render_anchors.py -k diff`: 19 passed.
- `pnpm run test:runtime`: 550 passed.
- pre-commit passes.
- Parsing the test's rewrite with `parsePatchFiles` gives the same three
pieces (0/11, 4/4, 0/4 deletions/additions) on 1.3.0, 1.5.2 and 1.6.1,
and one change (4/19) on 1.2.0.
- On the campaign branch, the stills diff-file-threads, diff-long-lines,
worktree-diffs, walkthrough-diff-comment and diff-filter were unchanged.

No open PR touches the same code (searched "pierre", "realign", "diff
deleted").

> _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