summaryrefslogtreecommitdiffhomepage
path: root/src/core/plugin-abi/version.test.ts
diff options
context:
space:
mode:
authorAdam Malczewski <[email protected]>2026-09-05 17:33:06 +0900
committerAdam Malczewski <[email protected]>2026-09-05 17:33:06 +0900
commit254f90a4081a3f15dfe54277da922579dbaee254 (patch)
treef5f4e409196109baf938cd9d557e244242df18ce /src/core/plugin-abi/version.test.ts
parent535215bfd1fee6087613108f42d28cd2807184d3 (diff)
downloaddispatch-web-254f90a4081a3f15dfe54277da922579dbaee254.tar.gz
dispatch-web-254f90a4081a3f15dfe54277da922579dbaee254.zip
feat(layout): plan 04 — ABI layout.applyOps + reset affordance
Diffstat (limited to 'src/core/plugin-abi/version.test.ts')
-rw-r--r--src/core/plugin-abi/version.test.ts33
1 files changed, 22 insertions, 11 deletions
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);
});
});