From 254f90a4081a3f15dfe54277da922579dbaee254 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Sat, 5 Sep 2026 17:33:06 +0900 Subject: feat(layout): plan 04 — ABI layout.applyOps + reset affordance MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/plugin-abi/version.test.ts | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'src/core/plugin-abi/version.test.ts') diff --git a/src/core/plugin-abi/version.test.ts b/src/core/plugin-abi/version.test.ts index 2620847..ab4d34b 100644 --- a/src/core/plugin-abi/version.test.ts +++ b/src/core/plugin-abi/version.test.ts @@ -2,21 +2,26 @@ import { describe, expect, it } from "vitest"; import { FRONTEND_ABI_VERSION, isFrontendCompatible } from "./version.js"; describe("FRONTEND_ABI_VERSION", () => { - it("is 1 (plan 03)", () => { - expect(FRONTEND_ABI_VERSION).toBe("1"); + it("is 1.1 (plan 04 — the additive layout member bumped the minor)", () => { + expect(FRONTEND_ABI_VERSION).toBe("1.1"); }); }); -describe("isFrontendCompatible — handshake accept/reject matrix", () => { - it("accepts the canonical authoring range ^1", () => { +describe("isFrontendCompatible — handshake accept/reject matrix (host 1.1.0)", () => { + it("accepts the canonical authoring range ^1 (v1 plugins keep working — the plan-04 promise)", () => { expect(isFrontendCompatible("^1")).toBe(true); expect(isFrontendCompatible("^1.0")).toBe(true); expect(isFrontendCompatible("^1.0.0")).toBe(true); }); - it("accepts the bare major version and exact matches", () => { + it("accepts the bare major version (a major-compatibility claim: additive bumps never strand it)", () => { expect(isFrontendCompatible("1")).toBe(true); - expect(isFrontendCompatible("1.0.0")).toBe(true); + expect(isFrontendCompatible("~1")).toBe(true); + }); + + it("accepts plugins that REQUIRE the 1.1 ABI (^1.1 — the layout-declaring grammar)", () => { + expect(isFrontendCompatible("^1.1")).toBe(true); + expect(isFrontendCompatible("^1.1.0")).toBe(true); }); it("accepts wildcard and >= ranges", () => { @@ -34,9 +39,11 @@ describe("isFrontendCompatible — handshake accept/reject matrix", () => { expect(isFrontendCompatible("^0.1.0")).toBe(false); }); - it("rejects a tilde range of an older minor", () => { + it("rejects a tilde/pin at an OLDER explicit minor (explicit pins reject additive bumps)", () => { expect(isFrontendCompatible("~0.9.0")).toBe(false); - expect(isFrontendCompatible("~1.0.0")).toBe(true); + expect(isFrontendCompatible("~1.0.0")).toBe(false); + expect(isFrontendCompatible("1.0.0")).toBe(false); + expect(isFrontendCompatible("^1.0")).not.toBe(false); // caret 1.x tracks the major }); it("rejects malformed ranges (fail closed, never throws)", () => { @@ -46,9 +53,13 @@ describe("isFrontendCompatible — handshake accept/reject matrix", () => { expect(isFrontendCompatible("1.0.0.0")).toBe(false); }); - it("rejects a future patch-level host (the host version pins the answer)", () => { - // The host version defaults to "1.0.0"; "~1.0.0" includes it. - expect(isFrontendCompatible("~1.0.0", "1.0.0")).toBe(true); + it("the host version pins the answer (injectable for tests)", () => { + // At a hypothetical 1.0.0 host, ^1.1 (needing the layout member) excludes; + // at 1.1.0 it includes — the gate is real, not decorative. + expect(isFrontendCompatible("^1.1", "1.0.0")).toBe(false); + expect(isFrontendCompatible("^1.1", "1.1.0")).toBe(true); + // "~1.0.0" pins minor 0: excludes a 1.1.0 host, includes a 1.0.x host. expect(isFrontendCompatible("~1.0.0", "1.1.0")).toBe(false); + expect(isFrontendCompatible("~1.0.0", "1.0.0")).toBe(true); }); }); -- cgit v1.2.3