mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 14:59:05 +00:00
refactor(javascript): share unknown export comparison rows (#17015)
This commit is contained in:
1 parent
aeb4ba4f55
commit
25c3b3b48c
1 file changed
+24
-30
@@ -100,9 +100,19 @@ export const buildJavaScriptExportShapeChanges = (
|
||||
input.leftSelection.selection.status !== "selected" ||
|
||||
input.rightSelection.selection.status !== "selected"
|
||||
)
|
||||
return [selectionUnknownChange(input)];
|
||||
return unknownExportChanges(
|
||||
selectionAvailability(input.leftSelection.selection, "left"),
|
||||
selectionAvailability(input.rightSelection.selection, "right"),
|
||||
input.evidenceLinks,
|
||||
"Both selectors must resolve one exact export with trusted static return shapes before comparison.",
|
||||
);
|
||||
if (input.leftShapes.length === 0 && input.rightShapes.length === 0)
|
||||
return [emptyShapeUnknownChange(input)];
|
||||
return unknownExportChanges(
|
||||
emptyShapeAvailability(input.leftShapes, "left"),
|
||||
emptyShapeAvailability(input.rightShapes, "right"),
|
||||
input.evidenceLinks,
|
||||
"At least one selected export has no retained direct return shape.",
|
||||
);
|
||||
const paired = input.pairing.pairs.flatMap((pair) => {
|
||||
const left = input.leftShapes[pair.leftIndex];
|
||||
const right = input.rightShapes[pair.rightIndex];
|
||||
@@ -260,41 +270,25 @@ const compareDiscriminants = (
|
||||
canonicalJson(right, "JavaScript export shape comparison"),
|
||||
);
|
||||
|
||||
const selectionUnknownChange = (
|
||||
input: ChangeBuildInput,
|
||||
): JavaScriptExportShapeComparisonChange =>
|
||||
const unknownExportChanges = (
|
||||
left: ValueAvailability,
|
||||
right: ValueAvailability,
|
||||
evidenceLinks: [string, string],
|
||||
limitation: string,
|
||||
): JavaScriptExportShapeComparisonChange[] => [
|
||||
changeWithId({
|
||||
status: "unknown",
|
||||
path: "",
|
||||
discriminant: null,
|
||||
presence: UNKNOWN_COVERAGE_PRESENCE,
|
||||
left: selectionAvailability(input.leftSelection.selection, "left"),
|
||||
right: selectionAvailability(input.rightSelection.selection, "right"),
|
||||
left,
|
||||
right,
|
||||
left_source_range: null,
|
||||
right_source_range: null,
|
||||
evidence_links: input.evidenceLinks,
|
||||
limitations: [
|
||||
"Both selectors must resolve one exact export with trusted static return shapes before comparison.",
|
||||
],
|
||||
});
|
||||
|
||||
const emptyShapeUnknownChange = (
|
||||
input: ChangeBuildInput,
|
||||
): JavaScriptExportShapeComparisonChange =>
|
||||
changeWithId({
|
||||
status: "unknown",
|
||||
path: "",
|
||||
discriminant: null,
|
||||
presence: UNKNOWN_COVERAGE_PRESENCE,
|
||||
left: emptyShapeAvailability(input.leftShapes, "left"),
|
||||
right: emptyShapeAvailability(input.rightShapes, "right"),
|
||||
left_source_range: null,
|
||||
right_source_range: null,
|
||||
evidence_links: input.evidenceLinks,
|
||||
limitations: [
|
||||
"At least one selected export has no retained direct return shape.",
|
||||
],
|
||||
});
|
||||
evidence_links: evidenceLinks,
|
||||
limitations: [limitation],
|
||||
}),
|
||||
];
|
||||
|
||||
const diffPair = (
|
||||
left: Shape,
|
||||
|
||||
Reference in new issue
Block a user