Repository navigation
refactor(gateway): one owner for the submitted-config validation pipeline - #124331
Conversation
…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.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 9:30 PM ET / August 16, 2026, 01:30 UTC. ClawSweeper reviewWhat this changesThe PR centralizes the shared submitted-configuration validation and invalid-response pipeline used by Gateway Merge readinessNo 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 Priority: P3 Review scores
Verification
How this fits togetherGateway 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -11. Total -11 across 1 file. View PR surface stats
Review metrics
Technical reviewBest 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. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…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.
What Problem This Solves
config.setandconfig.patcheach 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
validateSubmittedConfigOrRespondnow owns the pipeline; both handlers consume{ validationCandidate, config }. Behavior-neutral: same validators in the same order, same error shapes withdetails.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).