mirror of
https://github.com/morluto/rea.git
synced 2026-10-12 02:19:24 +00:00
fix(javascript): omit self-referential static references with disclosure (#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]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
58a91f03d7
commit
b620e2a2bd
@@ -7,6 +7,7 @@ import {
|
||||
chunkLookupKey,
|
||||
javascriptAnalysisCoverage,
|
||||
moduleLookupKey,
|
||||
selfReferenceOmissions,
|
||||
type JavaScriptArtifactGraphContext,
|
||||
type JavaScriptArtifactGraphCoverage,
|
||||
} from "./JavaScriptArtifactGraphContext.js";
|
||||
@@ -53,11 +54,11 @@ export const addJavaScriptBundlerNodes = (
|
||||
for (const record of records)
|
||||
selfAsyncChunks += addBundlerRuntimeEdges(context, record);
|
||||
}
|
||||
return selfAsyncChunks === 0
|
||||
? []
|
||||
: [
|
||||
`${String(selfAsyncChunks)} bundler async-chunk ${selfAsyncChunks === 1 ? "reference" : "references"} resolved back to the requesting chunk itself and ${selfAsyncChunks === 1 ? "was" : "were"} omitted; application graph edges cannot be self-referential.`,
|
||||
];
|
||||
return selfReferenceOmissions(
|
||||
selfAsyncChunks,
|
||||
["bundler async-chunk reference", "bundler async-chunk references"],
|
||||
"the requesting chunk",
|
||||
);
|
||||
};
|
||||
|
||||
interface BundlerProjectionInput {
|
||||
|
||||
Reference in New Issue
Block a user