1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// The recorded-snapshot build of this UI: the same components, the same
// rendering, answers served from a file instead of from a server.
//
// It exists so the documentation site can host a version someone can click
// through without installing anything. It is *not* a wasm build of the engine
// and does not pretend to be one: the responses in `fixtures.json` were
// recorded from a real Mira over the demo generator by
// `scripts/capture-ui-fixtures.sh`, and this module hands them back. What is
// real is every byte of the UI — the tables, the waterfall, the service map,
// the chart, the detail panes, the paging, the routing. What is not real is
// the query: typing a filter re-renders from the same recorded rows rather
// than re-reading blocks, because there are no blocks in a browser tab.
//
// Compiling the engine itself to wasm would make the query real, and it is not
// out of reach — `mira-core` reads through `mmap` and a browser has no `mmap`,
// so the block reader would need a second backend over an `ArrayBuffer`. That
// is a real piece of work with a real payoff and it is not this. The banner
// says which of the two the reader is looking at, because a demo that implies
// it is measuring something it is not is worse than no demo.
//
// This whole module is tree-shaken out of the ordinary build: `api.js` reaches
// it behind `__REPLAY__`, a literal substituted by `vite.config.js`, so the
// binary's UI never carries the fixtures. Verified rather than assumed —
// `make ui` produces a 76 KB bundle and `make ui-demo` a 1.77 MB one.
// The import attribute is not decoration: Vite infers the type from the
// extension, but `node --test` refuses a bare JSON import, and this module has
// tests. One clause keeps both loaders happy.
import fixtures from './fixtures.json' with
/// Which recorded response answers this request.
///
/// Coarser than the request, deliberately. The UI can generate more distinct
/// bodies than anyone would record — seven ranges times three signals times
/// any filter that can be typed — so the key drops everything the recording
/// cannot honour and keeps the two things that change what is on screen: which
/// signal, and which page of it.
export
/// The recorded answer, or the nearest one. Never a rejection: a missing
/// fixture is a gap in the recording, not a server that fell over, and an
/// error banner would send the reader looking for a cause that is not there.
export
/// What the UI puts in the header when a response carries no stats of its own.
/// Zeroed rather than invented: the recording has real numbers for every
/// endpoint that returns them, and this is only reached on a fallback.
const STATS =