koala73 / koala73/worldmonitor
perf(cls): secondary mid-session insertion tail — enable-without-shell path + zone moves (~45 ins:/16h, post-#5344 residual)
- Dominant language
- TypeScript
- Stars
- 86.6k
- Forks
- 13.1k
- Avg merge
- 8h 4m
- Merged PRs (30d)
- 825
Description
## Context
The #5344 fix eliminated the dominant desktop-CLS mechanism (immediate-tier boot insertions): `ins:` mover tokens for the top-8 keys went 1,305/day → 0 and have stayed at zero through T+33h. With the noise floor gone, the mover instrumentation (#5336) now resolves a much smaller SECONDARY insertion class that was previously invisible under the boot-insertion noise.
## Field data (post-merge daytime window, 07-17 12:30–20:30Z-ish, 99 desktop bad-CLS events)
- `ins:` tokens: 45/16h total (vs 1,305/day for the fixed mechanism — ~30× smaller)
- Keys: `consumer-prices` ×4, `earnings-calendar` ×3, `economic-calendar` ×3, `supply-chain` ×2, `commodities` ×2, `markets` ×2, long tail ×1
- These are NOT the immediate-tier 8. Deferred-tier boot mounts replace their shells in place (the `data-panel` key persists across the swap, so they can't read as `ins:`) — these are **mid-session insertions**.
## Candidate mechanisms (code-grounded)
1. **Mid-session enable without a shell** — a panel disabled at boot gets `deferPanelMount(key, null, grid, /* withShell */ false)` (`src/app/panel-layout.ts` `insertInitialPanelByKey`). A later enable (Settings toggle, cloud-prefs sync arriving post-boot) hits `applyPanelSettings` → `mountDeferredPanel` → `mountPanelElement` with `placeholder=null` → raw `insertByOrder` into the live grid. The shell contract has a gap for exactly this path: the enable *could* insert a shell first, then replace on chunk arrival.
2. **Ultra-wide zone moves** — `ensureCorrectZones` moves panels between `#panelsGrid` and `#mapBottomGrid` on effective-width flips; the mover tracker snapshots only `#panelsGrid`, so an inbound move reads as `ins:`. Partially instrumentation artifact, partially a real shift (the move does displace siblings).
3. **User add-panel** — inherently an insertion; often input-adjacent (`hadRecentInput` gates some but the async chunk arrival lands outside the 500ms input window).
Also observed: uniform mass-`sized:` events (many keys ×8 in the same window) consistent with window-resize/zoom reflows — user-driven, likely not actionable.
## Scale / priority
P3. Desktop full-population CLS p75 is 0.007 (DebugBear, n=8.6k) — this tail does not threaten the pass. Worth fixing only the clean gap (mechanism 1: shell-first mid-session enables, reusing the existing contract) if the class persists across a week of data; mechanisms 2–3 need a tracker tweak (snapshot both grids; tag input-adjacent records) before being judged.
## Acceptance
`ins:` tokens from non-immediate keys trend to ~0 in `extra.movers`; residual `cold` class unaffected.
Contributor guide
Research direction
Start in src/app/panel-layout.ts, tracing insertInitialPanelByKey through applyPanelSettings, mountDeferredPanel, and mountPanelElement, then inspect ensureCorrectZones for moves between the two grids. Compare the affected paths with extra.movers and determine whether non-immediate enable operations insert without a shell. Done means the non-immediate ins: tokens trend toward zero while the residual cold class remains unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100