mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:00:43 +00:00
test(plugins): enforce compat removal window
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user