The question
Operations Snapshot Dashboard shows data from other systems, called its sources. A source hands over its data as snapshotsOperations Ledger · Operations Snapshot Dashboard · The dashboardSnapshot checksPicks the newest record first. Then it checks the format version and the features the system says it has. Last, it checks that the content matches its fingerprint code and that the times make sense.See it in the Operations Ledger build, each a copy of the data at one moment. It can send several snapshots of the same thing, some older and some newer. Which one should the dashboard show?
What made it hard
The easy answer is the newest snapshot that passes the checks. But when a source's latest update is broken, the dashboard would skip it and show an older one that passes. The page would look healthy while the source was failing.
What I chose
The dashboard chooses first and checks second. It sorts the snapshots by the time their data describes. If that time is missing, it uses the time the snapshot was made. Then it checks only the newest snapshot of each thing. If that one fails, the page shows the failure.
What the page shows depends on what failed. If the dashboard doesn't know a snapshot's version, it marks it as not compatible. Some snapshots have broken content or a time in the future. Others no longer match their fingerprint, a short code made from the content that changes when the content changes. These are marked as needing review, and none of that snapshot's data is used. A snapshot that passes but has expired is different. It is marked out of dateOperations Ledger · Operations Snapshot Dashboard · The dashboardCombined viewKeeps each system's status, the data it accepted and the reason for any error. Expired data gets an out-of-date label.See it in the Operations Ledger build, and its data stays on screen with that label.
Each source keeps its own status. So when one source fails, the good data from the other is still shown.
How I know it works
The main test gives the dashboard an older snapshot that passes and a newer broken one. It expects the status to say the snapshot needs review, and no data to be used. Other tests cover missing sources and expired data. More tests cover changed fingerprints and times in the future.