Skip to content

[Refactor] Split channel schema imports#82007

Merged
steipete merged 1 commit into
openclaw:mainfrom
samzong:refactor/schema-import-split
May 15, 2026
Merged

[Refactor] Split channel schema imports#82007
steipete merged 1 commit into
openclaw:mainfrom
samzong:refactor/schema-import-split

Conversation

@samzong

@samzong samzong commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Problem: OpenClawSchema pulled the generic ChannelsSchema through zod-schema.providers.ts, so validating generic channel defaults depended on the provider schema barrel.
  • Why it matters: The generic channel config shape does not need provider-specific schema modules.
  • What changed: Moved the generic channel schema into zod-schema.channels-config.ts, imported it directly from zod-schema.ts, and pointed the existing lazy-runtime guard at the new module.
  • What did NOT change (scope boundary): This does not change the broader config/io -> validation startup path or its generated bundled channel config metadata import.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Real behavior proof (required for external PRs)

  • Behavior addressed: OpenClawSchema generic channel validation no longer imports the provider schema barrel just to validate channels.defaults.
  • Real environment tested: Local OpenClaw worktree on macOS with Node v24.14.0.
  • Exact steps or command run after this patch: node scripts/run-vitest.mjs src/config/zod-schema.startup-import.test.ts src/config/zod-schema.providers.lazy-runtime.test.ts src/config/config.acp-binding-cutover.test.ts src/config/group-policy.test.ts src/config/context-visibility.test.ts; node scripts/build-all.mjs cliStartup; pnpm deadcode:unused-files; rg -n "providers-whatsapp|providers-core|channels-config|zod-schema\\.providers" dist -g 'zod-schema*.js'.
  • Evidence after fix: Copied terminal output from the built-chunk import check: dist/zod-schema-U0Wq5vAP.js:420://#region src/config/zod-schema.channels-config.ts; the same command produced no zod-schema.providers-core or zod-schema.providers-whatsapp lines.
  • Observed result after fix: Generic OpenClawSchema.safeParse({ channels: { defaults: ..., discord: {} } }) succeeds without loading provider-specific channel schema modules, and the deadcode check accepts the removed internal provider barrel.
  • What was not tested: This PR does not lazily load src/config/bundled-channel-config-metadata.generated.ts from the broader config/io -> validation gateway startup path; that broader startup-boundary split is intentionally left out of this PR.

Root Cause (if applicable)

N/A.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/config/zod-schema.startup-import.test.ts, src/config/zod-schema.providers.lazy-runtime.test.ts
  • Scenario the test should lock in: OpenClawSchema can validate generic channel defaults without loading provider-specific schema modules.
  • Why this is the smallest reliable guardrail: The import boundary is the behavior under refactor.
  • Existing test that already covers this (if any): N/A.
  • If no new test is added, why not: N/A.

User-visible / Behavior Changes

None.

Diagram (if applicable)

N/A.

Security Impact (required)

  • New permissions/capabilities? (Yes/No) No
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) No
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: N/A

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node v24.14.0, local worktree
  • Model/provider: N/A
  • Integration/channel (if any): Generic channel config schema
  • Relevant config (redacted): N/A

Steps

  1. node scripts/run-vitest.mjs src/config/zod-schema.startup-import.test.ts src/config/zod-schema.providers.lazy-runtime.test.ts src/config/config.acp-binding-cutover.test.ts src/config/group-policy.test.ts src/config/context-visibility.test.ts
  2. node scripts/build-all.mjs cliStartup
  3. pnpm deadcode:unused-files
  4. git diff --check HEAD~1..HEAD
  5. pnpm changed:lanes --json
  6. rg -n "providers-whatsapp|providers-core|channels-config|zod-schema\\.providers" dist -g 'zod-schema*.js'

Expected

  • Generic channel validation uses zod-schema.channels-config.ts directly.
  • The build output for this schema chunk has no provider schema references.
  • Deadcode does not report an unused provider barrel.

Actual

  • All targeted tests passed: 5 files, 34 tests.
  • node scripts/build-all.mjs cliStartup passed.
  • pnpm deadcode:unused-files passed.
  • git diff --check HEAD~1..HEAD passed.
  • pnpm changed:lanes --json reported core and coreTests only.
  • The built schema chunk references src/config/zod-schema.channels-config.ts and no provider schema modules for this path.

Evidence

  • Trace/log snippets

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Targeted Vitest files, deadcode unused-file gate, CLI startup build, whitespace check, changed-lane scope, built chunk import references.
  • Edge cases checked: Raw channel schema parsing still avoids bundled channel runtime metadata discovery.
  • What you did not verify: Full gateway startup metadata lazy-loading beyond this schema import split.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes; no package export or production import used the removed internal src/config/zod-schema.providers.ts barrel.
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps: N/A

Risks and Mitigations

None.

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 15, 2026
@clawsweeper

clawsweeper Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

Summary
The PR renames the generic channel schema module, removes provider-schema re-exports from that path, imports ChannelsSchema directly from the new module, and adds import-boundary coverage.

Reproducibility: not applicable. this is a refactor PR rather than a bug report. The relevant verification is the import-boundary proof in the PR body plus the added startup-import test.

Real behavior proof
Sufficient (terminal): The PR body supplies after-fix real behavior proof from a local macOS OpenClaw worktree, including targeted tests, cliStartup build, deadcode check, and built-chunk grep output showing channels-config without provider schema references.

Next step before merge
No repair lane is needed; the PR has no concrete review finding and the remaining action is normal maintainer review and CI handling.

Security
Cleared: The diff only changes internal TypeScript schema imports and tests, with no new dependency, workflow, secret, network, or execution surface.

Review details

Best possible solution:

Merge this narrow import-boundary refactor after normal maintainer review and CI if the branch remains green, while keeping public schema access through the existing plugin SDK subpaths.

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

Not applicable: this is a refactor PR rather than a bug report. The relevant verification is the import-boundary proof in the PR body plus the added startup-import test.

Is this the best way to solve the issue?

Yes. Moving the generic ChannelsSchema into a channel-config module and importing it directly from zod-schema.ts is the narrow maintainable fix for avoiding provider-schema imports on generic channel validation.

What I checked:

Likely related people:

  • @steipete: Recent file history for src/config/zod-schema.providers.ts and src/config/zod-schema.providers.lazy-runtime.test.ts shows repeated schema/startup-boundary work, including generic bot loop protection and raw gateway config startup work. (role: recent area contributor; confidence: high; commits: 4785a073d6c0, 45a5374ca8a8; files: src/config/zod-schema.providers.ts, src/config/zod-schema.providers.lazy-runtime.test.ts)
  • @kaseonedge: Recent history for src/config/zod-schema.ts includes a provider failover change touching the top-level schema file whose channel import this PR changes. (role: recent adjacent contributor; confidence: medium; commits: 8237d165e266; files: src/config/zod-schema.ts)
  • Gio Della-Libera: Local blame in this checkout attributes the central schema files to squash commit abf59205fc, so this is a fallback routing signal when only current checkout provenance is considered. (role: current checkout source attribution; confidence: low; commits: abf59205fcbd; files: src/config/zod-schema.providers.ts, src/config/zod-schema.ts, src/config/zod-schema.providers.lazy-runtime.test.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 0db097936568.

@samzong samzong force-pushed the refactor/schema-import-split branch from 4bfa951 to cb11e02 Compare May 15, 2026 03:58
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 15, 2026
Signed-off-by: samzong <samzong.lu@gmail.com>
@steipete steipete force-pushed the refactor/schema-import-split branch from cb11e02 to 3807251 Compare May 15, 2026 05:55
@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 15, 2026

@steipete steipete left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maintainer verification before merge.

Behavior addressed: OpenClawSchema generic channel validation imports the generic channel config schema directly, avoiding provider-specific channel schema modules during this startup path.
Real environment tested: local macOS checkout rebased onto current origin/main.
Exact steps or command run after this patch:

  • git pull --ff-only
  • gh pr checkout 82007 --repo openclaw/openclaw
  • git rebase origin/main
  • /Users/steipete/Projects/agent-scripts/skills/codex-review/scripts/codex-review --mode branch --parallel-tests "node scripts/run-vitest.mjs src/config/zod-schema.startup-import.test.ts src/config/zod-schema.providers.lazy-runtime.test.ts src/config/config.acp-binding-cutover.test.ts src/config/group-policy.test.ts src/config/context-visibility.test.ts"
  • git diff --check origin/main...HEAD
  • git push --force-with-lease prhead HEAD:refactor/schema-import-split
  • gh pr checks 82007 --repo openclaw/openclaw --watch --interval 15
    Evidence after fix: Codex review exited clean with no accepted/actionable findings; focused local tests passed 5 files / 34 tests; extra adjacent schema guard probes passed 2 files / 3 tests and 3 files / 28 tests; GitHub checks passed on head SHA 3807251.
    CI/Testbox run IDs: CI 25902849196, CodeQL 25902849182, CodeQL Critical Quality 25902849162, Workflow Sanity 25902849185, OpenGrep PR Diff 25902849189, Real behavior proof 25902856038, Dependency Change Awareness 25902847782.
    Observed result after fix: PR remains a 4-file schema import split, rebase clean, no provider-specific zod-schema providers barrel import remains in the generic OpenClawSchema path, and all required GitHub checks are green.
    What was not tested: No live channel runtime or Crabbox E2E; this is an internal config schema import-boundary refactor.

Thanks @samzong.

@steipete steipete merged commit 87724c9 into openclaw:main May 15, 2026
117 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
Split generic channel config schema out of the provider schema barrel so OpenClawSchema no longer imports provider-specific channel schemas for generic channel defaults validation.

Co-authored-by: samzong <samzong.lu@gmail.com>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
Split generic channel config schema out of the provider schema barrel so OpenClawSchema no longer imports provider-specific channel schemas for generic channel defaults validation.

Co-authored-by: samzong <samzong.lu@gmail.com>
SYU8384 pushed a commit to SYU8384/openclaw that referenced this pull request Jun 3, 2026
Split generic channel config schema out of the provider schema barrel so OpenClawSchema no longer imports provider-specific channel schemas for generic channel defaults validation.

Co-authored-by: samzong <samzong.lu@gmail.com>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
Split generic channel config schema out of the provider schema barrel so OpenClawSchema no longer imports provider-specific channel schemas for generic channel defaults validation.

Co-authored-by: samzong <samzong.lu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: supplied External PR includes structured after-fix real behavior proof. size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants