From bb2425e612b2ae4184207672947f40a1bb954883 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Sun, 26 Apr 2026 02:51:26 -0700 Subject: [PATCH] test(plugins): enforce compat removal window --- docs/plugins/compatibility.md | 8 ++++---- src/plugins/compat/registry.test.ts | 12 ++++++++++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/plugins/compatibility.md b/docs/plugins/compatibility.md index 363f1777b17..7e6a641f54a 100644 --- a/docs/plugins/compatibility.md +++ b/docs/plugins/compatibility.md @@ -71,10 +71,10 @@ The migration sequence is: 7. Remove only with explicit breaking-release approval. Deprecated records must include a warning start date, replacement, docs link, -and target removal date no more than three months after deprecation. Do not add -a deprecated compatibility path with an open-ended removal window unless -maintainers explicitly decide it is permanent compatibility and mark it -`active` instead. +and final removal date no more than three months after the warning starts. Do +not add a deprecated compatibility path with an open-ended removal window unless +maintainers explicitly decide it is permanent compatibility and mark it `active` +instead. ## Current compatibility areas diff --git a/src/plugins/compat/registry.test.ts b/src/plugins/compat/registry.test.ts index 88b8112f128..f15b8e439c5 100644 --- a/src/plugins/compat/registry.test.ts +++ b/src/plugins/compat/registry.test.ts @@ -9,6 +9,16 @@ import { const datePattern = /^\d{4}-\d{2}-\d{2}$/u; +function parseDate(date: string): Date { + return new Date(`${date}T00:00:00Z`); +} + +function addUtcMonths(date: Date, months: number): Date { + const next = new Date(date); + next.setUTCMonth(next.getUTCMonth() + months); + return next; +} + describe("plugin compatibility registry", () => { it("keeps compatibility codes unique and lookup-safe", () => { const records = listPluginCompatRecords(); @@ -25,6 +35,8 @@ describe("plugin compatibility registry", () => { expect(record.deprecated, record.code).toMatch(datePattern); expect(record.warningStarts, record.code).toMatch(datePattern); expect(record.removeAfter, record.code).toMatch(datePattern); + const maxRemoveAfter = addUtcMonths(parseDate(record.warningStarts), 3); + expect(parseDate(record.removeAfter) <= maxRemoveAfter, record.code).toBe(true); expect(record.replacement, record.code).toBeTruthy(); expect(record.docsPath, record.code).toMatch(/^\//u); }