PR #11790 6th Cursor finding — state-coverage approach (stale prevZoomDomainRef + brush state machine cartesian test)
completedAgent: slava-agent
Priority: 1
Branch:
winston/bolt-1193-brush-zoom-auto-densifyPR: #11790
Linear: BOLT-1193
Cursor Bugbot 6th finding posted 2026-06-09T14:00:36Z on PR #11790 head 3b865ef8 (commit 2ee94bf review parent). High severity. Location: apps/dashboard/components/SiteEnergyCharts.tsx#L482.
FINDING: 'Stale zoom ref blocks brush — handleZoomChange dedupes against prevZoomDomainRef, but site-change and time-range effects call setZoomDomain(null) without clearing that ref. After a prior brush, brushing the same date window again is treated as unchanged, so zoomDomain never updates while handleZoomEnd may still change windowSize—brush zoom can fail or fight the controlled sync effect.'
This is structurally identical to the 5th finding (stale lastEchoedDomainRef in ChartBrush) — same anti-pattern (ref dedup not cleared on programmatic state reset), different ref, different file. This is now ROUND 6 in ~21h on the same brush/zoom state machine.
PER HEARTBEAT.md Step 4 / 3-rounds-then-state-coverage doctrine: do NOT spawn another round-by-round fix. Instead, the sub-agent task is:
1. ATOMIC FIX FIRST (mergeable as-is): Clear prevZoomDomainRef.current = null in BOTH effects that call setZoomDomain(null) — the [siteId] effect (~line 230-260) and the [timeRange.after, timeRange.before] effect (~line 282-318). Mirror the pattern already used for lastEchoedDomainRef.current = null in the brushRegion useEffect from ddfd351 fix. Add regression test exercising the cycle: brush [T1,T2] → site/range change → setZoomDomain(null) → re-brush [T1,T2] should fire onZoomChange with the new domain (not be deduped against stale ref).
2. STATE-COVERAGE TABLE (the actual deliverable): Enumerate the input axes of the brush/zoom state machine for SiteEnergyCharts + ChartBrush:
- brush on/off
- zoom on/off
- site change
- time-range change
- manual-granularity-change
- zoom-clear (via zoom-out button)
- re-brush of same window after programmatic clear
Write a cartesian-product (or state-table) test in SiteEnergyCharts.test.tsx that exercises every meaningful combination. Run against current HEAD (after step 1 fix). Surface any additional defects atomically. Fix in same push if any surface.
3. Add the state-table test as a regression guard.
4. Local Post-Push Protocol gates (mandatory): yarn workspace @texture/edges lint, tsc --noEmit, jest ChartBrush + SiteEnergyCharts + the new state-table test. Then yarn workspace @texture/dashboard lint, tsc --noEmit (because SiteEnergyCharts lives in apps/dashboard).
5. Push to winston/bolt-1193-brush-zoom-auto-densify (single commit if possible). Worktree: ~/agents/slava-agent/mono-bolt-1193, branch already at head 3b865ef.
6. Watch CI ~7-10 min. ASSUME-IMMEDIATE-MERGE applies — winston was merging fixes within the hour previously.
7. No DM to Slava (winston's PR, not Slava-authored). If a thread DM is appropriate, post in the existing Slack thread 1780958660.983969 (where prior Cato updates have landed) with the state-coverage result summary.
8. PATCH this fleet-task to completed with final commit SHA + CI summary + axes covered + any new defects surfaced by state-table.
Rationale: 6 Cursor Medium+/High rounds in 21h on same component is the textbook trigger for the 3-rounds-then-state-coverage doctrine. The pattern (stale ref dedup not cleared on programmatic state reset) is now established — the cartesian test should reveal whether there are other refs/effects with the same shape (e.g. windowSize alignment refs, coarseWindowSize refs, manualGranularity refs).
Event Timeline
created
status_change
queued → in_progress
failed
lease expired — re-queued for retry
in_progress → queued
status_change
queued → completed