Repository navigation
refactor(ui): share approval validator compilation - #177791
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 shares compilation of approval event and replay validators and removes unnecessary hashing and Unicode forwarding code. Example: An approval offers allowedDecisions ["allow-once", "deny"].
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR meaningfully reduces generated validation code, with no actionable correctness or security defect found. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe build-time generator converts canonical Gateway schemas into standalone browser validators; chat approval projections consume their boolean results before updating the displayed approval queue. flowchart LR
A[Canonical Gateway schemas] --> B[Validator generator]
B --> C[Shared approval compilation]
C --> D[Standalone browser validators]
E[Gateway events and replay] --> D
D --> F[Session approval projection]
F --> G[Displayed approval queue]
Technical reviewBest possible solution: Retain the shared generator implementation and canonical schemas, with the existing exact-head CI gate governing merge readiness. Do we have a high-confidence way to reproduce the issue? This refactor does not report a broken user flow; duplicate compilation and generic hashing are directly visible in the pinned base source. Is this the best way to solve the issue? The change uses the existing generation owner, preserves schemas and consumer boundaries, and removes redundant emitted machinery without introducing runtime state or dependencies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2ccb5e7b30d8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -845, Other +48. Total -797 across 7 files. Added test files: 0. 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 Reviewed October 19, 2026, 6:42 PM ET / 22:42 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
What Problem This Solves
The generated approval event and replay validators compile the same approval shapes twice and carry generic hashing code for arrays containing only decision strings.
User Impact
No user-visible behavior changes. Accepted and rejected payloads, exported validator names, and lazy loading stay the same. The generated validators contain less code and avoid the temporary array and string hashing used for decision uniqueness.
Why This Change Was Made
Compile both approval entry points in one TypeBox scope, retaining the existing standalone browser output. Use direct
Setequality only after the generator proves every unique-item schema is a finite string enum; other schemas keep TypeBox hashing. Import the existing Unicode helper directly at build time to remove its forwarding wrapper from all six generated groups. There are no new browser imports, dependency changes, or changes to canonical schemas.Affected production files shrink 3,989 → 3,192 lines (−797): generated output 3,647 → 2,802 (−845), generator 342 → 390 (+48). The generator growth owns shared compilation and its schema check; the two approval entry points share their emitted predicates.
Evidence
pnpm tsgo:uiA small validation-only measurement used 20,000 valid checks per sample, five interleaved samples after warm-up. Event median: 96.86 → 10.87 ms (before range 59.54–197.84, after 6.77–18.13). Replay median: 85.86 → 6.67 ms (before range 65.34–215.40, after 6.25–11.51). The host was contended; these measure the validator, not overall UI latency.
No screenshots: this changes generated validation code only, with no rendered markup, CSS, route, host tag, or selector changes. Full UI CI is requested because the validators serve chat approval projections.
Inherited CI failures
CI run 39335100920 fails only these two device fixtures (plus the aggregate gate):
Control UI browser platform family with a real Gateway > keeps signed browser identities while rendering fresh and legacy Mac and iPad labelsControl UI device alias rename with a real Gateway > persists a Devices-page alias rename through the real Gateway across reload and restartBoth fail with
DeviceIdentityStorageErrorbecause their fixture identity paths are outside the canonical client credential directory. The same two names fail with the same error on exact merge based7711afad42b91f356a7cebaa7846b708fd9765e(2 files, 2 failures; default repository runtime, one worker). All ten relevant source/dependency blobs match that base, the CI main parent23d16def50f0fae3ae4c966631861c44c658e32b, and CI mergeb44b9a1ea773d85c151699e3aaa8f751a7a43f8e. Every other selected CI job passed or was intentionally skipped. Landing uses the documented inherited-failure route; these failures are not claimed green.