Skip to content

fix: normalize visited module IDs in dev graph traversal - #17935

Open
rwv wants to merge 1 commit into
withastro:mainfrom
rwv:codex/fix-crawlgraph-wrapped-ids
Open

fix: normalize visited module IDs in dev graph traversal#17935
rwv wants to merge 1 commit into
withastro:mainfrom
rwv:codex/fix-crawlgraph-wrapped-ids

Conversation

@rwv

@rwv rwv commented Sep 8, 2026

Copy link
Copy Markdown

Changes

Fixes #17934.

crawlGraph() records unwrapped module IDs in its visited set but checks recursive imports using their original IDs. A wrapped reference to an already visited module can therefore bypass deduplication and, for a normalized cycle, recurse back into the same module indefinitely.

Normalize the visited-set lookup with the existing unwrapId() helper. Keep the yielded module and its ID unchanged. Includes an astro patch changeset.

The standalone reproduction runs against published Astro 7.3.1. It deliberately models the mixed-ID module graph; it is not an application-level reproduction of a confirmed Vue regression. Ordinary Vite resolution may normalize these IDs before the crawler sees them. See the issue for the downstream patch's history and the limits of the reproduction.

Testing

  • Added four bounded unit tests covering wrapped and unwrapped cycles, shared-dependency deduplication, and preserving an unseen wrapped ID while traversing its unwrapped module. The two regression cases fail before the fix; all four pass afterward.
  • Verified the standalone reproduction fails on unpatched npm astro@7.3.1 and passes with the same one-line fix.
  • pnpm build:ci — passed (27 tasks).
  • pnpm exec turbo run build --filter=@astrojs/check... — passed (14 tasks, including the Astro package build, TypeScript build, and component diagnostics).
  • pnpm format — passed.
  • pnpm lint:ai — passed (one existing Biome warning in a language-server fixture).
  • pnpm -C packages/astro exec astro-scripts test 'test/units/vite-plugin-astro-server/*.test.ts' --strip-types — 11 passed.
  • pnpm -C packages/astro exec astro-scripts test 'test/{vite-virtual-modules,0-css,css-dynamic-import-dev,css-order,partials-css-boundary}.test.ts' --strip-types — 46 passed, 1 skipped.
  • pnpm exec tsc --noEmit --module nodenext --moduleResolution nodenext --target es2022 --skipLibCheck --ignoreConfig packages/astro/test/units/vite-plugin-astro-server/vite.test.ts — passed.

Docs

No public API or configuration changes. The patch changeset describes the internal development-server fix.

@changeset-bot

changeset-bot Bot commented Sep 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2bf3daa

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added the pkg: astro Related to the core `astro` package (scope) label Sep 8, 2026
@codspeed-hq

codspeed-hq Bot commented Sep 8, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 14.8%

❌ 1 regressed benchmark
✅ 20 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
many-components (markHTMLString, isHTMLString, validateProps) 9.6 ms 11.3 ms -14.8%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing rwv:codex/fix-crawlgraph-wrapped-ids (2bf3daa) with main (0389640)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (9870f95) during the generation of this report, so 0389640 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: astro Related to the core `astro` package (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

crawlGraph revisits wrapped module IDs after visiting their unwrapped IDs

1 participant