Repository navigation
refactor(ui): derive native device settings types from schemas - #144705
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. |
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 8:54 AM ET / 12:54 UTC (Revision 4). ClawSweeper reviewWhat this changesReplace duplicated native settings types and handwritten validators with Zod schemas that infer types and return validated copies of host settings. Merge readiness✅ Ready for maintainer review No actionable regression found. This remains a useful, bounded refactor absent from current main; member authorship and the protected maintainer label also preclude automatic closure. Priority: P3 Review scores
Verification
How this fits togetherThe Control UI receives device settings from the macOS or iOS app through a WebKit bridge. Validated snapshots populate device settings pages, while edits return to the native app for authoritative handling. flowchart LR
A[Native app settings] --> B[WebKit bridge]
B --> C[Snapshot validation]
C --> D[Settings cache and subscribers]
D --> E[Device settings pages]
E --> F[Typed edit commands]
F --> B
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -144. Total -144 across 1 file. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep one schema-owned UI snapshot contract while native apps retain ownership of settings changes and permission decisions. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor, and source inspection found no introduced failure requiring reproduction. Is this the best way to solve the issue? Yes: inferring types from the existing validation owner removes duplication, and inspected consumers do not depend on retained unknown fields or raw host-object identity. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 66c7fad06385. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (3 earlier review cycles) |
|
/clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
…ive-device-settings-schema
* commit 'f2ce199238e974b1d4caff8f11112aa51eb00d9e': (310 commits) refactor(copilot): deduplicate transcript user text (#144888) refactor(sessions): await discovery and config readiness (#144854) refactor(e2e): deduplicate release file assertions (#144904) ci: keep growing hosted test plans within the job cap (#144965) fix(macos): avoid stale dashboard command assertions (#144710) refactor(memory): await standing intent operations (#144832) refactor(ui): derive native device settings types from schemas (#144705) refactor(memory): await journal operations and allocate sequences atomically (#144824) refactor(tests): share command field assertions (#144955) refactor(matrix): share bounded context cache insertion (#144939) refactor(i18n): share Apple catalog reader (#144848) fix(doctor): preserve legacy registry files when quarantine fails (#144787) refactor(tests): reuse PixVerse auth fixtures (#144926) fix(bonjour): silence transient ENODEV socket warnings (#144870) fix(matrix): preserve unrelated files when migration fails (#144883) feat(sqlite): run Team Reports storage in owned workers (#144871) fix(update): install explicit same-version artifacts (#144894) refactor(ui): share cached message extraction (#144244) refactor: normalize Claude usage responses at one boundary (#144707) refactor: simplify CLI child listener registration (#144929) ...
…law#144705) Consolidate native device settings validation and inferred types with the existing Zod dependency. Consume parsed snapshots directly while preserving invalid-input handling and authoritative edit settlement.
What Problem This Solves
Native device settings define the same snapshot shape twice: once as a TypeScript type and again in a long runtime validator. Adding a native setting requires keeping both definitions aligned.
Why This Change Was Made
Use the UI's existing Zod dependency to define the consumed snapshot and Chrome setup result shapes, then infer their types. All three snapshot boundaries consume the parsed schema output directly. Unknown host fields are stripped and snapshots are parsed copies; consumers use declared fields and subscriptions, with no observed dependency on raw host object identity. No native host, command, or contract-version changes.
User Impact
No intended user-visible change. macOS and iOS retain their optional settings families, permission order and uniqueness checks, required nullable values, authoritative edit replies, and Chrome setup errors.
Change breakdown
Evidence
A before/after probe exercised both implementations through the bridge with the existing macOS/iOS fixtures:
At the earlier
5db7566revision, 2,582 snapshot comparisons passed, plus event/edit identity and Chrome setup projection/error checks. These identity results do not describe the current parsed-copy implementation. The temporary probe files are no longer available; this is recorded execution evidence, not a retained reproducer.Validation of the committed source bytes:
tbx_01m27d9zzqnhprzb3qkv97bem9).tbx_01m27dcsdmcha00287h68hwerc).git diff --checkpassed.Test/build environment, type/lint environment.
All four existing native settings browser scenarios passed on Blacksmith Testbox (
tbx_01m27fj8pgarv3tyhv9kdb8drr): iPhone light/dark settings, Mac settings and permission requests, browser-only absence, and canceled/newer edits across navigation. Browser proof environment.The following captures were inspected from that completed Chromium run at head
5db756653b13c03e85ab13dd94452e151237f0e5. They use mocked native-host and Gateway state; no live OS settings or signed native-app proof is claimed. No visual redesign was made.Confirmed iPhone appearance setting (375 × 812)
The Appearance field reflects the native reply's Dark selection.
Mac settings after authoritative replies (1440 × 1800)
The Dock icon is Origami and Show Dock icon is off after the host confirms both edits.
To repeat the browser check:
Review status at
5db756653b13c03e85ab13dd94452e151237f0e5: two native review passes and one independent cold review pass found no actionable regressions; no review fixes were needed. ClawSweeper acknowledged the re-review request but has not supplied a verdict, so the complete code-review gate remains unfinished.This PR remains draft because exact-head CI has failed:
session-link-presentation.browser.test.ts:69expectsinline-gridbut receivesgrid. This CSS-only test does not import the changed native settings module. No separate base-run reproduction is claimed.ECONNRESET, followed by its installer throwingReferenceError: err is not defined. Tests did not run.Neither failure has been changed or rerun as part of this one-file refactor. Required CI and ClawSweeper review must complete before readiness; no merge is authorized.
Current-head follow-up
At
32fe150e9ad212bd132fd05fa792841641ef78d3, removedisSnapshotand usedsafeParseplus typeddataat startup, change events, and authoritative edit replies. Invalid-input handling is preserved. This deliberately replaces raw snapshot identity/unknown-field retention with schema-owned output.The exact committed source passed all 34 focused native settings tests, UI typecheck, targeted type-aware lint (zero warnings/errors), formatting, and diff checks. Current validation run, Blacksmith Testbox
tbx_01m27gnyevcm21fbh2vp7n9gdb(stopped). Earlier browser captures and native/cold review remain evidence for the earlier revision; they have not been rerun for this follow-up. ClawSweeper review of the current head is requested separately. The PR remains draft.Merge checkpoint
Fresh final-head review completed: two native passes and independent general, TypeScript, and test reviews found no actionable regressions. ClawSweeper reviewed this head with no findings and a platinum rating; its additional confirmation request is pending.
Current-head CI run34597691317 passed all three UI test shards, all13 UI E2E shards, and UI performance. Merge remains blocked by android-test-play:1 of3189 Kotlin tests failed when
SettingsScreensContrastTest.chatHeaderDoesNotAnnounceOfflineForConnectedHealthFailurecould not displayNew chat, Readyafter reconnect (SettingsScreensContrastTest.kt:364). The changed file is a TS WebKit bridge and does not modify Android; no base reproduction or rerun is claimed. Required CI has not passed. No merge or cleanup has been performed.Android failure attribution and base refresh
Confirmed unrelated to this change: merged PR144682 records the identical
New chat, Readyfailure on main and fixes the race between ViewModel state and Compose rendering. Its commit1bd25b2471c7f56289ad20e7ee6085d2b9615bb7was absent from the failing head. The entire Android tree was identical between our original base and head (006eb01c04e5427c329cee936ea1b05b80681032), and the Gradle task does not consume the changed TS module.Merged current main
66c7fad06385986bc426a64d87a020f9b24b5fbbnormally into the feature branch, producingb5ca7aa7bb7d7303bd62fc794f74507c3153803b. No force push. The PR remains a one-file diff (+145/-289), with unchanged patch fingerprinteda479502d6f5a4d01a3486962b9ab806c949c01. Current-head CI must run against this refreshed base before merge.