fix(javascript)!: preserve property paths and uncertain slot presence

Use one explicit object/array slot model and JSON-pointer property identity across mutation analysis, return projection, and semantic graphs. Require observed presence for discriminants and resolve writes only through retained object or array receivers.

BREAKING CHANGE: projected return fields require explicit presence and semantic object operations carry full property paths.
This commit is contained in:
morluto
2026-10-09 20:18:52 +08:00
parent 63bf91405c
commit 475a0f84da
23 changed files with 831 additions and 560 deletions
@@ -463,7 +463,7 @@ describe("JavaScript export localized mutation uncertainty", () => {
});
describe("JavaScript export property presence boundaries", () => {
it("normalizes omitted legacy presence before comparing identical literals and unions", async () => {
it("rejects return-shape observations that omit required slot presence", async () => {
const source =
'export default () => ({ kind: "result", count: flag ? 1 : 2, nested: { enabled: true } });';
const [left, right] = await analyzeSources({ left: source, right: source });
@@ -513,9 +513,14 @@ describe("JavaScript export property presence boundaries", () => {
[right, { ...left, graph }],
] as const) {
const result = compare(sides[0], sides[1]);
expect(result.coverage.paired_variants).toBe(1);
expect(result.changes).toEqual([]);
expect(result.coverage.status).toBe("complete-within-inputs");
expect(result.coverage.paired_variants).toBe(0);
expect([result.left.status, result.right.status]).toContain(
"unavailable",
);
expect(result.changes).toEqual([
expect.objectContaining({ status: "unknown", path: "" }),
]);
expect(result.coverage.status).toBe("partial");
}
});