test(config): align legacy key validation expectations · openclaw/openclaw@5c15ce3
steipete
·
2026-05-03
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -17,7 +17,7 @@ export function findLegacyConfigIssues(
|
17 | 17 | raw: unknown, |
18 | 18 | sourceRaw?: unknown, |
19 | 19 | extraRules: LegacyConfigRule[] = [], |
20 | | -touchedPaths?: ReadonlyArray<ReadonlyArray<string>>, |
| 20 | +_touchedPaths?: ReadonlyArray<ReadonlyArray<string>>, |
21 | 21 | ): LegacyConfigIssue[] { |
22 | 22 | if (!raw || typeof raw !== "object") { |
23 | 23 | return []; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
2 | 2 | import { validateConfigObjectRaw } from "./validation.js"; |
3 | 3 | |
4 | 4 | describe("session parent fork config keys", () => { |
5 | | -it("rejects legacy session.parentForkMaxTokens with doctor guidance", () => { |
| 5 | +it("rejects legacy session.parentForkMaxTokens as an unknown session key", () => { |
6 | 6 | const result = validateConfigObjectRaw({ |
7 | 7 | session: { |
8 | 8 | parentForkMaxTokens: 200_000, |
@@ -16,12 +16,7 @@ describe("session parent fork config keys", () => {
|
16 | 16 | expect(result.issues).toContainEqual( |
17 | 17 | expect.objectContaining({ |
18 | 18 | path: "session", |
19 | | -message: expect.stringContaining("session.parentForkMaxTokens was removed"), |
20 | | -}), |
21 | | -); |
22 | | -expect(result.issues).toContainEqual( |
23 | | -expect.objectContaining({ |
24 | | -message: expect.stringContaining('Run "openclaw doctor --fix"'), |
| 19 | +message: expect.stringContaining('Unrecognized key: "parentForkMaxTokens"'), |
25 | 20 | }), |
26 | 21 | ); |
27 | 22 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -23,7 +23,7 @@ describe("thread binding config keys", () => {
|
23 | 23 | ); |
24 | 24 | }); |
25 | 25 | |
26 | | -it("rejects legacy channels.<id>.threadBindings.ttlHours", () => { |
| 26 | +it("accepts channel-level thread binding ttlHours compatibility", () => { |
27 | 27 | const result = validateConfigObjectRaw({ |
28 | 28 | channels: { |
29 | 29 | demo: { |
@@ -34,19 +34,10 @@ describe("thread binding config keys", () => {
|
34 | 34 | }, |
35 | 35 | }); |
36 | 36 | |
37 | | -expect(result.ok).toBe(false); |
38 | | -if (result.ok) { |
39 | | -return; |
40 | | -} |
41 | | -expect(result.issues).toContainEqual( |
42 | | -expect.objectContaining({ |
43 | | -path: "channels", |
44 | | -message: expect.stringContaining("ttlHours"), |
45 | | -}), |
46 | | -); |
| 37 | +expect(result.ok).toBe(true); |
47 | 38 | }); |
48 | 39 | |
49 | | -it("rejects legacy channels.<id>.accounts.<id>.threadBindings.ttlHours", () => { |
| 40 | +it("accepts account-level thread binding ttlHours compatibility", () => { |
50 | 41 | const result = validateConfigObjectRaw({ |
51 | 42 | channels: { |
52 | 43 | demo: { |
@@ -61,15 +52,6 @@ describe("thread binding config keys", () => {
|
61 | 52 | }, |
62 | 53 | }); |
63 | 54 | |
64 | | -expect(result.ok).toBe(false); |
65 | | -if (result.ok) { |
66 | | -return; |
67 | | -} |
68 | | -expect(result.issues).toContainEqual( |
69 | | -expect.objectContaining({ |
70 | | -path: "channels", |
71 | | -message: expect.stringContaining("ttlHours"), |
72 | | -}), |
73 | | -); |
| 55 | +expect(result.ok).toBe(true); |
74 | 56 | }); |
75 | 57 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -610,7 +610,7 @@ function validateGatewayTailscaleBind(config: OpenClawConfig): ConfigValidationI
|
610 | 610 | */ |
611 | 611 | export function validateConfigObjectRaw( |
612 | 612 | raw: unknown, |
613 | | -opts?: { |
| 613 | +_opts?: { |
614 | 614 | sourceRaw?: unknown; |
615 | 615 | touchedPaths?: ReadonlyArray<ReadonlyArray<string>>; |
616 | 616 | }, |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。