From 751c15f9ebb33f1479bb9a10cd39c4c4a131cd6b Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Sat, 25 Jul 2026 12:58:11 -0700 Subject: [PATCH] lint(desktop): exempt benign ref writes flagged by the new atom-mirror guard The guard matches any `.current` write inside a `useEffect`, so it also flags refs that are not mirroring a reactive value. Seven such sites landed on main after the rule was written: - wiring.tsx: one-shot request-seen sentinel - billing/plans-view.tsx: previous-confirming tracker for focus return - config-settings.tsx: autosave bookkeeping - gateway-settings.tsx: monotonic request-sequence counters - toolset-config-panel.tsx: mount flag + one-shot provider-choice claim - voice-provider-fields.tsx: one-shot config seed flag None mirrors an atom/prop/state value, so none can produce the one-render-lag stale read the rule exists to prevent. Each gets an eslint-disable with the specific reason rather than widening the rule, which would reopen the hole for real mirrors. Verified the guard still catches the real antipattern: a probe file mirroring `useStore($activeSessionId)` into a ref via useEffect is reported. eslint over apps/desktop/src is 0 errors, and the 24 remaining warnings match the pre-change baseline exactly. --- apps/desktop/src/app/contrib/wiring.tsx | 1 + apps/desktop/src/app/settings/billing/plans-view.tsx | 1 + apps/desktop/src/app/settings/config-settings.tsx | 1 + apps/desktop/src/app/settings/gateway-settings.tsx | 1 + apps/desktop/src/app/settings/toolset-config-panel.tsx | 2 ++ apps/desktop/src/app/settings/voice-provider-fields.tsx | 1 + 6 files changed, 7 insertions(+) diff --git a/apps/desktop/src/app/contrib/wiring.tsx b/apps/desktop/src/app/contrib/wiring.tsx index 60536b2267fb..e8716bde9262 100644 --- a/apps/desktop/src/app/contrib/wiring.tsx +++ b/apps/desktop/src/app/contrib/wiring.tsx @@ -142,6 +142,7 @@ export function ContribWiring({ children }: { children: ReactNode }) { const billingSettingsRequest = useStore($billingSettingsRequest) const currentCwd = useStore($currentCwd) + // eslint-disable-next-line no-restricted-syntax -- one-shot request-seen sentinel, not an atom mirror useEffect(() => { if (billingSettingsRequest === billingSettingsSeenRef.current) { return diff --git a/apps/desktop/src/app/settings/billing/plans-view.tsx b/apps/desktop/src/app/settings/billing/plans-view.tsx index b0d1fd6b7032..728a8142387f 100644 --- a/apps/desktop/src/app/settings/billing/plans-view.tsx +++ b/apps/desktop/src/app/settings/billing/plans-view.tsx @@ -118,6 +118,7 @@ function PlanCard({ flow, tier }: { flow: DowngradeFlow; tier: BillingPlanTierVi // When the confirm panel closes (cancel / scheduled), return focus to this tile // so keyboard focus is never left detached on the removed panel. + // eslint-disable-next-line no-restricted-syntax -- tracks previous confirming state for focus return, not an atom mirror useEffect(() => { if (wasConfirming.current && !confirming) { cardRef.current?.focus() diff --git a/apps/desktop/src/app/settings/config-settings.tsx b/apps/desktop/src/app/settings/config-settings.tsx index 5625339bbf50..c97d5b720090 100644 --- a/apps/desktop/src/app/settings/config-settings.tsx +++ b/apps/desktop/src/app/settings/config-settings.tsx @@ -127,6 +127,7 @@ export function ConfigSettings({ return () => void (cancelled = true) }, []) + // eslint-disable-next-line no-restricted-syntax -- autosave bookkeeping refs, not an atom mirror useEffect(() => { if (!config || saveVersion === 0) { return diff --git a/apps/desktop/src/app/settings/gateway-settings.tsx b/apps/desktop/src/app/settings/gateway-settings.tsx index 91e1a1178450..eafe0ce2f376 100644 --- a/apps/desktop/src/app/settings/gateway-settings.tsx +++ b/apps/desktop/src/app/settings/gateway-settings.tsx @@ -404,6 +404,7 @@ export function GatewaySettings({ embedded = false }: { embedded?: boolean } = { return () => void (cancelled = true) }, [state.mode]) + // eslint-disable-next-line no-restricted-syntax -- monotonic request-sequence counters, not an atom mirror useEffect(() => { contextSeq.current += 1 sshTestSeq.current += 1 diff --git a/apps/desktop/src/app/settings/toolset-config-panel.tsx b/apps/desktop/src/app/settings/toolset-config-panel.tsx index 6d81a5136bbc..02281a089b01 100644 --- a/apps/desktop/src/app/settings/toolset-config-panel.tsx +++ b/apps/desktop/src/app/settings/toolset-config-panel.tsx @@ -497,6 +497,7 @@ export function ToolsetConfigPanel({ toolset, onConfiguredChange }: ToolsetConfi // Guard the Nous Portal sign-in poll loop against unmount/state updates. const mountedRef = useRef(true) + // eslint-disable-next-line no-restricted-syntax -- mount flag guarding an async poll loop, not an atom mirror useEffect(() => { mountedRef.current = true @@ -538,6 +539,7 @@ export function ToolsetConfigPanel({ toolset, onConfiguredChange }: ToolsetConfi // first fully-configured provider, else the first provider. Without this the // panel highlighted the first keyless provider (e.g. Nous Portal) even when // the user had already selected another (e.g. DuckDuckGo). + // eslint-disable-next-line no-restricted-syntax -- one-shot provider-choice claim flag, not an atom mirror useEffect(() => { if (providerChoiceClaimedRef.current || activeProvider || providers.length === 0) { return diff --git a/apps/desktop/src/app/settings/voice-provider-fields.tsx b/apps/desktop/src/app/settings/voice-provider-fields.tsx index 89b2e2dd9043..9b3a2cdd1f51 100644 --- a/apps/desktop/src/app/settings/voice-provider-fields.tsx +++ b/apps/desktop/src/app/settings/voice-provider-fields.tsx @@ -47,6 +47,7 @@ export function VoiceProviderFields({ section, providerKey }: { section: 'tts' | const [config, setConfig] = useState(null) const seeded = useRef(false) + // eslint-disable-next-line no-restricted-syntax -- one-shot config seed flag, not an atom mirror useEffect(() => { if (loadedConfig && !seeded.current) { seeded.current = true