mirror of
https://github.com/morluto/rea.git
synced 2026-11-03 05:16:16 +00:00
feat(javascript): report observed export property presence (#1160)
* feat(javascript): report observed export property presence Extend compare_javascript_export_shapes so each retained return variant lists observed property names and each change reports presence independently of value resolution. Complete parent coverage classifies one-sided names as added or removed even when static values stay unknown. Fixes #725 * test(javascript): match unknown export-shape values by availability Nested availability objects include a reason when values stay unresolved. Assert availability through objectContaining so presence-only added and removed rows still verify unknown values. * fix(javascript): preserve uncertain export property presence and locations * fix(javascript): normalize presence and preserve local property coverage * fix(javascript): require present discriminants for return pairing * fix(javascript): normalize retained shapes before comparison * refactor(javascript): share return projection with executable examples * fix(javascript): localize uncertainty for missing mutated slots * fix(javascript): bind advertised export examples to exact artifacts * fix(javascript): keep uncertain property flow as candidates --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
1 parent
04aef6df33
commit
45e3edc17f
25 files changed
+1552
-113
No files matched your search
@@ -10,6 +10,9 @@ import {
|
||||
import { compareCodePoints } from "../canonicalOrdering.js";
|
||||
|
||||
type Shape = ProjectedExportReturnShapes["static_return_shapes"][number];
|
||||
type Field = Shape["fields"][number];
|
||||
type NormalizedField = Field & { presence: NonNullable<Field["presence"]> };
|
||||
type NormalizedShape = Omit<Shape, "fields"> & { fields: NormalizedField[] };
|
||||
type SelectorResult = JavaScriptExportShapeComparisonResult["left"];
|
||||
type SelectorBase = Omit<SelectorResult, "status" | "selected_node_id">;
|
||||
type ReturnShapeSelection =
|
||||
@@ -55,7 +58,7 @@ export type SelectedJavaScriptExport =
|
||||
|
||||
/** Complete return-shape inventory retained from an authenticated projection. */
|
||||
export interface RetainedJavaScriptExportShapes {
|
||||
readonly shapes: readonly Shape[];
|
||||
readonly shapes: readonly NormalizedShape[];
|
||||
readonly omitted: number;
|
||||
}
|
||||
|
||||
@@ -126,11 +129,22 @@ export const selectJavaScriptExport = (
|
||||
};
|
||||
};
|
||||
|
||||
/** Retain every projected return variant. */
|
||||
/** Retain every variant and normalize legacy presence on comparison-owned copies. */
|
||||
export const retainJavaScriptExportShapes = (
|
||||
selection: SelectedJavaScriptExport,
|
||||
): RetainedJavaScriptExportShapes => {
|
||||
const shapes = selection.projection?.static_return_shapes ?? [];
|
||||
const shapes = (
|
||||
selection.projection?.static_return_shapes ?? []
|
||||
).map<NormalizedShape>((shape) => ({
|
||||
...shape,
|
||||
fields: shape.fields.map<NormalizedField>((field) => ({
|
||||
...field,
|
||||
// Legacy unknown fields did not distinguish values from uncertain slots.
|
||||
presence:
|
||||
field.presence ??
|
||||
(field.state === "unknown" ? "unknown-coverage" : "present"),
|
||||
})),
|
||||
}));
|
||||
return { shapes, omitted: 0 };
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user