An image-analysis dashboard tracks progress per source lane: how many assets the vault holds under each label, and how many of them the analysis pipeline has already read. One lane, the one for assets with no label, showed 985 assets and 8,864 read. Progress: 899.9%.

Numerator from the past, denominator from the present

The read count was grouped by the source label stored in a local asset cache. The total came live from the vault. Assets that had been labelled in the vault since they were first cached still carried their original empty label in the cache, because the cache routine updated the asset but never its metadata on a repeat fetch. The vault's current count for the empty label was small; the cache's accumulated reads under that label included thousands of assets that had since moved elsewhere.

The first fix refreshed metadata on re-fetch and, where the cache count and the live count disagreed, showed the lane as unverified instead of computing a percentage. That stopped the absurd number. It did not restore a correct one.

The second pass

A re-check the next day said as much: holding the display did not recover the real progress, and comparing counts was insufficient because the same count can hide a changed membership. The replacement reads the vault's complete current list of image IDs with their labels, swaps it atomically into an inventory table, and counts reads by joining observations against that list. If the fetch fails midway, the count changes during the fetch, a page repeats, or the per-label totals disagree, the previous inventory is kept. The rebuild took 5.46 seconds for 34,707 assets in isolation and 5.88 seconds live. The empty-label lane came out at 308 of 985, 31.3%.

A third pass, requested as one more check, found two failure paths in the new code. A 503 from the label endpoint had been treated as an empty label list, which would have emptied the inventory; it now fails explicitly, and an empty list is only accepted after the asset total is confirmed to be zero. And re-entering the dashboard tab quickly left two polling timers alive, reproduced in a headless test as 2 instead of 1; a generation counter now invalidates stale entries. Tests went from 130 to 138. The dashboard had also been polling a 6.45-second endpoint every 3 seconds, which was fixed in passing.