refactor(config): hide io constants · openclaw/openclaw@392bd16
vincentkoc
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,11 +5,12 @@ import os from "node:os";
|
5 | 5 | import path from "node:path"; |
6 | 6 | import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; |
7 | 7 | import { |
8 | | -CONFIG_CLOBBER_SNAPSHOT_LIMIT, |
9 | 8 | persistBoundedClobberedConfigSnapshot, |
10 | 9 | persistBoundedClobberedConfigSnapshotSync, |
11 | 10 | } from "./io.clobber-snapshot.js"; |
12 | 11 | |
| 12 | +const CONFIG_CLOBBER_SNAPSHOT_LIMIT = 32; |
| 13 | + |
13 | 14 | describe("config clobber snapshots", () => { |
14 | 15 | let fixtureRoot = ""; |
15 | 16 | let caseId = 0; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2,7 +2,7 @@
|
2 | 2 | import path from "node:path"; |
3 | 3 | |
4 | 4 | /** Maximum retained clobbered-config snapshots per config file. */ |
5 | | -export const CONFIG_CLOBBER_SNAPSHOT_LIMIT = 32; |
| 5 | +const CONFIG_CLOBBER_SNAPSHOT_LIMIT = 32; |
6 | 6 | |
7 | 7 | const CONFIG_CLOBBER_LOCK_STALE_MS = 30_000; |
8 | 8 | const CONFIG_CLOBBER_LOCK_RETRY_MS = 10; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,7 +3,7 @@ import { VERSION } from "../version.js";
|
3 | 3 | import type { OpenClawConfig } from "./types.openclaw.js"; |
4 | 4 | |
5 | 5 | /** Metadata keys automatically stamped on config writes. */ |
6 | | -export const AUTO_MANAGED_CONFIG_META_FIELDS = { |
| 6 | +const AUTO_MANAGED_CONFIG_META_FIELDS = { |
7 | 7 | lastTouchedVersion: "lastTouchedVersion", |
8 | 8 | lastTouchedAt: "lastTouchedAt", |
9 | 9 | } as const; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -5,7 +5,6 @@ import os from "node:os";
|
5 | 5 | import path from "node:path"; |
6 | 6 | import JSON5 from "json5"; |
7 | 7 | import { afterAll, beforeAll, describe, expect, it, vi } from "vitest"; |
8 | | -import { CONFIG_CLOBBER_SNAPSHOT_LIMIT } from "./io.clobber-snapshot.js"; |
9 | 8 | import { createConfigIO } from "./io.js"; |
10 | 9 | import { |
11 | 10 | maybeRecoverSuspiciousConfigRead, |
@@ -17,6 +16,8 @@ import {
|
17 | 16 | } from "./io.observe-recovery.js"; |
18 | 17 | import type { ConfigFileSnapshot } from "./types.js"; |
19 | 18 | |
| 19 | +const CONFIG_CLOBBER_SNAPSHOT_LIMIT = 32; |
| 20 | + |
20 | 21 | describe("config observe recovery", () => { |
21 | 22 | let fixtureRoot = ""; |
22 | 23 | let homeCaseId = 0; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,6 @@ import { clearLoadPluginMetadataSnapshotMemo } from "../plugins/plugin-metadata-
|
9 | 9 | import { createSuiteTempRootTracker } from "../test-helpers/temp-dir.js"; |
10 | 10 | import { withEnvAsync } from "../test-utils/env.js"; |
11 | 11 | import { hashConfigIncludeRaw } from "./includes.js"; |
12 | | -import { CONFIG_CLOBBER_SNAPSHOT_LIMIT } from "./io.clobber-snapshot.js"; |
13 | 12 | import { |
14 | 13 | createConfigIO, |
15 | 14 | getRuntimeConfigSourceSnapshot, |
@@ -23,6 +22,8 @@ import {
|
23 | 22 | import { ConfigMutationConflictError } from "./mutation-conflict.js"; |
24 | 23 | import type { ConfigFileSnapshot, OpenClawConfig } from "./types.openclaw.js"; |
25 | 24 | |
| 25 | +const CONFIG_CLOBBER_SNAPSHOT_LIMIT = 32; |
| 26 | + |
26 | 27 | // Mock the plugin manifest registry so we can register a fake channel whose |
27 | 28 | // AJV JSON Schema carries a `default` value. This lets the #56772 regression |
28 | 29 | // test exercise the exact code path that caused the bug: AJV injecting |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。