mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 04:15:48 -06:00
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:
committed by
GitHub
parent
66fe424590
commit
b080dd1e76
@@ -1,4 +1,5 @@
|
||||
// Control UI module owns transient operator question state.
|
||||
import { asSafeIntegerInRange } from "@openclaw/normalization-core/number-coercion";
|
||||
import { isRecord } from "@openclaw/normalization-core/record-coerce";
|
||||
import { normalizeNullableString as readNonEmptyString } from "@openclaw/normalization-core/string-coerce";
|
||||
import type {
|
||||
@@ -61,7 +62,7 @@ type QuestionAnswerValues = Record<string, string[]>;
|
||||
const REFRESH_RETRY_DELAYS_MS = [1_000, 2_000, 4_000] as const;
|
||||
|
||||
function readTimestamp(value: unknown): number | null {
|
||||
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? value : null;
|
||||
return asSafeIntegerInRange(value, { min: 0 }) ?? null;
|
||||
}
|
||||
|
||||
const MAX_HEADER_GRAPHEMES = 12;
|
||||
|
||||
Reference in New Issue
Block a user