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
+2 -6
View File
@@ -1,3 +1,4 @@
import { asNullableRecord } from "@openclaw/normalization-core/record-coerce";
import { normalizeLowercaseStringOrEmpty } from "@openclaw/normalization-core/string-coerce";
// Audits channel configuration for exposure, auth, and trust risks.
import { uniqueStrings } from "@openclaw/normalization-core/string-normalization";
@@ -155,11 +156,6 @@ export async function collectChannelSecurityFindingsCore(params: {
});
};
const asAccountRecord = (value: unknown): Record<string, unknown> | null =>
value && typeof value === "object" && !Array.isArray(value)
? (value as Record<string, unknown>)
: null;
const resolveChannelAuditAccount = async (
plugin: (typeof params.plugins)[number],
accountId: string,
@@ -207,7 +203,7 @@ export async function collectChannelSecurityFindingsCore(params: {
);
const account = useSourceUnavailableAccount ? sourceInspectedAccount : resolvedAccount;
const selectedInspection = useSourceUnavailableAccount ? sourceInspection : resolvedInspection;
const accountRecord = asAccountRecord(account);
const accountRecord = asNullableRecord(account);
let enabled =
typeof selectedInspection?.enabled === "boolean"
? selectedInspection.enabled