Repository navigation
Pin every vendored bundle's JavaScript in package.json and build from its lock - #1084
Merged
Merged
Conversation
… 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]>
leaf-agent
approved these changes
Sep 24, 2026
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
JS versions lived in two manifests.
scripts/vendor.pykept aPINStable and installed each bundle's packages into a throwaway npm directory. The browser framework build pinned Lit, Signals and esbuild inpackage.json, and #1011 and #1022 moved rows across one at a time.plot,pierreandmcp-appalso took their transitive dependencies from whatever npm resolved on the day, so their bytes weren't reproducible.Now
package.jsonpins every package a bundle's own source imports, andpackage-lock.jsonsettles the rest of each closure.vendor.pybuilds every bundle from the rootnode_modulesthatnpm ciinstalls and reads banner versions from there.PINS, the throwaway installs,HELD_BY,REBUILDSand--pinsare gone. A package that another package depends on is now held by that dependant's range and the lock, which is whatHELD_BYused 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 (marked11 under Web Awesome,acornunder agentic-mermaid,entities6 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 trimmedpackage.jsonto direct imports only, and the lock kept every resolved version.What moved:
testjob runsuv run scripts/vendor.pyand fails on any diff, now that a rebuild reproduces exactly. RootAGENTS.mdsayswt mergedoesn't run this check.browser-runtime.manifest.jsonrecords the lock hash and contributor dependencies, so it was regenerated.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.Verification:
npm ci;npm run check:browser && npm run test:browser(64 pass);npm run test:runtime(91 pass);uv run scripts/vendor.pytwice with a clean tree;uv run pytest tests(1353 passed).🤖 Generated with Claude Code