refactor(extension): unify Options wiring and settings normalization - #417
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. Reviewed September 5, 2026, 12:25 AM ET / 04:25 UTC. ClawSweeper reviewWhat this changesSimplifies the Chrome extension’s Options wiring and shares settings normalization while retaining existing preferences, migrations, and managed-policy handling. Merge readiness✅ Ready for maintainer review Keep open as a useful maintenance refactor with no actionable introduced defects found. The consolidation is absent from current main and v0.21.11, and this owner-authored PR is protected from cleanup closure. Priority: P3 Review scores
Verification
How this fits togetherThe extension’s Options page edits preferences stored in browser storage. Loading normalizes those preferences and applies administrator policy before they control summaries, slides, and other extension behavior. flowchart LR
A[Stored preferences] --> B[Load and legacy migration]
B --> C[Shared normalization]
D[Options controls] --> C
C -->|Save| E[Remove policy metadata]
E --> A
C -->|Load| F[Apply administrator policy]
F --> G[Effective settings]
G --> D
G --> H[Extension behavior]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest possible solution: Preserve the existing settings contract with one normalization implementation and explicit boundaries for legacy migration, persistence, and administrator policy. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor does not report a behavioral bug, and source review found no introduced failure requiring reproduction. Is this the best way to solve the issue? Yes: reusing the existing element collection and sharing equivalent normalization removes duplication without introducing another settings interface or migration path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a940f4849aaf. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
One owner for Options wiring and settings normalization
Options previously unpacked its DOM collection and reconstructed large overlapping projections, then maintained nine copies of checkbox-controller wiring. It now passes the existing collection to narrow consumers and declares checkbox IDs, labels, and state keys once. Viewer-specific mappings and runtime-radio permission gates remain explicit.
Settings load and save share normalization without sharing the wrong responsibilities: legacy migrations remain load-only, managed policy is applied only to effective settings, unknown stored fields survive, and policy metadata is never persisted. The form and checkbox runtime use the same state type.
This removes 237 production lines and adds regression coverage, for a net reduction of 175 lines. There are no public API, dependency, or intended behavior changes.
Proof
Before and after
Synthetic General-tab captures are byte-identical. The same inspected image therefore represents both before and after; only the build label was fixed to synthetic text for comparison.
Hosted CI passes on the exact PR head: Node 24 gate, Chromium E2E, and Firefox smoke, with security checks green.