Stop sharing a GPS fix once it is lost or old; run the whole test suite #174

Merged
aluminum-ice merged 1 commit from gps-stale-fix into main 2026-11-05 05:01:00 +00:00
Owner

What this PR does

GPS: the gps plugin's position service now returns nothing once the receiver reports no fix, or once no fix has arrived for 30 s (FIX_MAX_AGE_S, the same span as the card's "no signal"). Before, it kept returning the last fix, so a handshake captured after the fix was lost, or after the receiver was unplugged, was tagged with an earlier position, and wigle and the e-ink face read it as current. They now see no fix, as before a first lock.

Tests: test_main_ignores_sighup calls daemon.main(), which since 40a3e89 ends with os._exit(0). pytest stopped at that test with status 0, so make test and the Test workflow ran only the first quarter or so of the suite. The test now stubs the exit and the logging shutdown. One test that this had hidden, test_gps_serial_reader_recovers_from_a_stalled_link, still faked the built-in open() after the reader moved to os.open(); it now fakes os.open/os.close.

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

  • Locally, make test now runs the whole suite: 1693 passed, 11 skipped, in about 75 s. The Test workflow's run should take about that long too, instead of a few seconds of tests; that's the sign it's running everything.
  • The GPS card itself is unchanged (it already showed "no signal" after 30 s of silence), so there are no new guide screenshots. The guide's GPS section and docs/user-guide/gps-setup.md say that captures are tagged only with a current fix.
  • New tests: a lost fix (GGA quality 0), a receiver that goes quiet (the fix ages out and comes back with the next fix), and a handshake with an old fix writing no sidecar.

🤖 Generated with Claude Code

## What this PR does **GPS:** the `gps` plugin's `position` service now returns nothing once the receiver reports no fix, or once no fix has arrived for 30 s (`FIX_MAX_AGE_S`, the same span as the card's "no signal"). Before, it kept returning the last fix, so a handshake captured after the fix was lost, or after the receiver was unplugged, was tagged with an earlier position, and `wigle` and the e-ink face read it as current. They now see no fix, as before a first lock. **Tests:** `test_main_ignores_sighup` calls `daemon.main()`, which since 40a3e89 ends with `os._exit(0)`. pytest stopped at that test with status 0, so `make test` and the Test workflow ran only the first quarter or so of the suite. The test now stubs the exit and the logging shutdown. One test that this had hidden, `test_gps_serial_reader_recovers_from_a_stalled_link`, still faked the built-in `open()` after the reader moved to `os.open()`; it now fakes `os.open`/`os.close`. ## 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 - Locally, `make test` now runs the whole suite: 1693 passed, 11 skipped, in about 75 s. The Test workflow's run should take about that long too, instead of a few seconds of tests; that's the sign it's running everything. - The GPS card itself is unchanged (it already showed "no signal" after 30 s of silence), so there are no new guide screenshots. The guide's GPS section and `docs/user-guide/gps-setup.md` say that captures are tagged only with a current fix. - New tests: a lost fix (GGA quality 0), a receiver that goes quiet (the fix ages out and comes back with the next fix), and a handshake with an old fix writing no sidecar. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Stop sharing a GPS fix once it is lost or old; run the whole test suite
All checks were successful
Lint / lint (push) Successful in 36s
Test / test (push) Successful in 1m6s
Lint / lint (pull_request) Successful in 34s
Test / test (pull_request) Successful in 1m0s
ba9637cc39
The gps plugin's position service kept returning the last fix after the
receiver lost it or went quiet, so later handshakes could be tagged (and
wigle could record them) with an earlier position. It now returns None
once the receiver reports no fix or no fix has arrived for 30 s.

test_main_ignores_sighup called daemon.main(), which ends with
os._exit(0), so pytest stopped there with status 0 and the rest of the
suite never ran. Stub the exit, and bring the stalled-link gps test in
line with the reader's os.open().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aluminum-ice deleted branch gps-stale-fix 2026-11-05 05:01:01 +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!174
No description provided.