refactor: consolidate coercion contracts (#122458)

* refactor: consolidate coercion contracts

Centralize exact string, record, numeric, date, Boolean, argument, and structured-error coercions while preserving call-site semantics.

Migrate canonical-name collisions and deprecated internal SDK bypasses, deleting 55 net production/tooling lines. Expand declaration ownership enforcement to 101 allowed helpers and add a narrow export-completeness audit.

* fix: preserve standalone script coercions

Keep copied Control UI tooling self-contained and retain the trusted release harness module-relative source seam when the harness runs against an old target cwd.
This commit is contained in:
Peter Steinberger
2026-08-11 23:26:37 -07:00
committed by GitHub
parent 66fe424590
commit b080dd1e76
276 changed files with 1685 additions and 1663 deletions
+6 -14
View File
@@ -10,6 +10,7 @@ import { buildConfigSchemaCore } from "../config/schema.js";
import { isMissingPathError } from "../infra/errors.js";
import { resolveHomeRelativePath } from "../infra/home-dir.js";
import { readRegularFileSync } from "../infra/regular-file.js";
import { parseBooleanValue } from "../utils/boolean.js";
import { VERSION } from "../version.js";
import {
readDiagnosticStabilityBundleFileSync,
@@ -209,24 +210,15 @@ function safeScalar(value: unknown): unknown {
function resolveBonjourEnvOverride(
env: NodeJS.ProcessEnv,
): NonNullable<ConfigShape["discovery"]>["bonjourEnvOverride"] {
const raw = env.OPENCLAW_DISABLE_BONJOUR?.trim().toLowerCase();
const raw = env.OPENCLAW_DISABLE_BONJOUR?.trim();
if (!raw) {
return "unset";
}
switch (raw) {
case "1":
case "true":
case "yes":
case "on":
return "force-disabled";
case "0":
case "false":
case "no":
case "off":
return "force-enabled";
default:
return "unrecognized";
const disabled = parseBooleanValue(raw);
if (disabled === true) {
return "force-disabled";
}
return disabled === false ? "force-enabled" : "unrecognized";
}
function sortedObjectKeys(value: unknown): string[] {