Skip to content

feat(pack): centralize root path configuration for worktrees - #3426

Merged
fireairforce merged 2 commits into
nextfrom
zoomdong/pack-root-env
Oct 27, 2026
Merged

fireairforce merged 2 commits into
nextfrom
zoomdong/pack-root-env

Conversation

@fireairforce

@fireairforce fireairforce commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Add UTOO_ROOT_PATH so worktrees can access shared node_modules and linked dependencies outside the project. It overrides explicit rootPath and automatic detection; relative values resolve from the process working directory and empty values are ignored.

Use one resolver for build, serve, and direct project creation. Preserve the public ProjectOptions.rootPath: string type while allowing creation callers to omit it. Config-only updates retain the current root.

Keep findRootDir() independent of the override so framework plugin lookup and generated file locations stay stable, including Smallfish Less plugins/.sml and Umi's explicit utoopack.root.

UTOO_ROOT_PATH=/path/to/common-parent smallfish dev
UTOO_ROOT_PATH=.. utx up dev

Test Plan

  • 30 targeted Vitest tests passed, including seven root creation/update regressions; strict TypeScript compatibility fixture passed.
  • Built @utoo/pack-shared, pack CJS/ESM, and @utoo/pack-cli; formatting and spelling checks passed.
  • Umi 4.7.26: real build/dev with env unset/set, explicit root, symlink dependency, HTTP 200, and Chrome rendering.
  • Smallfish 2.96.20 CLI with React 18: production build and dev/HTTP/Chrome rendering passed with env unset/set, including default PostCSS processing.
  • Smallfish 2.96.19 adapter: real build/dev with env unset/set, multiple entries, Less plugin, HTTP 200, and Chrome rendering; plugin and .sml locations stayed unchanged.
  • An external symlink fails at the default filesystem boundary and builds successfully with a common parent override.

Framework smoke tests use this PR's JavaScript and existing native binaries. Full Smallfish CLI validation uses the packed candidate with its declared runtime dependencies installed in an isolated directory under the consuming project.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T03:43:35.698702Z 8a10d87 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20261027_044150
Generated: 2026-10-27 04:41:50
Trace File: trace_antd.json (0.3GB, 0.84M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 5,475.3 ms Baseline
Total Thread Work (de-duped) 16,738.0 ms Non-overlapping busy time
Effective Parallelism 3.1x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 30.6% ⚠️ Suboptimal
Total Spans 844,436 All B/E + X events
Meaningful Spans (>= 10us) 184,510 (21.9% of total)
Tracing Noise (< 10us) 659,926 (78.1% of total)

Build Phase Timeline

Shows when each build phase is active and how much CPU it consumes.
Self-Time is the time spent exclusively in that phase (excluding children).

Phase Spans Inclusive (ms) Self-Time (ms) Wall Range (ms)
Resolve 38,350 4,865.3 1,309.2 2,448.2
Parse 8,128 1,030.4 766.2 4,629.6
Analyze 122,295 32,418.6 6,827.7 4,568.2
Chunk 4,773 4,628.4 763.1 1,929.1
Codegen 8,902 1,747.0 1,120.6 1,658.2
Emit 29 37.1 18.6 8.2
Other 2,033 7,208.0 4,407.1 5,475.3

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 160,807 37,701.5 225.2% 8,325.7 49.7%
P1: I/O & Heavy Tasks 2,745 91.8 0.5% 73.3 0.4%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 20,216 7,407.7 44.3% 2,642.2 15.8%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 742 6,733.8 40.2% 4,171.2 24.9%

Top 20 Tasks by Self-Time

Self-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
This is the most accurate indicator of where CPU cycles are actually spent.

Self (ms) Inclusive (ms) Count Avg Self (us) P95 Self (ms) Max Self (ms) % Work Task Name Top Caller
3,402.0 19,381.5 82,566 41.2 0.1 8.9 20.3% module module (60%)
3,066.7 3,333.6 16 191666.7 381.1 636.6 18.3% save snapshot persist (6%)
1,654.1 1,736.4 2,225 743.4 2.2 161.4 9.9% analyze ecmascript module module (79%)
1,131.2 10,461.9 29,783 38.0 0.0 5.5 6.8% process module process module (80%)
881.0 2,358.8 20,769 42.4 0.1 7.3 5.3% internal resolving internal resolving (71%)
717.2 981.4 5,959 120.4 0.5 28.4 4.3% parse ecmascript parse ecmascript (66%)
621.8 4,401.3 3,820 162.8 0.1 133.2 3.7% chunking chunking (61%)
618.4 670.5 6,837 90.5 0.4 7.0 3.7% precompute code generation generate merged code (53%)
563.4 680.9 5,672 99.3 0.3 115.1 3.4% compute async module info compute async module info (51%)
519.3 1,669.3 510 1018.3 2.3 213.8 3.1% generate merged code chunking (81%)
422.4 2,500.7 17,034 24.8 0.0 4.7 2.5% resolving module (64%)
349.5 349.5 329 1062.3 0.8 213.3 2.1% generate source map code generation (83%)
293.5 621.8 132 2223.8 3.7 179.3 1.8% emit code generate merged code (40%)
269.9 269.9 9 29992.3 138.8 170.1 1.6% blocking save snapshot (56%)
227.7 411.2 930 244.8 0.1 135.7 1.4% write all entrypoints to disk write all entrypoints to disk (8%)
152.6 727.0 1,736 87.9 0.2 34.6 0.9% code generation code generation (82%)
139.1 224.4 919 151.3 0.4 22.6 0.8% compute async chunks compute async chunks (52%)
49.0 49.0 2,167 22.6 0.0 1.7 0.3% read file parse ecmascript (91%)
41.3 50.8 582 70.9 0.0 24.4 0.2% compute binding usage info compute binding usage info (59%)
25.3 49.2 1,450 17.4 0.0 9.5 0.2% collect mergeable modules collect mergeable modules (100%)

Critical Path Analysis

The longest sequential dependency chains that determine wall-clock time.
Focus on reducing the depth of these chains to improve parallelism.

Rank Self-Time (ms) Depth Path
1 806.6 3 persist → save snapshot → blocking
2 395.8 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 260.4 2 save snapshot → blocking
4 247.5 4 chunking → generate merged code → emit code → generate source map
5 161.5 3 process module → process module → analyze ecmascript module

Batching Candidates

High-volume tasks dominated by a single parent. If the parent can batch them,
it drastically reduces scheduler overhead.

Task Name Count Top Caller (Attribution) Avg Self P95 Self Total Self
process module 29,783 process module (80%) 38.0 us 0.05 ms 1,131.2 ms
internal resolving 20,769 internal resolving (71%) 42.4 us 0.06 ms 881.0 ms

Duration Distribution

Range Count Percentage
<10us 659,926 78.1%
10us-100us 116,789 13.8%
100us-1ms 59,799 7.1%
1ms-10ms 7,744 0.9%
10ms-100ms 135 0.0%
>100ms 43 0.0%

Action Items

  1. [P0] Focus on tasks with the highest Self-Time — these are where CPU cycles are actually spent.
  2. [P0] Use Batching Candidates to identify callers that should use try_join or reduce #[turbo_tasks::function] granularity.
  3. [P1] Check Build Phase Timeline for phases with disproportionate wall range vs. self-time (= serialization).
  4. [P1] Inspect P95 Self (ms) for heavy monolith tasks. Focus on long-tail outliers, not averages.
  5. [P1] Review Critical Paths — reducing the longest chain depth directly improves wall-clock time.
  6. [P2] If Thread Utilization < 60%, investigate scheduling gaps (lock contention or deep dependency chains).

Report generated by Utoopack Performance Analysis Agent

@fireairforce
fireairforce enabled auto-merge (squash) October 27, 2026 06:34
@fireairforce
fireairforce merged commit 61dbaa1 into next Oct 27, 2026
66 of 80 checks passed
@fireairforce
fireairforce deleted the zoomdong/pack-root-env branch October 27, 2026 08:26
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