test(plugins): enforce compat removal window · openclaw/openclaw@bb2425e
vincentkoc
·
2026-04-26
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -71,10 +71,10 @@ The migration sequence is:
|
71 | 71 | 7. Remove only with explicit breaking-release approval. |
72 | 72 | |
73 | 73 | Deprecated records must include a warning start date, replacement, docs link, |
74 | | -and target removal date no more than three months after deprecation. Do not add |
75 | | -a deprecated compatibility path with an open-ended removal window unless |
76 | | -maintainers explicitly decide it is permanent compatibility and mark it |
77 | | -`active` instead. |
| 74 | +and final removal date no more than three months after the warning starts. Do |
| 75 | +not add a deprecated compatibility path with an open-ended removal window unless |
| 76 | +maintainers explicitly decide it is permanent compatibility and mark it `active` |
| 77 | +instead. |
78 | 78 | |
79 | 79 | ## Current compatibility areas |
80 | 80 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,6 +9,16 @@ import {
|
9 | 9 | |
10 | 10 | const datePattern = /^\d{4}-\d{2}-\d{2}$/u; |
11 | 11 | |
| 12 | +function parseDate(date: string): Date { |
| 13 | +return new Date(`${date}T00:00:00Z`); |
| 14 | +} |
| 15 | + |
| 16 | +function addUtcMonths(date: Date, months: number): Date { |
| 17 | +const next = new Date(date); |
| 18 | +next.setUTCMonth(next.getUTCMonth() + months); |
| 19 | +return next; |
| 20 | +} |
| 21 | + |
12 | 22 | describe("plugin compatibility registry", () => { |
13 | 23 | it("keeps compatibility codes unique and lookup-safe", () => { |
14 | 24 | const records = listPluginCompatRecords(); |
@@ -25,6 +35,8 @@ describe("plugin compatibility registry", () => {
|
25 | 35 | expect(record.deprecated, record.code).toMatch(datePattern); |
26 | 36 | expect(record.warningStarts, record.code).toMatch(datePattern); |
27 | 37 | expect(record.removeAfter, record.code).toMatch(datePattern); |
| 38 | +const maxRemoveAfter = addUtcMonths(parseDate(record.warningStarts), 3); |
| 39 | +expect(parseDate(record.removeAfter) <= maxRemoveAfter, record.code).toBe(true); |
28 | 40 | expect(record.replacement, record.code).toBeTruthy(); |
29 | 41 | expect(record.docsPath, record.code).toMatch(/^\//u); |
30 | 42 | } |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。