Skip to content

fix(validators): preserve standalone schema captures - #182373

Merged
steipete merged 3 commits into
mainfrom
fix/standalone-validator-emitter
Oct 24, 2026
Merged

steipete merged 3 commits into
mainfrom
fix/standalone-validator-emitter

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Standalone validator generation can change accepted schema values when literal data resembles compiler-helper code, and its capture emitter cannot represent fixed structural constraints.

User Impact

Generated validators preserve the canonical schemas. The Control UI keeps its existing protocol and lazy-loading boundaries, with smaller generated shared modules and no configuration changes.

Why This Change Was Made

One shared compiler now owns schema compilation, static captures, exact TypeBox helper binding, and syntax-aware string-enum optimization. The Control UI delegates to it; its separate compilation paths are removed. Hoisted checks let consumers tree-shake unused predicates within each existing lazy group. Unsupported closures fail generation, and checks that need evaluated-property state receive a fresh context per call.

Evidence

  • pnpm test test/scripts-typebox-standalone.test.ts test/scripts-generate-control-ui-validators.test.ts --maxWorkers=1: 12 passed, 20.63 s wall. The layout test executes the production generator and catches schema drift and helper-looking literal corruption.
  • pnpm --dir ui test src/lib/protocol-validators.generated.test.ts --maxWorkers=1: 25 passed, 12.17 s wall. pnpm ui:build passed its production build and payload budgets.
  • Direct CLI reproduction with a canonical reaction-schema fixture: the base generator rejects the intended .map(Hashing.Hash) action and accepts the corrupted empty string; the repaired generator accepts the intended action and rejects the empty string. The emitted modules show the same before/fail and after/pass behavior when compiled as small Bun AOT probes with string code generation disabled. No whole-application AOT build or interpreter tripwire was used.
  • The three shared modules shrink from 61,557 to 57,835 source bytes and from 11,084 to 10,889 gzip bytes. Current Board fields remain intact.
  • Generated freshness, max-lines ratchet, targeted types/lint/format, and independent Codex review passed with no remaining actionable findings. PR CI supplies broad exact-head proof.

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime scripts Repository scripts size: L labels Oct 24, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR preserves schema literals and static captures through one shared standalone TypeBox compiler.

Example: Generate a reaction validator whose canonical action literal is .map(Hashing.Hash).

  • Before: The generator changes the literal to an empty string, rejecting the intended action and accepting the wrong value.
  • After: Syntax-aware rewriting preserves the intended action literal.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and the earlier finding is resolved; inspected regression coverage supports it, while the reported CLI and AOT results have no attached execution trace.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports exercising the production generator CLI with a reaction-schema fixture and checking emitted validators with Bun AOT probes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Generated validators can reject values allowed by their canonical schemas or accept corrupted substitutes.
Reason: Preserving canonical schema acceptance is an existing contract, and this maintainer-authored repair retains current protocol and loading boundaries.

Regression provenance

Regression provenance — suspected predecessor, not a causality claim: source commit 9ff9472609c7 by Peter Steinberger; no PR verified.

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

✅ Ready for maintainer review

Keep open: this PR fixes a source-verifiable generator defect still present on main, resolves the earlier compiler-ownership finding, and introduces no actionable defect found in this review.

Priority: P2
Reviewed head: 6ffc30e69595621318f3c57151739d14867bb3a9

Before merge

None.

Findings

None.

Agent review details

How this fits together

Canonical Gateway schemas enter the build-time generator, which emits dependency-free validation modules consumed by existing Control UI lazy groups.

flowchart LR
  A[Canonical Gateway schemas] --> B[Control UI generator]
  B --> C[Shared standalone compiler]
  C --> D[Static captures and helper bindings]
  D --> E[Generated validation modules]
  E --> F[Control UI consumers]
Loading

Technical review

Best possible solution:

Keep one production compiler that preserves canonical schema values and emits standalone checks within the existing lazy boundaries.

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

The main-source replacements deterministically corrupt helper-looking literals; the author reports a matching CLI reproduction, but this read-only review executed no target code.

Is this the best way to solve the issue?

The repair addresses the generator owner directly, replaces text substitution with syntax-aware rewriting, and removes the competing compilation paths identified previously.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against a2e646bc7343.

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source -90, Tests +205, Other +328. Total +443 across 10 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 6 1218 1308 -90
Tests 2 206 1 +205
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 462 134 +328
Total 10 1886 1443 +443

Review metrics

Metric Value Why it matters
Production versus test LOC Production +238 net; tests +205 net Production growth adds syntax-aware rewriting and static capture emission while removing the old compiler paths; tests cover distinct generated-language constraints.

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Incorrect standalone generation can change schema acceptance, with limited scope and no demonstrated widespread runtime outage.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-24T07:51:49.461Z sha 5c56af68d8414e7f6e44bcfc2e118edcafc238f3 :: needs changes before merge. :: [P2] Remove the unused parallel validator compiler

Reviewed October 24, 2026, 5:56 AM ET / 09:56 UTC (Revision 2).

Share standalone TypeBox emission across generators, bind explicit static captures and exact helpers, and preserve code-looking literals through syntax-aware rewrites. Keep generated checks independent of runtime string compilation and isolate evaluated-property state.
@steipete
steipete force-pushed the fix/standalone-validator-emitter branch from 5c56af6 to 126d20b Compare October 24, 2026 08:33
@steipete
steipete marked this pull request as ready for review October 24, 2026 08:34
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T09:53:40.460478Z 6ffc30e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot removed the gateway Gateway runtime label Oct 24, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

The compiler-ownership finding is addressed: every Control UI group now calls compileStandaloneValidators. The local compile and compileShared paths are removed, and the string-enum optimization lives in the shared compiler. Shared UI groups use hoisted exports, so that path also serves production consumers.

The 12 generator tests and 25 UI parity tests pass, along with the production UI build and payload budgets, targeted types/lint/format, freshness, and the max-lines ratchet. A direct CLI reproduction outside Vitest shows the base generator corrupting the helper-looking literal and the repaired generator preserving it; small AOT probes reproduce the same before/fail and after/pass result with string code generation disabled. The PR body contains the current evidence.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the clawsweeper:intake:bug Preliminary submission classification; full source review pending. label Oct 24, 2026
@steipete
steipete merged commit ae88121 into main Oct 24, 2026
108 checks passed
@steipete
steipete deleted the fix/standalone-validator-emitter branch October 24, 2026 11:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
* fix(validators): preserve standalone schema captures

Share standalone TypeBox emission across generators, bind explicit static captures and exact helpers, and preserve code-looking literals through syntax-aware rewrites. Keep generated checks independent of runtime string compilation and isolate evaluated-property state.

* fix(validators): name generated lint suppressions

* refactor(validators): share the UI compilation owner
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant