Repository navigation
Commit 6bf7f48
authored
perf(queue): single-census read model (#1130)
The queue status read model walked the full item set repeatedly per request:
twelve full traversals, seven Object.values materializations, and post-hoc
sorts to find oldest entries -- O(queue-size) work multiplied per pass, on a
path the dashboard polls continuously. Deferred as high-risk while the code
lived inside the 15k-line Durable Object module; PR #1124's extraction to
exact-review-read-model.ts made it a self-contained pure-module change.
One traversal now builds a census (per-lane/state counts, oldest entries
tracked during the walk, active targets, ready items, wake and Bay
candidates); the public functions consume it and return byte-identical
outputs with unchanged signatures. Measured: 12 -> 1 full traversals,
7 -> 1 materializations, 21.25 -> 1.67 equivalent passes.
Proof: property-style equivalence against the pre-change implementation
across seeded randomized queue states, plus six normalized real-Worker
response comparisons (queue and status endpoints, merge-base vs head) all
byte-identical, verified in a Docker-backed Crabbox container on the exact
head with committed receipt.1 parent 9c7445b commit 6bf7f48
7 files changed
Lines changed: 2208 additions & 318 deletions
File tree
- dashboard
- docs/proof/single-census-read-model
- test
- fixtures
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
3092 | 3092 | | |
3093 | 3093 | | |
3094 | 3094 | | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
3095 | 3100 | | |
3096 | 3101 | | |
3097 | | - | |
3098 | | - | |
3099 | | - | |
3100 | | - | |
3101 | | - | |
| 3102 | + | |
3102 | 3103 | | |
3103 | 3104 | | |
3104 | 3105 | | |
| |||
0 commit comments