Send the board family with the census #177

Merged
aluminum-ice merged 1 commit from census-board into main 2026-11-08 02:30:26 +00:00
Owner

What this PR does

Census: the board family. Each device's daily census token now carries its Raspberry Pi family, read from /proc/device-tree/model: Zero 2 W, Pi 3 family, Pi 4 family (4, 400, CM4), Pi 5 family (5, 500, CM5), another board, or unknown. Only the family code leaves the device, never the name, revision or serial number.

  • Format: the token becomes marker(2) | board(1) | random(5) (_census_proto.make_token/token_board; the board byte is family(4) | ram(3) | spare(1), with ram sent as 0). Nothing else in the 20-byte entry changes, so devices on 1.0.13 and earlier read, merge and count these reports unchanged, and it stays kestrel-census/1. Their own random tokens read as "not reported".
  • Plugin: a new day's token carries the board (a day started before the update keeps its token until UTC midnight). Tally counts boards and on-device contests per family from the tokens; history.json keeps them per day, and older history loads without them.
  • Census page: a Boards card after Releases (today's shares, then each family's on-device win rate this week), and "Board: …" in What this device reports today, whose "Also sent" line now says the daily number carries the board.
  • Desktop report: a Board table and an On-device contests by board table (and their CSV rows).
  • Docs: census-protocol.md (the token's layout, the family table, a reworded change rule and a History section), census-setup.md, the guide's census section, the report README and CLAUDE.md. deferred.md gains Send a RAM size with the census board.
  • Guide: the fixture's invented devices get board families (from their own generator, so earlier releases' shots don't change) and a new phone-census-boards figure, since = "1.0.14".

Checklist

  • Lint passes — make lint (ansible --syntax-check, yamllint, shellcheck --severity=error, and the real-data check). The Lint workflow runs this on the PR.
  • Tests pass — make test (the kestrel_pi pytest suite and the real-data check's tests). The Test workflow runs this on the PR.
  • Nothing real: no secrets, no personal information, no real data. This is a public repository. The diff contains no real account passwords or hashes, Wi-Fi passphrases, private keys, API tokens, .env files, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you.
  • Consent gates intact. Capture and network plugins still ship disabled, enabling them still takes the authorized-use acknowledgment (never pre-ticked or given by code), and the capture whitelist is still enforced.
  • Docs updated in the same PR, if this changes something an operator sees or configures: the README package table, the relevant page under docs/, and the on-device operator guide (GUIDE_MD in kestrel_pi/userguide.py) where it applies.
  • Commit messages are short and imperative.

Release impact

  • App-layer-safe — changes only files the in-place update engine carries: the kestrel_pi package, plugins/*.py, systemd units, the journald drop-in, a lib script already in the engine's LIB_SCRIPTS, or the CLI.
  • Reflash-class — touches a build input the engine does not carry onto a running device: apt or pip packages, boot options / config.txt / cmdline, kernel modules, the base image or partition size, builder/config.json, builder/config.yml, the Makefile, the Release workflow (.forgejo/workflows/main.yml), a shipped config default (config.toml / default.conf), or a brand-new lib script.

Notes for review

  • The plugin's version goes to 0.2.0.
  • About 1 in 65,536 tokens from older releases starts with the marker by chance and is read with a random board; at any realistic census size that's invisible.
  • Tokens keep 40 random bits a day: across a full census (12,544 devices) the chance that any two match on a given day is about 7 in 100,000, and a match only merges those two devices' reports for that day, as with today's tokens.
  • New tests: the family table, the token round trip and an older random token, a token carrying a board still parsing and proving like any other, Tally boards and per-family contests (capped entries left out), a new day's token, a day kept from before the update, the page's Boards card and own-report line, history from before boards, and the report's tables.
  • I rendered and looked at the census figures (Boards card, own report): they read as intended at phone width.

🤖 Generated with Claude Code

## What this PR does **Census: the board family.** Each device's daily census token now carries its Raspberry Pi family, read from `/proc/device-tree/model`: Zero 2 W, Pi 3 family, Pi 4 family (4, 400, CM4), Pi 5 family (5, 500, CM5), another board, or unknown. Only the family code leaves the device, never the name, revision or serial number. - **Format:** the token becomes `marker(2) | board(1) | random(5)` (`_census_proto.make_token`/`token_board`; the board byte is `family(4) | ram(3) | spare(1)`, with `ram` sent as 0). Nothing else in the 20-byte entry changes, so devices on 1.0.13 and earlier read, merge and count these reports unchanged, and it stays `kestrel-census/1`. Their own random tokens read as "not reported". - **Plugin:** a new day's token carries the board (a day started before the update keeps its token until UTC midnight). `Tally` counts boards and on-device contests per family from the tokens; `history.json` keeps them per day, and older history loads without them. - **Census page:** a **Boards** card after Releases (today's shares, then each family's on-device win rate this week), and "Board: …" in *What this device reports today*, whose "Also sent" line now says the daily number carries the board. - **Desktop report:** a Board table and an *On-device contests by board* table (and their CSV rows). - **Docs:** `census-protocol.md` (the token's layout, the family table, a reworded change rule and a History section), `census-setup.md`, the guide's census section, the report README and CLAUDE.md. `deferred.md` gains *Send a RAM size with the census board*. - **Guide:** the fixture's invented devices get board families (from their own generator, so earlier releases' shots don't change) and a new `phone-census-boards` figure, `since = "1.0.14"`. ## Checklist - [x] **Lint passes** — `make lint` (ansible `--syntax-check`, `yamllint`, `shellcheck --severity=error`, and the real-data check). The **Lint** workflow runs this on the PR. - [x] **Tests pass** — `make test` (the `kestrel_pi` pytest suite and the real-data check's tests). The **Test** workflow runs this on the PR. - [x] **Nothing real: no secrets, no personal information, no real data.** This is a public repository. The diff contains no real account passwords or hashes, Wi-Fi passphrases, private keys, API tokens, `.env` files, real names, personal emails, device serials, and no real captured or device data: SSIDs, MAC addresses, GPS coordinates, capture files, diagnostics bundles, logs, or screenshots of a real device — placeholders only. The real-data check catches MACs, emails, keys and capture files; real SSIDs, coordinates and screenshots are on you. - [x] **Consent gates intact.** Capture and network plugins still ship disabled, enabling them still takes the authorized-use acknowledgment (never pre-ticked or given by code), and the capture whitelist is still enforced. - [x] **Docs updated in the same PR**, if this changes something an operator sees or configures: the README package table, the relevant page under `docs/`, and the on-device operator guide (`GUIDE_MD` in `kestrel_pi/userguide.py`) where it applies. - [x] Commit messages are short and imperative. ## Release impact - [x] **App-layer-safe** — changes only files the in-place update engine carries: the `kestrel_pi` package, `plugins/*.py`, systemd units, the journald drop-in, a lib script already in the engine's `LIB_SCRIPTS`, or the CLI. - [ ] **Reflash-class** — touches a build input the engine does not carry onto a running device: apt or pip packages, boot options / `config.txt` / `cmdline`, kernel modules, the base image or partition size, `builder/config.json`, `builder/config.yml`, the `Makefile`, the Release workflow (`.forgejo/workflows/main.yml`), a shipped config default (`config.toml` / `default.conf`), or a brand-new lib script. ## Notes for review - The plugin's version goes to 0.2.0. - About 1 in 65,536 tokens from older releases starts with the marker by chance and is read with a random board; at any realistic census size that's invisible. - Tokens keep 40 random bits a day: across a full census (12,544 devices) the chance that any two match on a given day is about 7 in 100,000, and a match only merges those two devices' reports for that day, as with today's tokens. - New tests: the family table, the token round trip and an older random token, a token carrying a board still parsing and proving like any other, `Tally` boards and per-family contests (capped entries left out), a new day's token, a day kept from before the update, the page's Boards card and own-report line, history from before boards, and the report's tables. - I rendered and looked at the census figures (Boards card, own report): they read as intended at phone width. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Send the board family with the census
All checks were successful
Lint / lint (push) Successful in 37s
Test / test (push) Successful in 1m10s
Lint / lint (pull_request) Successful in 34s
Test / test (pull_request) Successful in 1m4s
b8f35efc0f
A device's daily census token now carries its Raspberry Pi family (from
/proc/device-tree/model) in place of three of its random bytes, so older
devices read and merge the reports unchanged. The Census page and the desktop
report gain a Boards breakdown with on-device contest results per family.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch census-board 2026-11-08 02:30:27 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
aluminum-ice/kestrel!177
No description provided.