Repository navigation
fix(javascript): preserve graphs with async chunk self-references - #1152
Conversation
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Adjacent case this PR doesn't cover yet: a bundled module that requires its own module key fails the same invariant through the static-reference composer ( Repro on this branch (built at "use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[5],{50(e,t,r){r(50)}}]);
I'd opened #1153 for #1146 a few minutes after this one. It covers the async-chunk case and this one, skipping |
N0zoM1z0
left a comment
There was a problem hiding this comment.
Maintainer self-review: only chunk-to-itself composition is omitted; raw AST keys/source ranges, module relationships, sibling edges and unresolved references remain available, with counted limitations propagated to the result. Both base regressions failed; 33 focused tests and the exact public reproduction through built stdio MCP passed. Build/static checks and all 22 exact-head CI checks passed. No blocking findings.
The self-import (#1130), async-chunk (#1152) and static-reference disclosures repeated one sentence template in three composers, and the new test repeated the analyze-and-check sequence of its neighbour. That put jscpd at its 2.5% threshold. Share the template through selfReferenceOmissions with identical wording, and share one test helper for the graph-wide self-reference invariants. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ure (#1157) * fix(javascript): omit self-referential static references with disclosure A bundled module that requires its own key (`r(50)` inside webpack module 50) resolved, through the static-reference composer, to its own module node. The resulting self-referential imports edge failed result validation and lost the entire analysis ("Result schema rejected 1 issue ... (custom)"). This is the same invariant as #1146; #1152 fixed the bundler async-chunk composer, and this is the remaining adjacent composer. Skip a reference whose resolved target is its own source, count it, and disclose the omission the way #1152 discloses async-chunk references. Sibling requires are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]> * refactor(javascript): share the self-reference omission disclosure The self-import (#1130), async-chunk (#1152) and static-reference disclosures repeated one sentence template in three composers, and the new test repeated the analyze-and-check sequence of its neighbour. That put jscpd at its 2.5% threshold. Share the template through selfReferenceOmissions with identical wording, and share one test helper for the graph-wide self-reference invariants. Co-Authored-By: Claude Opus 5.5 <[email protected]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
…ure (morluto#1157) * fix(javascript): omit self-referential static references with disclosure A bundled module that requires its own key (`r(50)` inside webpack module 50) resolved, through the static-reference composer, to its own module node. The resulting self-referential imports edge failed result validation and lost the entire analysis ("Result schema rejected 1 issue ... (custom)"). This is the same invariant as morluto#1146; morluto#1152 fixed the bundler async-chunk composer, and this is the remaining adjacent composer. Skip a reference whose resolved target is its own source, count it, and disclose the omission the way morluto#1152 discloses async-chunk references. Sibling requires are kept. * refactor(javascript): share the self-reference omission disclosure The self-import (morluto#1130), async-chunk (morluto#1152) and static-reference disclosures repeated one sentence template in three composers, and the new test repeated the analyze-and-check sequence of its neighbour. That put jscpd at its 2.5% threshold. Share the template through selfReferenceOmissions with identical wording, and share one test helper for the graph-wide self-reference invariants. ---------
A Webpack or Rspack registration that requests one of its own chunk IDs produced a self-referential chunk edge, causing schema validation to discard the entire application analysis. Omit those unrepresentable edges and disclose their count in graph/result limitations. Preserve the original AST observations, source locations, module relationships, resolved sibling edges and unresolved references.
Fixes #1146
Validation:
npm run test:focused -- tests/boundary/cli/javascriptBundlerSelfReferences.test.ts tests/boundary/cli/javascriptSelfImportRelationships.test.ts tests/composition/javascript-applications/javascriptBundlerAdapters.test.ts tests/boundary/cli/javascriptApplicationJsonOutput.test.ts tests/boundary/cli/javascriptApplicationProgress.test.ts tests/boundary/filesystem/javascriptApplicationWorkflows.test.ts— 33 passed.npm run build:cached,npm run check:fast,git diff --check— passed.No tool-schema or inventory changes. No Hopper/Ghidra runtime changes or real-provider claims for this fix.