Repository navigation
fix(validators): preserve standalone schema captures - #182373
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR preserves schema literals and static captures through one shared standalone TypeBox compiler. Example: Generate a reaction validator whose canonical action literal is
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenanceRegression provenance — suspected predecessor, not a causality claim: source commit 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 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCanonical 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]
Technical reviewBest 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
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource -90, Tests +205, Other +328. Total +443 across 10 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (1 earlier review cycle)
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.
5c56af6 to
126d20b
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
The compiler-ownership finding is addressed: every Control UI group now calls 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 |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
* 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
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:buildpassed its production build and payload budgets..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.