Skip to content

refactor(gateway): one owner for the submitted-config validation pipeline - #124331

Merged
steipete merged 1 commit into
mainfrom
codex/autoqa-validation-consolidation
Aug 16, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/autoqa-validation-consolidation

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

config.set and config.patch each hand-rolled the same submitted-config validation pipeline — normalize model refs → strip bundled provider runtime defaults → raw-validate with plugins → plugin-validate → respond with summarized issues + structured details. Two copies of the same policy meant every change (like round-5's error-text improvement in #124127) had to be made twice, and the two blocks had already accumulated cosmetic drift.

Why This Change Was Made

validateSubmittedConfigOrRespond now owns the pipeline; both handlers consume { validationCandidate, config }. Behavior-neutral: same validators in the same order, same error shapes with details.issues, pinned by the existing 26 config tests (including the round-5 error-text regressions).

User Impact

None visible — pure consolidation. Future validation-error improvements land in one place.

Evidence

  • node scripts/run-vitest.mjs run src/gateway/server-methods/config.test.ts src/gateway/server-methods/server-methods.test.ts — 238/238 green with zero test edits (the strongest behavior-neutrality proof for a consolidation).
  • pnpm tsgo, pnpm check:test-types, oxfmt/oxlint clean; autoreview clean (0.99: "preserves the existing normalization and validation order, failure responses, and successful values").

Production LOC +56/−67 (net −11).

…line

config.set and config.patch each hand-rolled the same normalize ->
raw-validate -> plugin-validate -> respond-invalid pipeline (including the
duplicated errorShape/details blocks the round-5 error-text fix touched in
both places). validateSubmittedConfigOrRespond now owns it; both handlers
consume { validationCandidate, config }.

Behavior-neutral: same validators in the same order, same error shapes
(pinned by the existing 26 config tests including the round-5 regressions).
Net -11 production LOC and one place to evolve validation error content.
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Aug 16, 2026
@steipete
steipete marked this pull request as ready for review August 16, 2026 01:24
@openclaw-barnacle openclaw-barnacle Bot added size: S maintainer Maintainer-authored PR labels Aug 16, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Aug 16, 2026
@clawsweeper

clawsweeper Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 9:30 PM ET / August 16, 2026, 01:30 UTC.

ClawSweeper review

What this changes

The PR centralizes the shared submitted-configuration validation and invalid-response pipeline used by Gateway config.set and config.patch.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

No blocking findings. The branch removes duplicated Gateway validation policy while retaining the current normalization, raw-validation, plugin-validation, and structured-error sequence; it remains open for normal maintainer review because it carries the protected maintainer label.

Priority: P3
Reviewed head: e800ecf98f2d11b6bb256ba83bfa4b702e3b2a7d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, net-negative consolidation with no correctness or security finding after source, sibling-path, validation-contract, and test-owner review.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-owned internal refactor, so the external-contributor real-behavior-proof gate does not apply; the relevant evidence is the unchanged request/validation/write boundary and focused test coverage.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-owned internal refactor, so the external-contributor real-behavior-proof gate does not apply; the relevant evidence is the unchanged request/validation/write boundary and focused test coverage.
Evidence reviewed 6 items Current duplicate boundary: Current main has the same normalize, raw-validate, plugin-validate, and structured-error sequence inside the full-config parsing path.
Sibling mutation path: Current main duplicates that sequence in config.patch after its patch-specific LWW, duplicate-ID, and destructive-array checks; the branch leaves those earlier checks local to the patch handler.
Proposed canonical helper: The branch invokes one helper from both paths and retains the existing normalizer, raw validator, full validator, issue summary, and details.issues response shape in the same order.
Findings None None.
Security None None.

How this fits together

Gateway configuration mutation handlers turn submitted JSON into a source-shaped candidate, validate it with plugin-aware rules, then either return structured invalid-request details or write the configuration. The refactor establishes one owner for the common validation portion after each handler’s method-specific parsing and merge checks.

flowchart LR
  A[Config set or patch request] --> B[Method-specific parsing and merge checks]
  B --> C[Submitted config validation]
  C --> D[Normalize model references]
  D --> E[Raw and plugin validation]
  E -->|invalid| F[Structured invalid-request response]
  E -->|valid| G[Validated configuration]
  G --> H[Gateway config write flow]
Loading

Before merge

  • Complete next step (P2) - No repair lane is needed: the patch is coherent and has no actionable review finding; it awaits routine maintainer review and exact-head CI.
Agent review details

Security

None.

PR surface

Source -11. Total -11 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 1 56 67 -11
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 56 67 -11

Review metrics

Metric Value Why it matters
Production versus test LOC production −11, tests 0 The net deletion comes from consolidating two equivalent handler blocks without expanding the configuration contract or test-support surface.

Technical review

Best possible solution:

Land the single local helper after exact-head CI completes, retaining method-specific parse, merge, and conflict checks outside the shared validation boundary.

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

Not applicable: this is a consolidation rather than a reported runtime defect; the relevant check is source-level preservation of both existing mutation paths.

Is this the best way to solve the issue?

Yes. A helper after each method’s unique preprocessing is the narrowest maintainable solution; moving patch-specific merge and concurrency checks into the helper would conflate distinct responsibilities.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a focused, behavior-neutral Gateway maintenance refactor with no intended user-visible change.
  • 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: This is a maintainer-owned internal refactor, so the external-contributor real-behavior-proof gate does not apply; the relevant evidence is the unchanged request/validation/write boundary and focused test coverage.

Label justifications:

  • P3: This is a focused, behavior-neutral Gateway maintenance refactor with no intended user-visible 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: This is a maintainer-owned internal refactor, so the external-contributor real-behavior-proof gate does not apply; the relevant evidence is the unchanged request/validation/write boundary and focused test coverage.

Evidence

What I checked:

  • Current duplicate boundary: Current main has the same normalize, raw-validate, plugin-validate, and structured-error sequence inside the full-config parsing path. (src/gateway/server-methods/config.ts:519, 1d5321192485)
  • Sibling mutation path: Current main duplicates that sequence in config.patch after its patch-specific LWW, duplicate-ID, and destructive-array checks; the branch leaves those earlier checks local to the patch handler. (src/gateway/server-methods/config.ts:1083, 1d5321192485)
  • Proposed canonical helper: The branch invokes one helper from both paths and retains the existing normalizer, raw validator, full validator, issue summary, and details.issues response shape in the same order. (src/gateway/server-methods/config.ts:575, e800ecf98f2d)
  • Validation contract: Raw plugin validation intentionally skips runtime default materialization, while full validation applies it; preserving this order is the relevant behavior contract. (src/config/validation.ts:78, 1d5321192485)
  • Test ownership: The focused handler suite deliberately owns config patch and merge behavior while plugin-validation behavior is covered by dedicated validation suites, so no implementation-coupled test was needed for this extraction. (src/gateway/server-methods/config.test.ts:29, 1d5321192485)
  • History provenance: Blame attributes both pre-refactor duplicated blocks to the same recent Gateway configuration work; the proposed helper is introduced by the reviewed commit. (src/gateway/server-methods/config.ts:575, e800ecf98f2d)

Likely related people:

  • steipete: Blame ties the duplicated current-main validation paths and the proposed canonical helper to Peter Steinberger’s recent Gateway configuration work. (role: recent area contributor; confidence: high; commits: e800ecf98f2d, 02d34aad465b; files: src/gateway/server-methods/config.ts, src/gateway/server-methods/config.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@steipete
steipete merged commit 9c6539c into main Aug 16, 2026
253 checks passed
@steipete
steipete deleted the codex/autoqa-validation-consolidation branch August 16, 2026 01:37
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 16, 2026
…line (openclaw#124331)

config.set and config.patch each hand-rolled the same normalize ->
raw-validate -> plugin-validate -> respond-invalid pipeline (including the
duplicated errorShape/details blocks the round-5 error-text fix touched in
both places). validateSubmittedConfigOrRespond now owns it; both handlers
consume { validationCandidate, config }.

Behavior-neutral: same validators in the same order, same error shapes
(pinned by the existing 26 config tests including the round-5 regressions).
Net -11 production LOC and one place to evolve validation error content.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime 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. size: S 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