feat(viz): expose lifetime stats on LosQueryManager - #78
Conversation
The audit routine asks "are queries dropping under load?" — the manager doesn't drop, it queues per-slot via `.then()` chains. Add a public `stats` getter (`totalQueries`, `totalRays`, `peakSlotDepth`) so an audit script (or future overlay) can confirm whether the ring buffer is enough or callers are queueing waiting for GPU + readback. `peakSlotDepth` of 1 means the GPU finished before the next query arrived on the same slot; > 1 means the simulation is pushing harder than the dispatch can settle. Pure additive observability — no behavioural change to existing mesh-link / LiDAR consumers. Sensor chunk +~150 B; main bundle unchanged at 808.9 KB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
Code Review
This pull request adds performance and usage tracking to the LosQueryManager by introducing a LosQueryStats type and a depth counter for each Slot. The query method was updated to maintain these statistics, including total queries, total rays, and peak slot depth, while ensuring the depth counter is decremented via a refined promise chain. I have no feedback to provide.
Surfaces the LosQueryStats added in PRs #78/#79 in a small dev/audit panel. Lets an operator confirm the WebGPU sensor primitive is healthy without dropping into devtools — useful both for the 2026-05-12 audit routine (P2 #5) and during dev when tuning ring sizing or world extents. - New `client/sensorStatsOverlay.ts` — `SensorStatsOverlay` class builds a fixed bottom-left panel, hidden by default. Press 'i' (KeyI; ignored when typing in inputs) to toggle. - Two sections (mesh-link, lidar) showing totalQueries / totalRays / peakSlotDepth / raysOutsideWorld. Cells colour amber when peak slot depth > 1 (callers queueing) or outside-AABB > 0 (sim is outside the brick map's coverage; project memory documents the 4 km terrain vs 1 km sensor world gap). - `update()` is called once per `ReceiveFrame`; short-circuits when the panel is hidden, so the closed-overlay cost is one boolean. - Falls back gracefully when `getSensorContext()` returns null (no-WebGPU browser, init failure) — the panel just shows "offline". Bundle: 809.0 → 811.3 KB (+2.3 KB; 99.0 % of the 800 KiB cap). Lands much more comfortably on top of #82 (defer-signalr), which would take this combined to ~756 KB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(viz): sensor-stats overlay (toggle with 'i') Surfaces the LosQueryStats added in PRs #78/#79 in a small dev/audit panel. Lets an operator confirm the WebGPU sensor primitive is healthy without dropping into devtools — useful both for the 2026-05-12 audit routine (P2 #5) and during dev when tuning ring sizing or world extents. - New `client/sensorStatsOverlay.ts` — `SensorStatsOverlay` class builds a fixed bottom-left panel, hidden by default. Press 'i' (KeyI; ignored when typing in inputs) to toggle. - Two sections (mesh-link, lidar) showing totalQueries / totalRays / peakSlotDepth / raysOutsideWorld. Cells colour amber when peak slot depth > 1 (callers queueing) or outside-AABB > 0 (sim is outside the brick map's coverage; project memory documents the 4 km terrain vs 1 km sensor world gap). - `update()` is called once per `ReceiveFrame`; short-circuits when the panel is hidden, so the closed-overlay cost is one boolean. - Falls back gracefully when `getSensorContext()` returns null (no-WebGPU browser, init failure) — the panel just shows "offline". Bundle: 809.0 → 811.3 KB (+2.3 KB; 99.0 % of the 800 KiB cap). Lands much more comfortably on top of #82 (defer-signalr), which would take this combined to ~756 KB. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * fix(viz): tighten overlay keybind + align CSS with design tokens Address Gemini review on PR #83: - Keybind: extend the input-bail list to cover SELECT (the operator may type 'i' to jump-search options), and require no shift key (uppercase 'I' shouldn't toggle a dev panel from within prose typed elsewhere). - CSS: replace `--fg` / `--muted` with the project's canonical `--text` / `--text-muted` (defined in `:root` lines 18-36); fix the `--warning` fallback to the palette colour `#d29922`. - Add `body.investor-mode .sensor-stats-overlay { display: none }` so the panel disappears during cinematic recordings — matches the visibility rule for the event log and telemetry strip. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
.then()chains — so the real signal is slot depth.statsgetter returning{ totalQueries, totalRays, peakSlotDepth }.peakSlotDepth > 1means callers are pushing harder than GPU + readback can settle on a single slot; an audit script or overlay can read this directly.Test plan
npm run buildpasses; main bundle unchanged at 808.9 KBtsc --noEmitcleanLosQueryStatsexported alongsideLosRayfor typed downstream consumers🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes