mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
2a3bf9ae21
### What? Makes Turbopack import tracing recognize the module graph's explicit entries as roots, including when an entry participates in an import cycle. Adds focused graph-level coverage and a Next.js production fixture that exercises issue formatting through a cyclic graph. If a malformed graph still has no path to any explicit entry, tracing now returns a minimal trace and emits a bug-severity issue instead of panicking. ### Why? The import tracer inferred roots from nodes with no incoming edges. A valid cycle that points back to an entry gives every node an incoming edge, so the tracer could not find a root and panicked while formatting another diagnostic. The graph already records its entries explicitly, making them the authoritative and cycle-safe definition of a root. The same topology-based assumption affected entry membership checks, so those now use the explicit entry list as well. ### How? - Resolve import-trace paths against node indices derived from `GraphEntries`. - Preserve a defensive fallback for malformed graphs and classify that invariant violation as an implementation bug. - Cover cyclic entry paths, malformed rootless graphs, absent paths, and the product-level issue-formatting path. Fixes #98205 <!-- NEXT_JS_LLM --> <!-- fleet 25b26044-3397-4642-a77f-c565b7577046 --> --------- Co-authored-by: vercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com> Co-authored-by: Tobias Koppers <1365881+sokra@users.noreply.github.com>