Skip to content
The record
Finding9 August 20265 min read

A queue that survives a power cut, and why durable storage is not the same as a safe read

An offline audit queue held in memory lost six audits on a single bench power-down with no indication anything had been lost, so the queue moved onto the USB stick itself — and a month later the same component's read path proved destructive, rewriting as empty a queue file it had merely failed to parse.

hardware-testingsystemsmethod

What was done

The station's offline audit queue was held in /tmp, which is a tmpfs on a live USB boot, so a technician who audited six machines with no network and then powered down lost all six silently. The queue moved onto the USB stick itself, beside the station's config, with RAM kept only as a fallback for when the stick refuses a write. A month later the same component's read path turned out to be the real hazard: a queue file that existed but could not be fully parsed was read as empty and then rewritten, destroying the records it had failed to read. The reader now returns a two-part answer — the records plus whether it saw all of them — and anything that writes the file back refuses on a not-ok read. Alongside it: a version stamp on the stick so a bug report can name a build, a cache flush before the stick is pulled, and a network check that stops calling a filtered ping an outage.

        read the queue file on the stick
                    |
   +----------------+-----------------+
   |                |                 |
 missing      present, parses   present, won't read
   |                |            or truncated line
 ([], ok)     (records, ok)     (partial, NOT ok)
   |                |                 |
 empty queue    flush and        show it, refuse
 fresh stick    send             to write it back
                                 ^ folding this case
                                   into "empty" is what
                                   rewrote the file

Three outcomes from one read, where there used to be two.


Status

Shipped, 9 August 2026.

The durable queue

keep the offline queue on the stick so a power-off cannot lose an audit.

The station held queued audit records in memory. A technician who audited six machines with no network and then powered down lost all six, with no indication that anything had been lost. On a bench where machines are powered off as a matter of course, this was a question of when, not whether.

The queue moved onto the USB stick itself. The stick is the one thing guaranteed to still be there after a power cut.

This is also the component whose read path was found to be destructive a month later: a queue file that existed but could not be fully read was treated as empty and then rewritten, destroying the records it had failed to parse. Making storage durable and making it safe to read are two different jobs.

Boot speed, and honest instrumentation

** — fast-boot.ps1**, which skips the GRUB menu on an audit stick, split into its own script from the boot-message work so each does one thing.

make a silent restore visibly alive, not indistinguishable from a dead one. An OS restore writes several gigabytes with no output. The operator sees a still screen and cannot tell a working restore from a hung one. Same class as the network check: the system knew it was working and was not saying so.

sync-usb gains watch mode, a cache flush, and a version stamp on the stick.

The version stamp is the important part. Before it, nobody could tell which build a given stick was running, so a bug report could not be tied to a version. The cache flush matters because Windows reports a file copy to removable media as complete before the data has left the buffer — pulling the stick immediately leaves a truncated file that verifies as present.

stop blaming the internet when ping is filtered. The check tested one address by ICMP. A site that filters ping — or blocks that one address, as this one does — produced a red failure on a station that was uploading audits perfectly well. The check now tries several addresses and both protocols, and shows the routing table.

judge the station by whether it can reach Xorkbench. The decisive correction. Every other layer exists to explain a failure, not to be one: treated as failures in their own right they cried wolf, and operators went looking for network faults that were not there.

Also on this day — name an OS image by what it is, let the operator name

each one, and say when the install finished. — strip three pieces of kiosk chrome that were not earning their space. the golden-image guide as a PDF in the web app. mark binary assets binary before autocrlf corrupts one. Git on Windows rewrites line endings; a PDF or a .deb that goes through that transformation is silently destroyed.

What was deliberately not built

No server-side queue mirror. The stick is the durable store, and the record stays there until the server confirms it.

Open questions

Boot time was measured properly in September and found to be I/O-bound at 34 MB/s, which redirected the optimisation work entirely.


The code

The reader that distinguishes "no file" from "a file I could not read" — the distinction a read-modify-write queue depends on.

def _read_jsonl_checked(path):
    """(records, ok). ok is False when the file is THERE and we could not
    read all of it. A missing file is genuinely an empty queue - the normal
    state of a fresh stick. Collapsing both to [] is how a transient read
    error came to mean "nothing is waiting", and then rewrote the file with
    only the newest record. Partial is worth showing, never safe to store."""
    try:
        with open(path, "r", errors="replace") as fh:
            raw = fh.read()
    except FileNotFoundError:
        return [], True        # empty, and we know it
    except OSError:
        return [], False       # unknown: callers that WRITE must refuse
    items = []
    for line in raw.splitlines():
        try:
            items.append(json.loads(line))
        except ValueError:
            return items, False
    return items, True
From tools/gui/server.py — an excerpt, trimmed to the technique it illustrates.

Not shown. The upload and retry path, the refusal-reason store keyed by record hash, and anything naming the server the station uploads to. The queue payload's own shape is left out too — it carries machine and customer identifiers.

A published copy. Commit references and internal identifiers have been removed and the operator is not named; the engineering, the counts and the stated limits are unchanged.