Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the build process to use the core's custom build tool (build-dist.mjs) for production builds, ensuring that the emitted JavaScript is comment-free and has non-Latin-1 literals escaped to optimize V8 heap usage. Additionally, build-pro.sh is updated to clean the dist directory and fail on build errors instead of ignoring them, and the package.json scripts and documentation are updated accordingly. There are no review comments, and I have no feedback to provide.
kriszyp
marked this pull request as ready for review
October 7, 2026 01:56
This was referenced Oct 7, 2026
cb1kenobi
approved these changes
Oct 9, 2026
kriszyp
force-pushed
the
kris/pro-build-dist
branch
from
October 12, 2026 14:47
1464ea6 to
bd515ca
Compare
This was referenced Oct 12, 2026
…tin-1 JS harper-pro compiles core into its own dist/core with tsc, bypassing core's production emit. Route npm run build through core/build-tools/build-dist.mjs --project tsconfig.json; build:watch stays plain tsc --watch. build-pro.sh no longer packages a failed build, so the Latin-1 check can stop a release. Idle worker GC'd heapUsed: 51.9 MB -> 42.1 MB (same core, tsc vs build-dist). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mment
build-dist.mjs (the emitter this PR routes npm run build through) strips comments
from all of dist/, so the test's `source.indexOf('// wait if there is
back-pressure', ...)` stopped matching and crashed the whole unit-test run at
module load. Anchor on `if (ws._socket.writableNeedDrain)` instead, which
survives comment stripping.
Dispatch-Task: pr-maint-29d39068089e86b610c01d9f103a51c3
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
kriszyp
force-pushed
the
kris/pro-build-dist
branch
from
October 13, 2026 08:21
76cc842 to
60a4c80
Compare
cb1kenobi
approved these changes
Oct 14, 2026
This branch has not been deployed
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.
⊙ Problem
harper-pro's
npm run buildcompilescore/**intodist/corewith plaintsc, so it never runs core's production emit from Reduce each thread's base JavaScript heap by about 40%. Every Harper Pro worker therefore keeps all of core's comments in module source on its heap, and stores any module containing a—or→as UTF-16. Measured on an idle worker: harper:core module source is 6.8 M chars (dist/core/resources/Table.jsalone has 1,575 comment lines).💡 Solution
npm run buildnow runs core's emitter against Pro's own tsconfig, so all ofdist/(Pro code anddist/core) is comment-free and Latin-1, and the build fails if a non-Latin-1 character survives.npm run build:watchstays plaintsc --watch(comments kept, development only). Packaging no longer ignores a failed build, so that Latin-1 check can actually stop a release.Idle worker, GC'd
process.memoryUsage().heapUsed(same core, only the emit differs):tsc(before)build-dist.mjs(after)main(pinned core, plaintsc), for referenceexternal_script_source_sizestayed at 4.3 MB in every run; that is source held off the V8 heap (most likely Node's own built-ins), so the saving shows inheapUsedinstead.🔧 Changes
buildrunsnode core/build-tools/build-dist.mjs --project tsconfig.json;build:watchcallstsc --project tsconfig.json --watch --incrementaldirectly, sincebuildno longer acceptstscflags.build-dist.mjsand its--projectoption (plus that PR's lazy dependency loading and source-map default).build-tools/build-pro.shis no longer part of this diff: #981 landed first and already made the samerm -rf dist/ strictnpm run buildchange (dropping|| true) and removed the shrinkwrap step this PR'srm -f npm-shrinkwrap.jsonguard was for. Rebasing onto main absorbed this PR's build-pro.sh hunk entirely; "packaging no longer tolerates a failed build" ships from #981 instead of from here.build-tools/DESIGN.mdnow carries both PRs' notes under separate headings, as predicted.The
corepointer has been re-bumped to merged harper#3072's commit, which is also HarperFast/harper main's current tip, during this rebase ontomain.✅ Verification
disteach way, started Harper Pro with 2 workers and per-thread inspectors (threads.debug.startingPort=9340), forced GC over CDP and readprocess.memoryUsage(), V8 code statistics and the loaded-script inventory per thread (table above; each config run twice, both workers within 0.1 MB). After the build, nodist/**/*.jscontains a character above U+00FF, anddist/core/resources/Table.jshas one comment line left (itssourceMappingURL).npm run build:watchstarts with 0 errors.npm run build,npm run typecheck,npm run lint:requiredpass.test:unit: 1,628 passing, 4 failing; the same 4 fail on a plain-tscbuild of the same tree (/proc, macOS symlink paths, git fixtures).test:integration:all: 218 passed, 4 failed, 2 cancelled of 239.analytics,isolatedApplicationReplicationandreplicateFalseFullCopyfail identically on the plain-tscbuild;deleteEchoRunfailed once under full-suite load and passed 3/3 when rerun alone. CI is authoritative.prettier --checkis clean on every changed file.main(round 1,1464ea6→76cc842): resolved conflicts inDESIGN.md,build-tools/DESIGN.md(both PRs' notes kept) andbuild-tools/build-pro.sh(dropped — redundant with Publish harper-pro with a locked JavaScript dependency bundle instead of a shrinkwrap #981, now onmain); re-bumpedcoreto merged harper#3072's commit. CI then failedUnit TestsbecausesendLoopYield.test.mjslocated code by searching for a comment the new comment-free build strips; fixed by anchoring on a code token instead.main(round 2,76cc842→60a4c80): no textual conflicts — main's owncoresync (chore: Sync Core #1039) landed a newer, descendant commit of thecorepin this PR carried, so Git's submodule-aware merge auto-resolved the gitlink forward to main's pin (3fd9ae9d, confirmed to still contain harper#3072). No other overlapping file changed on both sides.npm run buildandnpm run typecheckpass on the rebased tree;dist/**/*.jshas zero bytes above U+00FF; fulltest:unitpasses, 1793/0 failing (2 pre-existing pending). Independent re-review (codex + gemini + cursor-composer + harper-domain adjudication): LGTM, 0 actionable findings — the 2 surviving nits (build:watch/production divergence, the test's first-occurrence anchor) are both pre-existing, already-documented tradeoffs, not fixed.The
coresubmodule pointer now matchesHarperFast/harper's ownmaintip exactly (no longer ahead of it), so this PR no longer carries an active dependency on an unmerged companion.🤖 Generated by Claude Code (Claude Opus 5.5); posted via @kriszyp.
Release target: v5.4 — milestoned for v5.4; the build-tooling it touches also exists on v5.3, but no backport PR is linked, so this stays main-only
Related PRs: #956 overlaps (also moves the core submodule pointer), #972 overlaps (also edits AGENTS.md and the DESIGN.md index), #981 overlaps (makes the same rm -rf dist / no
|| truechange to build-pro.sh, drops the shrinkwrap, and also creates build-tools/DESIGN.md), #983 overlaps (also moves the core submodule pointer), #985 independent (merged core sync), #987 independent (merged), #995 overlaps (its current head pinscoreat the same 2f2b428b this PR bumps to; whichever lands second is a no-op pointer change), #997 overlaps (also touches build-tools/build-pro.sh and the core pointer), #1035 independent (merged Sync Core; supplied the previous core pin this PR moves forward from), #1014 independent (merged backport of #981's bundling change), #998 independent (merged), #1001 independent (merged), #996 independent (merged), #999 independent (merged)Complexity: easy
Review-Coverage: authored=claude; ran=gemini,cursor-composer,codex; adjudicated=domain; declined=cursor-grok,cursor-kimi,cursor-muse; rounds=3; full=2 @ 60a4c80
Review-Attention: skim ~2m (decisions: watch-emit-parity, build-coupled-to-core-path) @ 60a4c80