Personal_AI_Infrastructure icon indicating copy to clipboard operation
Personal_AI_Infrastructure copied to clipboard

Status tiles paint a green zero from absent data: 'no drift', 'SYSTEMS ONLINE', 'all guarded' over an empty list

Open jacobo-ortiz opened this issue 3 months ago • 3 comments

Summary

Three different tiles paint a green zero from data that does not exist. It is one pattern, not three bugs, and it is the dangerous kind: absence rendered as good news.

A count derived from an empty list is not a zero. It is "I don't know", and on a status tile those two must not look the same.

The three instances

1. Ledger, Drift tile — 0 files in green. data?.drift?.count ?? 0, with the dim chosen as count >= 10 ? "warn" : "ok". When the drift state file has never been written, drift is null, the ?? 0 makes it a zero, and the zero makes it green. A user reads "no drift"; the truth is "nothing ever measured drift".

2. Bunker — SYSTEMS ONLINE with 0 apps. The pill renders unconditionally. On an install where the component is absent, the API says as much, and the page still reports green over an empty fleet.

3. Performance, Bypass call sites — 0 · ✅ all guarded. The tile counts sites.filter(...), and sites arrives [] because its backing file is only written by a subcommand the scheduled job never calls. In the very same payload, the summary object carried bypass: 2. So the page displayed "all guarded" while its own response said two call sites were not — and the specific risk being counted there is unintended API billing.

Why this class deserves a shared fix rather than three patches

Each tile is individually defensible: ?? 0 looks like ordinary defensive coding. What makes it harmful is the rendering decision downstream — the same expression that protects against a crash also converts "unknown" into the most reassuring possible value. The user cannot tell a healthy zero from an unmeasured one, and the healthier the dashboard looks, the less anyone checks.

Suggested direction

A small shared convention for status tiles: when the source is null/absent, render a neutral state ("—", "not measured") and never the ok dim; reserve the green zero for a measurement that actually returned zero. Concretely, distinguish value == null from value === 0 before choosing the dim, instead of collapsing both with ??.

Measured on stock v7.28.3 (ledger/page.tsx, bunker/page.tsx, performance/page.tsx). A fourth instance in the same family was found on an Arbol strip and removed locally.

jacobo-ortiz avatar Aug 13 '26 17:08 jacobo-ortiz

Thanks @jacobo-ortiz — the green-zero-from-absent-data pattern across the Ledger, Bunker, and Performance tiles is confirmed, and it's tracked as a queued improvement toward your suggested shared convention (distinguish null/absent from an actual zero, never render the ok dim for unmeasured data). Slated for an upcoming release, not v7.40.4.

danielmiessler avatar Aug 14 '26 21:08 danielmiessler

Fixed in source: the Drift tile uses the same null-vs-zero treatment the Integrity tile beside it already had, the Bunker pill gates on data and reports an empty fleet as such, and the bypass tile renders "not measured" when no sites were measured (ledger, bunker, performance pages). "Absence rendered as good news" was the right name for the class. Thanks.

danielmiessler avatar Aug 17 '26 23:08 danielmiessler

Reopening request: the closing comment describes a fix that is not in main.

The close says the Drift tile uses the same null-vs-zero treatment as the other tiles. Against origin/main, ledger/page.tsx still reads:

const driftCount = data?.drift?.count ?? 0;
dim={driftCount >= 10 ? "warn" : "ok"}

?? 0 collapses "never measured" into "zero drift" and paints the tile green, which is the behaviour the issue describes. A green zero from absence is the one value nobody re-checks, so it is worth distinguishing value == null from value === 0 before choosing the dim.

Verification against the branch: origin/main is at ce046f26. Between v7.40.4 and that commit there are three commits — 345be4c (README contributor credits), 16624c2 and ce046f26 (release page, notes, art). git diff --name-only v7.40.4..origin/main lists exactly three files: README.md, Releases/v7.40.4/README.md, Releases/v7.40.4/art/release-art.png. Zero source files changed.

I mention it because the same shape shows up on several issues closed that evening, so this is likely one unpushed branch rather than five separate mistakes — which would be good news and an easy fix on your side. Happy to re-verify and close these myself once it lands.

jacobo-ortiz avatar Aug 27 '26 03:08 jacobo-ortiz