Skip to content
The record
Report29 July 20265 min read

Unit IDs, printed labels, and normalising what the hardware reports

Deriving a device identifier the warehouse can say out loud from the stock hierarchy, rounding captured RAM and screen size to the capacities actually fitted, and the sysfs zero-size trap that left screen size blank on every audit, silently, since the feature shipped.

hardware-testingmethoditad-lifecycle

What was done

A Unit ID was derived from the hierarchy the business already uses, Batch → Lot → Unit, so a device has an identifier the warehouse can say out loud and the identifier carries its own provenance; a per-row Print button renders it as a label. Four further commits fitted the label to the Brother QL-800 and DK-11201 media, dropped the maker from the CPU line to win width, and moved to all-black ink because a thermal printer has one colour and grey prints as a dither a scanner misreads. Normalisation rules were then placed at the API boundary — RAM rounded to the capacity actually fitted, screen size snapped to a panel size that exists — and applied on ingest, in exports, and as a backfill of existing rows, so a report of historic data reads consistently with a report of today's. Separately the audit tool was corrected to sum the DMI memory devices rather than read usable memory, and the sysfs stat-size trap was fixed: the panel-size reader had tested a DRM edid file for non-zero size, which sysfs always reports as 0, so screen size had been blank on every audit since the feature shipped.

 
audit stick (Linux)platform (API + web)
dmidecode: DIMMs
sysfs: EDID bytes
+-- ingest --+--> normalise ONCE on write
7.73 GB -> 8 GB
13.94" -> 14"
"310 mm x 170 mm" -> 14"
+-----+------+
v v
printed label xlsx export
(Unit ID first) (same rules)
 

What the hardware reports, normalised at one boundary, so every reader downstream prints the same figure.


Status

Shipped, 29–30 July 2026.

Unit ID and the label

a Unit ID, and a per-row Print button.

A device needs an identifier the warehouse can say out loud and write on a box. A serial number is long, inconsistent between manufacturers, and sometimes absent. The Unit ID is derived from the hierarchy the business already uses — Batch → Lot → Unit — so the identifier carries its own provenance.

Then four commits on the physical label, all learned from printing:

  • **** — exact 88.9 × 27.94 mm stock, cleaner CPU line, larger barcode
  • **** — resized to Brother DK-11201 media (90 × 29 mm) for the QL-800
  • **** — optional caption via ?text=0
  • **** — brand-only maker, all-black ink, fit long models

All-black ink is not cosmetic. A thermal label printer has one colour; anything designed in grey prints as a muddy dither that a scanner reads badly. The label had to be designed for the device that prints it, and that was found by printing. then put Unit ID as the first column of the lot report, so the printed sheet and the printed label lead with the same identifier.

Specification normalisation

standard RAM capacity and laptop screen size.

Captured hardware is messy. A machine reports 7.73 GB of usable RAM because the integrated graphics took the rest; a panel measures 13.94 inches. Reported raw, the same model appears as four products and no two lots are comparable.

So there are rules: RAM rounds to the standard capacity actually fitted, and screen size to the size the panel is sold as.

true installed RAM, built-in panel size. The audit tool was reading usable memory rather than what is physically installed. Reading the DMI memory devices — what is in the slots — is the correct source.

apply the rules on ingest AND in exports, and backfill. All three, deliberately: new captures are normalised, old rows are corrected, and exports apply the rules so a report of historic data reads consistently with a report of today's.

The defect worth recording

screen size was never being read: the sysfs stat-size trap.

The tool read the panel size from a sysfs file by checking the file's size before reading it. Files in sysfs report a size of 0 regardless of content — they are generated on read. The guard rejected every file as empty, so screen size was blank on every audit, silently, since the feature shipped.

A textbook false absence, and a reminder that a sanity check written for ordinary files is wrong for a synthetic filesystem.

Also on these days

admin-only Delete lot, cascading to everything inside it. asset grade on the kiosk audit panel. sync-usb.ps1, to stop sticks drifting from the repository. That script is now the only sanctioned way a stick is updated, and it verifies every file by SHA-256 after copying.

What was deliberately not built

No guessing at specifications the machine does not report. A value that cannot be read stays empty.

Open questions

None outstanding.


The code

The rule runs once on write, so the printed label and the spreadsheet export cannot disagree.

/**
 * Round an installed-RAM figure up to the nearest even GB.
 *
 * /proc/meminfo reports memory the OS can *use*, which is installed capacity
 * minus whatever the firmware reserved (integrated graphics, management
 * engine). That is why real machines report 7, 15 or 31 GB — none of which is
 * a capacity you can buy. Rounding up to the nearest even value recovers the
 * true figure: 7 -> 8, 15 -> 16, 31 -> 32, and the mixed-module sizes that
 * are genuinely even (6, 12, 24) stay put.
 */
export function standardiseRamGb(gb: number | null | undefined): number | null {
  if (gb == null) return null;
  const n = Number(gb);
  // 4 TB is well past any machine we handle; beyond it is a bad parse.
  if (!Number.isFinite(n) || n <= 0 || n > 4096) return null;
  return Math.ceil(n / 2) * 2;
}
From apps/api/src/common/spec-normalise.ts — an excerpt, trimmed to the technique it illustrates.

Not shown. The Unit ID's own format is not shown: it encodes the operator's batch and lot numbering. The label page's layout and barcode generation, the CPU-string rewrite rules and the full standard-panel-size table are left out as bulk rather than illustration.

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.