From ccf976559726286714b1e11975f4493d1c9ab3ef Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 30 May 2026 08:54:15 +0000 Subject: [PATCH 1/3] fix(frontend): kill sidebar refresh/rotate flash + re-park chart crosshair on sidebar toggle; guard 2 flaky tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bug A — sidebar "opens then shrinks back by itself" on refresh OR portrait↔landscape rotation: - Pre-paint a `.sidebar-collapsed` class (inline script in layout.tsx) + a globals.css rule renders the collapsed rail at its narrow width before React hydrates (the static export bakes the EXPANDED markup) — no wide→narrow flash on refresh. AppShell keeps the class synced to live state. - Gate the aside width/transform transition behind an `animate` flag that's on only for ~250ms around an EXPLICIT user toggle; refresh + rotation + resize switch instantly (no shrink animation). Explicit toggles still animate smoothly. Bug B — chart crosshair jumps to the far left when the sidebar expands/ collapses: - Replace the orientation-only matchMedia re-park with a width-delta ResizeObserver on the chart wrapper that debounce-bumps the AreaChart remount key after the container re-measures, re-parking defaultIndex at the latest point. Subsumes rotation + now also catches sidebar toggle + resize. Flaky tests (finish the shallow-clone / network hardening): - test_ranking_history smoke: explicit pytest.skip on an empty frame (shallow CI clone, fetch-depth=1) — mirrors the #325 + PR #284 guard; proven on a real depth-1 clone (46/46 git-dependent tests pass). - test_osap import scout: check the OpenAP API surface on the class instead of instantiating (the openassetpricing 0.0.2 ctor does a live Google-Drive fetch → flaky on Drive quota); the live path stays in the @network test. Verified: ruff clean; pytest -m "not network" 1407 passed; tsc clean on edited files; next build 506 routes; Playwright empirical Bug A x3 + Bug B all PASS. https://claude.ai/code/session_0144kHrCYNaamMPH57b7xdM7 --- PHASE_STATUS_INFLIGHT.md | 85 +++++++++++++++++++ frontend/app/globals.css | 22 +++++ frontend/app/layout.tsx | 12 +++ frontend/components/AppShell.tsx | 41 ++++++++- frontend/components/PriceHistoryChart.tsx | 62 +++++++++----- frontend/components/Sidebar.tsx | 13 ++- tests/test_ingest/test_osap.py | 15 ++-- tests/test_validation/test_ranking_history.py | 11 +++ 8 files changed, 229 insertions(+), 32 deletions(-) diff --git a/PHASE_STATUS_INFLIGHT.md b/PHASE_STATUS_INFLIGHT.md index 6295f963c..f9cd25bf7 100644 --- a/PHASE_STATUS_INFLIGHT.md +++ b/PHASE_STATUS_INFLIGHT.md @@ -3867,3 +3867,88 @@ x-position (x9), same fill, rounded-sm; screenshot confirms the chevron box now matches the nav-item box. `tsc` + `next build` (506) clean. --- + +## Stability bug-fix bundle — sidebar refresh/rotate flash + chart crosshair re-park + 2 flaky-test guards (in flight, 2026-05-30) + +Three stability fixes on `claude/optimistic-brown-UUcXA`, all post-#325. Two +are the user-reported sidebar/chart bugs; two are flaky-test hardening +("เก็บ flaky ให้ครบ"). Frontend + test-only — zero schema / compute / scoring / +valuation / output-JSON change. + +**Bug A — "sidebar opens then shrinks back by itself" on refresh OR +portrait↔landscape rotation.** Two root causes, two-part fix: +- The static export bakes the EXPANDED rail into every page's HTML, so on + refresh the rail painted wide, then `AppShell`'s mount effect read + `localStorage['quantrank.sidebar.collapsed']` and collapsed it — a visible + width shrink. Fix: a pre-paint inline `