Fix dashboard data correctness + prebuild embedded SPA#148
Open
Exelord wants to merge 1 commit into
Open
Conversation
Audit driving Playwright against this repo's actual cache.db (242 runs,
64 entries, 2 projects, 8 tasks) — instead of the 2-run scratch repo
the previous verifications used — surfaced four real bugs the user hit:
1. TaskDetail + ProjectDetail were completely broken on any id
containing # or /. useParams() in @solidjs/router returns the raw
URL-encoded segment; we then re-encoded it in the api layer, producing
%2540vzn%252Fvx%2523test on the wire — server decoded once and still
couldn't split on '#'. Decode at the page boundary, encode only at
the api layer.
2. Cache footprint Treemap rendered as a blank black box. The Treemap
uses SVG <rect>; bg-chart-N (background-color) does nothing on SVG.
Switch Treemap callers to fill-chart-N. The default fallback inside
the component also flipped to fill-.
3. UnoCSS safelist wasn't aware of the runtime-generated bg-chart-1..8
/ text-chart-* / stroke-chart-* / fill-chart-* used by paletteFor().
The static analyzer couldn't see template-literal classes. Added
them to the safelist.
4. Overview hero cards defaulted to 24h windows. On workspaces whose
last run was >24h ago — which is most of them — that showed "Time
saved <1ms / 0 cache hits / 0% hit rate" despite plenty of cached
data. Switched the hero to lifetime totals (always have signal) and
widened the activity chart to 30 days with day buckets.
Other fixes the audit produced:
- Parallelism chart x-axis was synthetic indices reading newest-to-oldest
("#49 → #0"). Use real startedAt timestamps with formatDate.
- getParallelismHistory now filters wall < 50ms invocations — sub-50ms
cpu/wall ratios are measurement noise and polluted the avg.
Prebuild embedded SPA so a fresh `bun build --compile` works without a
SPA build step (user ask: "prebuild cloud"):
- Add !apps/ui/dist/ to .gitignore
- Commit apps/ui/dist/index.html (130 KB single-file)
apps/ui/dist/index.html is regenerated by the build.ui task and embedded
via `with { type: 'file' }`. The previously-required build sequence
(install → build.ui → build.bun.*) still works; now a checkout that just
runs build.bun.* finds the dist already present.
Full CI gate green. Verified end-to-end with Playwright + the real cache.db.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
User: "your testing needs to be wrong or holes. all data is wrong, works so so, not useful things. and prebuild cloud."
They were right. The previous PRs (#143–#147) "PASS"ed verification because I ran them against
/tmp/uitestNworkspaces with 2 runs — enough for the app to mount, not enough to surface real data bugs. Driving the dashboard against this repo's actual cache.db (242 runs, 64 entries, 2 projects, 8 tasks) surfaced four real bugs that hit any non-trivial workspace.Bugs the broader audit found
TaskDetail + ProjectDetail were completely broken on any id containing
#or/(i.e. every real id like@vzn/vx#test).useParams()from@solidjs/routerreturns the raw URL-encoded segment; my api layer then re-encoded it, producing%2540vzn%252Fvx%2523teston the wire. Server decoded once and still couldn't split on#. Fix: decode at the page boundary, encode only at the api layer.Cache footprint Treemap was a blank black box. The Treemap renders SVG
<rect>;bg-chart-N(background-color) does nothing on SVG. Switched callers tofill-chart-N. The default fallback inside the component also flipped tofill-.UnoCSS safelist was missing the runtime chart palette.
paletteFor()generatesbg-chart-1..bg-chart-8at runtime via template literals; UnoCSS's static analyzer can't see them, so the rules were absent. Addedbg-/text-/stroke-/fill-/border-chart-{1..8}to the safelist.Overview hero cards defaulted to 24h windows. On a typical workspace where the last run was >24h ago — which describes most workspaces most of the time — every hero showed "Time saved <1ms / 0 hits / 0% rate" despite plenty of cached data. Switched the hero to lifetime totals (always have signal); widened the activity chart to 30 days with day buckets.
Plus
#49 → #0). Replaced with realstartedAttimestamps viaformatDate.getParallelismHistorynow filters wall < 50 ms invocations — sub-50 ms cpu/wall ratios are measurement noise and were polluting the average down to ~0.5×.Prebuilt embedded SPA
User: "prebuild cloud" — interpreted as: a fresh checkout should be able to
bun build --compilewithout first installing 700 npm packages just to build the SPA..gitignorenow exempts!apps/ui/dist/apps/ui/dist/index.html(130 KB single self-contained HTML) is committedbuild.uivx task still regenerates it on UI changes; binaries still embed the freshest version viawith { type: 'file' }bun build --compile src/bin.tsno longer fails on a missing importVerification (the protocol that should have been used from day 1)
Drove a Playwright Chromium against the compiled
dist/vx-linux-x64running against this repo's real.vx/cache/cache.db— not a scratch workspace. Captured all 10 pages (Overview, Projects, Project detail for@vzn/vx, Tasks, three Task detail pages —#test,#lint.oxlint,#build.ui, Bottlenecks, Trends, Cache). Zero console / page / request errors after the fixes. Treemap renders. Hero shows lifetime totals. Task/Project detail pages work.Test plan
bun src/bin.ts run ci— full gate green (934 tests, 24 metrics tests)@vzn/vx#test,@vzn/vx#lint.oxlint,@vzn/vx#build.ui@vzn/vxGenerated by Claude Code