Skip to content

fix(pack): include library runtime config in entry content hashes - #3429

Merged
fireairforce merged 2 commits into
nextfrom
fix/library-runtime-content-hash
Oct 28, 2026
Merged

fireairforce merged 2 commits into
nextfrom
fix/library-runtime-content-hash

Conversation

@fireairforce

@fireairforce fireairforce commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Changing a library name or export path changes its entry wrapper even when the module factories remain unchanged. Previously, these builds could share a content-hashed URL and serve a stale wrapper from cache.

Include the library runtime configuration in evaluate-chunk content hashes, including entries with no other chunks. Keep non-entry chunk hashing unchanged and avoid hashing the entry's own output path or generated content.

Add a production regression fixture that checks identical-build stability, filename and body changes for library name/export changes, and the actual browser-global exports.

Refresh the four affected library/server-entry snapshot fixtures. The snapshot changes are limited to entry filenames and their references; shared chunks and map/LICENSE contents are unchanged.

Test Plan

Verified on this branch, based on next at 0603a3f639e0cba5a76d87cffb6c8629e2a83d97:

  • cargo fmt --all — passed.
  • cargo clippy --offline --locked --all-targets -- -D warnings --no-deps — passed.
  • Biome CI and spelling checks — passed.
  • git diff --check — passed.
  • Reproduced the original snapshot mismatch, then verified all four affected snapshot tests without UPDATE — passed.
  • Rebuilt pack-napi --features plugin from this branch and ran npm test --workspace @utoo/pack -- src/__test__/libraryContentHash.test.ts — passed.

The full Rust suite is delegated to CI: local loader tests cannot bind localhost sockets in the sandbox. The original CI failure started with the stale multi_server_entries snapshot; its panic poisoned the shared test lock, causing the subsequent PoisonError failures.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 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-28T11:32:16.964709Z 0360829 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_20261028_124248
Generated: 2026-10-28 12:42:48
Trace File: trace_antd.json (0.3GB, 0.84M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 6,952.3 ms Baseline
Total Thread Work (de-duped) 21,278.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,560 All B/E + X events
Meaningful Spans (>= 10us) 232,778 (27.6% of total)
Tracing Noise (< 10us) 611,782 (72.4% 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 51,214 7,138.7 1,975.1 3,471.1
Parse 8,203 1,432.0 1,080.8 6,243.5
Analyze 152,265 47,726.2 9,961.1 6,149.6
Chunk 5,455 5,991.0 795.9 2,445.6
Codegen 12,304 2,596.6 1,563.7 2,104.9
Emit 33 43.6 21.9 8.0
Other 3,304 7,349.8 4,252.8 6,952.3

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 204,185 55,507.0 260.9% 12,213.7 57.4%
P1: I/O & Heavy Tasks 2,894 115.7 0.5% 94.0 0.4%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 24,551 10,036.7 47.2% 3,441.9 16.2%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 1,148 6,618.6 31.1% 3,901.8 18.3%

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
4,973.2 27,918.6 103,273 48.2 0.1 21.4 23.4% module module (63%)
2,722.2 2,844.2 19 143273.6 348.7 617.9 12.8% save snapshot persist (5%)
2,456.2 2,594.1 2,613 940.0 3.1 329.6 11.5% analyze ecmascript module module (67%)
1,659.3 16,118.4 36,413 45.6 0.1 9.3 7.8% process module process module (83%)
1,292.0 3,472.5 27,893 46.3 0.1 4.7 6.1% internal resolving internal resolving (77%)
1,020.5 1,371.7 6,028 169.3 0.6 52.3 4.8% parse ecmascript parse ecmascript (65%)
863.8 951.1 10,020 86.2 0.4 6.7 4.1% precompute code generation generate merged code (42%)
754.9 862.2 7,311 103.3 0.4 124.9 3.5% compute async module info compute async module info (57%)
671.3 3,654.4 22,635 29.7 0.0 4.6 3.2% resolving module (56%)
667.1 5,684.1 4,055 164.5 0.2 36.5 3.1% chunking chunking (52%)
652.2 2,144.4 878 742.9 1.8 237.2 3.1% generate merged code chunking (49%)
455.7 455.7 329 1385.1 1.1 283.7 2.1% generate source map code generation (83%)
378.4 806.2 129 2933.4 6.0 215.2 1.8% emit code generate merged code (41%)
319.8 586.1 1,718 186.2 0.1 163.0 1.5% write all entrypoints to disk write all entrypoints to disk (21%)
244.3 1,189.8 1,955 125.0 0.2 56.0 1.1% code generation code generation (83%)
125.0 125.0 8 15619.6 64.0 71.3 0.6% blocking save snapshot (50%)
124.9 302.6 1,340 93.2 0.2 11.6 0.6% compute async chunks compute async chunks (43%)
61.7 77.4 764 80.8 0.0 29.7 0.3% compute binding usage info compute binding usage info (51%)
60.3 60.3 2,173 27.7 0.0 1.8 0.3% read file parse ecmascript (91%)
41.9 75.1 1,870 22.4 0.0 14.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 668.5 3 persist → save snapshot → blocking
2 455.9 6 chunking → generate merged code → emit code → emit code → emit code → read file
3 334.4 9 module → module → process module → ... → process module → analyze ecmascript module → analyze ecmascript module
4 325.1 4 chunking → generate merged code → emit code → generate source map
5 303.9 2 save snapshot → blocking

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 36,413 process module (83%) 45.6 us 0.07 ms 1,659.3 ms
internal resolving 27,893 internal resolving (77%) 46.3 us 0.10 ms 1,292.0 ms

Duration Distribution

Range Count Percentage
<10us 611,782 72.4%
10us-100us 152,326 18.0%
100us-1ms 68,195 8.1%
1ms-10ms 11,993 1.4%
10ms-100ms 221 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 merged commit 8209b99 into next Oct 28, 2026
48 checks passed
@fireairforce
fireairforce deleted the fix/library-runtime-content-hash branch October 28, 2026 13:41
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