Repository navigation
refactor(ui): deduplicate generated approval validators - #177528
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 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. |
|
Codex review: needs maintainer review before merge. What this changesThis PR interns approval schemas during generation so emitted validators share repeated checks. Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-directed refactor reduces generated validation through the existing owner, with no actionable code or security findings. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherCanonical Gateway schemas enter the build-time generator, which emits standalone browser validators used to admit approval events and replays into the chat approval queue. flowchart LR
Schemas[Canonical Gateway schemas] --> Generator[Validator generator]
Generator --> Intern[Approval schema interning]
Intern --> Validators[Standalone browser validators]
Events[Gateway approval events and replays] --> Validators
Validators --> Projection[Chat approval projection]
Projection --> Queue[Displayed approval queue]
Technical reviewBest possible solution: Retain approval-only interning in the existing generator and resolve CI admission without adding unrelated repairs. Do we have a high-confidence way to reproduce the issue? No product bug is claimed; the base source visibly repeats approval presentation and scope validation across union branches. Is this the best way to solve the issue? The change uses the existing canonical-schema generator and TypeBox's deduplication facility, preserving other groups inline and avoiding handwritten validation or additional ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 89e77376ccb1. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -2686, Other +4. Total -2682 across 5 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 Reviewed October 19, 2026, 1:54 PM ET / 17:54 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
What Problem This Solves
Generated approval validation repeats thousands of lines of checks across union branches, increasing production code and shipped JavaScript.
User Impact
No user-visible behavior change. Approval validation accepts and rejects the same inputs with smaller generated output.
Why This Change Was Made
Intern approval schemas at the existing TypeBox generation boundary so emitted validators share repeated presentation and scope checks. Canonical schemas, exports, validation behavior, CSP guards, and lazy loading boundaries stay unchanged.
This deliberately applies only to approvals. An exploratory all-groups variant slowed history and transcript validation, so those remain inline. TypeBox's public
InternAPI is experimental and runs only at generation time. Three subsequent generated modules have temporary-variable renumbering from the compiler's shared counter; normalizing only those identifiers produces byte-identical files. No new runtime package or hand-written validator is introduced.Evidence
pnpm tsgo:ui)pnpm ui:build, same checkout/machineThe scope census excludes tests, test support, fixtures, and translation catalogs; it includes generated production JS. Authored production scope is 93,147 LOC and does not shrink here: the reduction is in shipped generated validation. The production scope shrinks by 2,686 lines (2.67%); including the generator, this PR is net −2,682 lines, with no test changes. Earlier lane PRs #177473 (−3) and #177478 (+4) make the cumulative lane delta −2,681 lines including this PR.
The requested throwaway duplicate scan hashed normalized 6/8/10-line windows across the scope and identified approval validation as the largest real duplication. No generated-validator entry exists in the max-lines baseline. All Solid refactor-checklist counters in the changed files are zero before and after.
Exploratory warmed validation microbenchmark, nine interleaved pairs, milliseconds per 10,000 validations: valid approvals 31.34 → 32.18 (+2.7%); mixed valid/invalid approvals 103.40 → 70.48 (−31.8%). This is narrow microbenchmark evidence, not a claim about page or streaming latency.
No visual changes; screenshots are not applicable. Full CI is requested because validators have shared consumers. No changelog edit: release notes remain release-owned.
Production Knip, generation reproducibility, focused lint/formatting, and independent review passed. Strict performance comparison passed against the saved base build on the same machine (
node --import ./scripts/tsx.mjs scripts/check-control-ui-performance.mts --dist <head-dist> --base-dist <base-dist>). Startup is unchanged within 31 B of build variance; the approval reduction remains behind its existing lazy boundary. No local E2E or broad suite runs;ci:fullowns those checks.CI caught TypeBox’s emitted
length !== 0 && some(...)redundancy in the interned approval functions. The generator now includes that rule in its existing approvals-only compiler-output lint exemptions; runtime output remains byte-identical. The required PR context headings were also added after the initial metadata check.Inherited CI failure:
checks-fast-baseline-ratchetsin run39295862393reports the stale mock-export ledger entry["extensions/acpx/register.runtime.test.ts","openclaw/plugin-sdk/acp-runtime-backend","85c02528b8c7e95e604ffd08071c631a9dcd2f7600f1bff2dd9817f3c0e49f0f",1]. The identical entry fails on the untouched merge-base tree2e4260b0158567af08f3cf08bb31ef8d948c0ec9, tested with the supported staged checker using an isolated Git index (pnpm check:test-mock-exports --staged --base 2e4260b0158567af08f3cf08bb31ef8d948c0ec9 --no-merge-base). No source or baseline was changed for that reproduction. The native inherited-failure route will retain this exception; this check is not claimed green.Final full CI run
39295862393(attempt 1): all three UI unit shards, nine UI E2E shards, both real-Gateway shards, Control UI performance and security passed. The run has 44 passing jobs and 24 skipped jobs; its only failures are the inherited ratchet and downstream CI gate. Native inherited-failure admission retains the exact checkout, matching base reproduction and unchanged-input evidence.