Skip to content

refactor: consolidate exact boolean coercion - #99750

Merged
RomneyDa merged 3 commits into
mainfrom
refactor/boolean-coercion-consolidation
Jul 4, 2026
Merged

RomneyDa merged 3 commits into
mainfrom
refactor/boolean-coercion-consolidation

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Jul 4, 2026

Copy link
Copy Markdown
Member

What Problem This Solves

OpenClaw had several copies of the same exact boolean coercion contract across core and plugin-facing paths. Keeping those copies synchronized made it easy for trimming, case folding, invalid-value handling, or caller defaults to drift.

Why This Change Was Made

Adds a dependency-free @openclaw/normalization-core/boolean-coercion subpath for the exact shared contract: booleans pass through, trimmed case-insensitive true/false strings parse, and unsupported inputs return undefined. The existing plugin SDK record reader delegates to it, and exact-compatible core/WhatsApp callers migrate while environment reads, defaults, fallback policy, numeric or broader truthy tokens, and domain enums remain with their owners.

User Impact

No user-visible behavior changes. Maintainers and plugin consumers keep the same accepted inputs and defaults through one canonical parser, reducing future drift.

Evidence

  • node scripts/run-vitest.mjs packages/normalization-core/src/boolean-coercion.test.ts src/agents/tools/media-tool-shared.test.ts src/cron/normalize.test.ts src/cron/service/store.test.ts src/memory-host-sdk/dreaming.test.ts extensions/whatsapp/src/channel-react-action.test.ts test/scripts/prepare-extension-package-boundary-artifacts.test.ts — 6 shards, 145 tests passed on the rebased head.
  • pnpm --filter @openclaw/normalization-core build — emitted the new ESM and declaration subpath.
  • node scripts/check-extension-package-tsc-boundary.mjs --mode=compile — all 117 plugin package boundaries passed.
  • pnpm build — full package, runtime postbuild, plugin SDK declaration, and UI build passed.
  • Delegated Blacksmith Testbox check:changed: tbx_01kwnceqwa5zfvcr53wrhr2the — typecheck, lint, guards, and import-cycle checks passed.
  • .agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --prompt-file /tmp/boolean-coercion-autoreview-final.md --stream-engine-output — clean, no accepted/actionable findings.
  • Production diff: net -27 non-test lines.

@openclaw-barnacle openclaw-barnacle Bot added channel: whatsapp-web Channel integration: whatsapp-web scripts Repository scripts agents Agent runtime and tooling size: S maintainer Maintainer-authored PR labels Jul 4, 2026
@clawsweeper

clawsweeper Bot commented Jul 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 3, 2026, 10:19 PM ET / 02:19 UTC.

Summary
Adds a shared @openclaw/normalization-core/boolean-coercion parser, migrates exact-compatible SDK/core/WhatsApp boolean readers to it, and wires package/build/test/native resolver metadata for the new subpath.

PR surface: Source -32, Tests +83, Config +8, Other +2. Total +61 across 19 files.

Reproducibility: not applicable. this is a refactor PR rather than a bug report. For the previous PR-specific resolver defect, source inspection now shows the subpath in the native and workspace aliases, and the completed checks that previously failed were passing at final inspection.

Review metrics: 1 noteworthy metric.

  • Package subpath surface: 1 subpath added. The new normalization-core boolean subpath must remain aligned across exports, build entries, TypeScript/Vitest aliases, native resolver metadata, and boundary artifacts.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🌊 off-meta tidepool
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Let the remaining exact-head CI shards complete before merge.

Risk before merge

  • [P1] Exact-head CI still had three in-progress shards at final inspection; merge should wait for those to complete or be cleared.

Maintainer options:

  1. Decide the mitigation before merge
    Let the remaining exact-head CI finish, then merge the narrow consolidation if maintainers accept the refactor-only cleanup.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair job is needed; maintainers should wait for the remaining exact-head CI and make the normal merge decision for the maintainer-labeled refactor.

Security
Cleared: The diff adds local normalization code and package/test/build resolver metadata only; no new dependency, lockfile, workflow permission, secret handling, or downloaded code path was found.

Review details

Best possible solution:

Let the remaining exact-head CI finish, then merge the narrow consolidation if maintainers accept the refactor-only cleanup.

Do we have a high-confidence way to reproduce the issue?

Not applicable; this is a refactor PR rather than a bug report. For the previous PR-specific resolver defect, source inspection now shows the subpath in the native and workspace aliases, and the completed checks that previously failed were passing at final inspection.

Is this the best way to solve the issue?

Yes, subject to CI completion; centralizing the exact boolean contract in normalization-core is the narrow maintainable layer. Broader truthy/falsy parsers remain separate, so this avoids changing caller-specific policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a1063aa4c83f.

Label changes

Label changes:

  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a member-authored, maintainer-labeled internal refactor with no intended user-visible behavior change; PR body and CI provide terminal/test validation for review.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is a low-risk internal cleanup/refactor with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: this is a member-authored, maintainer-labeled internal refactor with no intended user-visible behavior change; PR body and CI provide terminal/test validation for review.
Evidence reviewed

PR surface:

Source -32, Tests +83, Config +8, Other +2. Total +61 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 9 36 68 -32
Tests 6 84 1 +83
Docs 0 0 0 0
Config 2 9 1 +8
Generated 0 0 0 0
Other 2 2 0 +2
Total 19 131 70 +61

What I checked:

  • Repository policy applied: Root AGENTS.md and scoped guides for extensions, plugin SDK, agent tools, plugin loading, scripts, and tests were read fully; the applicable guidance is plugin boundary and resolver/package-surface alignment. (AGENTS.md:1, a1063aa4c83f)
  • Current main still has duplicated exact boolean parsing: Current main has an exact boolean-or-trimmed-true/false parser in src/plugin-sdk/boolean-param.ts and a local equivalent in the WhatsApp action module, so the consolidation is not already implemented on main. (src/plugin-sdk/boolean-param.ts:4, a1063aa4c83f)
  • Exact parser implementation: The proposed merge commit adds parseBoolean, preserving the narrow contract: booleans pass through, trimmed case-insensitive true/false strings parse, and unsupported values return undefined. (packages/normalization-core/src/boolean-coercion.ts:2, 1414a10164d4)
  • Exact parser coverage: The new unit test covers booleans, whitespace/case variants, and rejects broader truthy/falsy tokens such as yes, on, 1, and 0. (packages/normalization-core/src/boolean-coercion.test.ts:5, 1414a10164d4)
  • Call sites preserve the exact-compatible contract: The PR routes media tool params, cron enabled, memory dreaming booleans, plugin SDK readBooleanParam, and WhatsApp upload options through the shared parser while leaving broader boolean helpers separate. (src/agents/tools/media-tool-shared.ts:470, 1414a10164d4)
  • Resolver/package metadata aligned: The latest head includes the new subpath in package exports/build entries plus native resolver, workspace alias, Vitest alias, and TypeScript path metadata, addressing the prior missing-resolver class of failure. (src/plugins/plugin-sdk-native-resolver.ts:54, 1414a10164d4)

Likely related people:

  • RomneyDa: Current-main blame attributes the duplicated exact boolean readers and native normalization-core resolver alias list to c7aca4f02938, and the same person authored the current refactor and resolver repair commits. (role: recent area contributor; confidence: high; commits: c7aca4f02938, dceba5d61ab1, c6f7a3acdc12; files: src/plugin-sdk/boolean-param.ts, src/plugins/plugin-sdk-native-resolver.ts, extensions/whatsapp/src/channel-react-action.ts)
  • steipete: git log -S'readBooleanParam' traces the earlier SDK boolean action parameter helper to commit 741e74972b82, which is historical context for this consolidation. (role: original helper introducer; confidence: medium; commits: 741e74972b82; files: src/plugin-sdk/boolean-param.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Jul 4, 2026
@RomneyDa

RomneyDa commented Jul 4, 2026 •

Copy link
Copy Markdown
Member Author

CI repair pushed at c6f7a3acdc1.

Failure classification for exact-head run 28691159120:

  • checks-fast-contracts-plugins-b — branch-caused. The source boundary map added a redundant explicit normalization subpath that diverged from the checked-in derived configs; the existing wildcard already owns this path.
  • checks-node-compact-small-2 — branch-caused. The Vitest package-root string alias captured @openclaw/normalization-core/boolean-coercion and rewrote it as index.ts/boolean-coercion.
  • checks-node-compact-large-3 — branch-caused. Same alias-prefix defect through the memory dreaming import.
  • checks-node-compact-large-whole-1 — branch-caused. Same agents-support module-resolution failure.
  • No unrelated infrastructure failure was found in these four completed logs.

Repair:

  • Removed the redundant extension boundary alias and retained the canonical wildcard.
  • Anchored the Vitest normalization package-root alias to exact package imports, leaving explicit subpath aliases to resolve subpaths.

Fresh proof:

  • node scripts/run-vitest.mjs src/plugins/contracts/extension-package-project-boundaries.test.ts — 8/8 passed.
  • Exact compact auto-reply config reproduction — 25/25 passed.
  • Exact compact agents-support config reproduction — 28/28 passed.
  • node scripts/check-extension-package-tsc-boundary.mjs --mode=compile — all 117 plugin boundaries passed.
  • Blacksmith Testbox changed gate tbx_01kwnd7asnke6tdrph9fbefhjq (run 28691333386) — typecheck, lint, guards, and import cycles passed.
  • Fresh local autoreview — clean, no accepted/actionable findings.

GitHub CI is now refreshing on exact head c6f7a3acdc1; no merge or automerge action taken.

Follow-up exact-head compact repair

The replacement run exposed the remaining branch-caused layer: Jiti/native plugin loading still lacked the new normalization subpath in its canonical workspace and internal-core alias maps. All three failures had the same index.ts/boolean-coercion resolution error; no unrelated runner or infrastructure failure was present.

Fixed in df7634762ce3e7f508014395d4087f6ebd75442e:

  • register @openclaw/normalization-core/boolean-coercion in the workspace/Jiti alias map;
  • register the same subpath in the native internal-core resolver;
  • cover source fallback, OpenClaw-owned native resolution, and external-plugin parent isolation.

Focused proof:

  • plugin resolver suites: 87/87 tests passed;
  • compact auto-reply failed targets: 25/25 passed;
  • compact agents-support failed target: 28/28 passed;
  • compact agents-core failed target: 65/65 passed;
  • fresh autoreview: clean, no accepted/actionable findings, confidence 0.97.

A fresh exact-head ClawSweeper review is already running, so no duplicate re-review command was posted. No merge or automerge action was taken.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 4, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Jul 4, 2026
@RomneyDa
RomneyDa merged commit febc700 into main Jul 4, 2026
125 of 135 checks passed
@RomneyDa
RomneyDa deleted the refactor/boolean-coercion-consolidation branch July 4, 2026 02:42
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 4, 2026
* refactor: consolidate exact boolean parsing

* test: fix normalization subpath resolution

* fix: resolve normalization boolean subpath
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling channel: whatsapp-web Channel integration: whatsapp-web maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant