Skip to content

fix(pack): honor externals for virtual requests - #3428

Merged
fireairforce merged 2 commits into
nextfrom
zoomdong/fix-virtual-externals
Oct 27, 2026
Merged

fireairforce merged 2 commits into
nextfrom
zoomdong/fix-virtual-externals

Conversation

@fireairforce

@fireairforce fireairforce commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Summary

Explicit externals for URI requests such as virtual:request/h5 were skipped by the module-name filter. With an alias, the target was bundled alongside the direct external import, splitting mutable state between two instances. Without an alias, the original URI was loaded instead of the configured external target.

Match complete, literal request names before alias resolution so these imports use the configured external instance. Add executable Node regressions for alias plus externals, externals only, unscoped package subpaths, and literal glob characters.

Closes #3427.

CI pins Ubuntu 24.04 and the tested ecosystem harness revision from utooland/utoo-ecosystem-ci#10. This restores the supported environment after ubuntu-latest moved to Ubuntu 26.04, which broke the wasm-bindgen installer and EVJS Playwright browser installation before the candidate tests ran.

Test Plan

  • cargo test --locked -p pack-tests --test snapshot externals
  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings --no-deps
  • npx tombi format --check, npx biome ci, and typos
  • Actionlint for both modified workflows; ecosystem harness tests (45 passed), lint, and workflow policy checks

@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-27T09:19:07.382430Z 850ef7f 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_100047
Generated: 2026-10-27 10:00:47
Trace File: trace_antd.json (0.3GB, 0.84M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 5,849.7 ms Baseline
Total Thread Work (de-duped) 17,993.6 ms Non-overlapping busy time
Effective Parallelism 3.1x thread_work / wall_time
Working Threads 10 Threads with actual spans
Thread Utilization 30.8% ⚠️ Suboptimal
Total Spans 844,069 All B/E + X events
Meaningful Spans (>= 10us) 183,084 (21.7% of total)
Tracing Noise (< 10us) 660,985 (78.3% 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 37,765 5,515.7 1,451.7 2,727.4
Parse 8,148 1,174.5 871.4 4,963.5
Analyze 122,190 35,918.4 7,674.2 4,888.2
Chunk 4,773 4,615.0 763.4 1,964.9
Codegen 8,054 1,771.5 1,142.9 1,703.5
Emit 29 36.3 18.2 7.8
Other 2,125 7,416.3 4,544.3 5,849.7

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 160,218 41,909.1 232.9% 9,329.8 51.9%
P1: I/O & Heavy Tasks 2,602 104.7 0.6% 86.6 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 19,436 7,565.3 42.0% 2,769.6 15.4%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 828 6,868.5 38.2% 4,280.1 23.8%

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,684.2 21,246.5 82,524 44.6 0.1 14.5 20.5% module module (60%)
3,252.0 3,400.7 18 180665.1 373.2 701.7 18.1% save snapshot persist (6%)
2,034.0 2,169.4 2,280 892.1 3.0 209.3 11.3% analyze ecmascript module module (76%)
1,306.7 11,661.9 29,718 44.0 0.1 11.1 7.3% process module process module (81%)
986.4 2,725.2 20,937 47.1 0.1 6.0 5.5% internal resolving internal resolving (71%)
814.4 1,117.5 5,975 136.3 0.5 58.7 4.5% parse ecmascript parse ecmascript (66%)
675.3 4,395.4 3,873 174.4 0.1 151.8 3.8% chunking chunking (46%)
618.9 679.9 5,985 103.4 0.4 7.0 3.4% precompute code generation generate merged code (54%)
565.1 671.9 5,630 100.4 0.3 99.5 3.1% compute async module info compute async module info (50%)
539.2 1,765.0 598 901.7 2.1 175.7 3.0% generate merged code chunking (76%)
453.9 2,779.1 16,428 27.6 0.0 5.1 2.5% resolving module (62%)
374.4 374.4 329 1138.0 0.7 225.1 2.1% generate source map code generation (83%)
314.8 678.3 129 2440.4 4.0 188.1 1.7% emit code generate merged code (41%)
247.1 449.9 974 253.7 0.1 137.7 1.4% write all entrypoints to disk write all entrypoints to disk (10%)
149.6 717.2 1,740 86.0 0.2 39.3 0.8% code generation code generation (83%)
149.5 149.5 8 18685.0 67.8 82.1 0.8% blocking save snapshot (75%)
85.7 216.6 868 98.7 0.2 9.2 0.5% compute async chunks compute async chunks (55%)
57.0 57.0 2,170 26.3 0.0 7.1 0.3% read file parse ecmascript (91%)
49.0 61.3 634 77.2 0.0 26.2 0.3% compute binding usage info compute binding usage info (56%)
24.3 48.0 1,387 17.5 0.0 9.3 0.1% 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 783.8 3 persist → save snapshot → blocking
2 366.7 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 260.4 4 chunking → generate merged code → emit code → generate source map
4 245.7 2 save snapshot → blocking
5 209.4 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,718 process module (81%) 44.0 us 0.05 ms 1,306.7 ms
internal resolving 20,937 internal resolving (71%) 47.1 us 0.07 ms 986.4 ms

Duration Distribution

Range Count Percentage
<10us 660,985 78.3%
10us-100us 115,443 13.7%
100us-1ms 58,379 6.9%
1ms-10ms 9,033 1.1%
10ms-100ms 191 0.0%
>100ms 38 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

@PeachScript PeachScript left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@fireairforce
fireairforce merged commit 0603a3f into next Oct 27, 2026
71 of 81 checks passed
@fireairforce
fireairforce deleted the zoomdong/fix-virtual-externals branch October 27, 2026 11:21
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.

SSR: alias and externals produce duplicate module instances for virtual imports

2 participants