mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 22:32:12 +00:00
* Docs: add config drift statefile generator * Docs: generate config drift baseline * CI: move config docs drift runner into workflow sanity * Docs: emit config drift baseline json * Docs: commit config drift baseline json * Docs: wire config baseline into release checks * Config: fix baseline drift walker coverage * Docs: regenerate config drift baselines
55 lines
2.2 KiB
TypeScript
55 lines
2.2 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
import { normalizeConfigDocBaselineHelpPath } from "./doc-baseline.js";
|
|
import { FIELD_HELP } from "./schema.help.js";
|
|
import {
|
|
describeTalkSilenceTimeoutDefaults,
|
|
TALK_SILENCE_TIMEOUT_MS_BY_PLATFORM,
|
|
} from "./talk-defaults.js";
|
|
|
|
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../..");
|
|
|
|
function readRepoFile(relativePath: string): string {
|
|
return fs.readFileSync(path.join(repoRoot, relativePath), "utf8");
|
|
}
|
|
|
|
describe("talk silence timeout defaults", () => {
|
|
it("keeps help text and docs aligned with the policy", () => {
|
|
const defaultsDescription = describeTalkSilenceTimeoutDefaults();
|
|
const baselineLines = readRepoFile("docs/.generated/config-baseline.jsonl")
|
|
.trim()
|
|
.split("\n")
|
|
.map((line) => JSON.parse(line) as { recordType: string; path?: string; help?: string });
|
|
const talkEntry = baselineLines.find(
|
|
(entry) =>
|
|
entry.recordType === "path" &&
|
|
entry.path === normalizeConfigDocBaselineHelpPath("talk.silenceTimeoutMs"),
|
|
);
|
|
|
|
expect(FIELD_HELP["talk.silenceTimeoutMs"]).toContain(defaultsDescription);
|
|
expect(talkEntry?.help).toContain(defaultsDescription);
|
|
expect(readRepoFile("docs/gateway/configuration-reference.md")).toContain(defaultsDescription);
|
|
expect(readRepoFile("docs/nodes/talk.md")).toContain(defaultsDescription);
|
|
});
|
|
|
|
it("matches the Apple and Android runtime constants", () => {
|
|
const macDefaults = readRepoFile("apps/macos/Sources/OpenClaw/TalkDefaults.swift");
|
|
const iosDefaults = readRepoFile("apps/ios/Sources/Voice/TalkDefaults.swift");
|
|
const androidDefaults = readRepoFile(
|
|
"apps/android/app/src/main/java/ai/openclaw/app/voice/TalkDefaults.kt",
|
|
);
|
|
|
|
expect(macDefaults).toContain(
|
|
`static let silenceTimeoutMs = ${TALK_SILENCE_TIMEOUT_MS_BY_PLATFORM.macos}`,
|
|
);
|
|
expect(iosDefaults).toContain(
|
|
`static let silenceTimeoutMs = ${TALK_SILENCE_TIMEOUT_MS_BY_PLATFORM.ios}`,
|
|
);
|
|
expect(androidDefaults).toContain(
|
|
`const val defaultSilenceTimeoutMs = ${TALK_SILENCE_TIMEOUT_MS_BY_PLATFORM.android}L`,
|
|
);
|
|
});
|
|
});
|