Repository navigation
fix(build-tree): exclude node_modules at any depth (#764) - #769
Conversation
skip() ran only for top-level names, so a custom widget's nested widgets/<W>/node_modules (1.2 GB in the field) was copied into .mxtk/build/model/ on every full build; one exec stalled 13+ minutes. node_modules is now skipped at any depth; below the top it is not in `want`, so the existing deletion pass removes a stale copy on the next sync. The other excluded names stay top-level only (a widget may hold its own docs/ or deployment/). test-build-tree.sh B4c: fresh sync and stale-copy removal; 58/2 on master's build-tree.py, 60/0 on this branch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
…769) JavaScript actions' npm dependencies live in javascriptsource/<m>/**/node_modules and mxbuild bundles them; the any-depth exclusion dropped them, so a gate build in the copy could fail on a healthy model. That one top-level tree now keeps its node_modules. B4c adds a copy + resync check (2 FAIL on the previous head, 62/62 now). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HXpQSjXefSNicGGqP4aiSC
|
Review: MERGE-AFTER-FIX: excluding Value: fixes #764 as reported. Regression risk: Mendix keeps JavaScript action npm dependencies inside the model tree, under
Correctness: apart from the above, the logic is right. B4c tests what it claims, and a directory fixture is acceptable here because there is no tool output to capture. But no case covers a Context cost: 66,196 → 66,196 (no routed file touched). Time cost: none added per row; the copy only gets smaller. Exact fixes required:
Generated by Claude Code |
|
Both fixes from the review are pushed in 1778580. New B4c checks: This needs a re-review before merge. Generated by Claude Code |
|
Review: MERGE. Re-review: both earlier fixes landed and are correct. Value: Fixes #764 as reported.
Regression risk:
Correctness: Fix 2 landed.
Context cost: 66196 → 66196 always-loaded words, measured with Time cost: per exec, the copy only gets smaller, except under Generated by Claude Code |
Fixes #764
Direct lane
What changed and why (one paragraph):
project-bin/build-tree.pyappliedskip()only to top-level names (if top and skip(e.name)). SoEXCLUDE'snode_moduleswas dropped at the project root and nowhere else. A custom pluggable widget's source folder with its ownnode_modules(1.2 GB in the field) was copied into.mxtk/build/model/on every full build, and one exec stalled for 13+ minutes.The fix adds
EXCLUDE_ANY_DEPTH = {"node_modules"}, which is skipped at every level. Below the top level, a skipped name is not inwant, so the existing deletion pass insync_dirremoves a nestednode_modulesthat an older copy already holds. No separate cleanup is needed.The other excluded names (
deployment,docs,sources,.mxcli,.mxtk,.mpr-snapshots, the VCS folders,*.mpr.lock,MXTK_BUILD_TREE_EXCLUDE) stay top-level only, as before. They are root-level toolkit or project-output state, and a widget may legitimately hold its owndocs/ordeployment/. The top-level deletion guard, which keeps the copy's owndeployment/, is unchanged. The docstring states the rule and its reason.Impact
project-bin/build-tree.pyonly (installed viainstall-manifest.sh, picked up bysync-project.sh). No shared lib touched, no new reads, no new tools. Python 3 stdlib, as beforenode_modules. Measured on a synthetic model with a 4.9 MB nestedwidgets/W/node_modules(400 files), on a 4-core Linux container: first sync 135 ms → 31 ms, resync 37 ms → 24 ms. At field scale (1.2 GB) this was minutes per exec.Time cost: per exec · −0.1 s at 5 MB nested node_modules (Linux container, 4 cores); minutes at the field's 1.2 GB · can force rework: n · offset: removes copying nested node_modulesFixture result (
bash tests/wave2/test-build-tree.sh <project-bin>):build-tree.py(the rest ofproject-bin/from this branch):PASS=58 FAIL=2. The two failures areB4c widgets/W/node_modules was copiedandB4c a stale nested node_modules lingers in the copy.PASS=60 FAIL=0.The new case B4c checks that:
widgets/W/src/W.tsxis copied andwidgets/W/node_modulesis not;docs/(a top-level-only name) is still copied;widgets/W/node_modulesplanted in the copy is removed on the next sync, while the widget sources stay.Other checks:
bin/check-scripts.sh: 137/137 shell, 30/30 Node.bin/check-portability.sh: clean, 390 files.LEAKGUARD_ALLOW_NO_DENYLIST=1 LEAKGUARD_BASE=origin/master): clean.Field evidence: a Greenfield build in auto mode (Mendix 11.15.0, toolkit ff26aa1, 2026-11-13). A nested widget
node_modulesof 1.2 GB was copied on every exec; the first baseline step took 870 s, and one exec stalled for 13+ minutes. The builder patched it locally. This branch has not been run on that project. It is verified by the fixture and the synthetic timing above.test-build-tree.shfixture, failing on master and passing here). T2 is the relayed field report, not a re-run of this branchsync_dirrecurses from the model directory, so single-tree and two-tree behave the same, and B3 still covers two-tree. It uses onlyos.scandir, with no platform-specific callsCHANGELOG.mdline appended, crediting a Greenfield field run (2026-11-13)Review: pending independent review
Generated by Claude Code