Recently generated letters on the tracking page#5
Merged
Conversation
The /tracking page previously required typing a serial + ZIP from memory. It now lists the most recently generated letters as clickable references, each prefilling the form (and auto-connecting) on click. - db.recent_tracked_imbs(): newest-first registry rows enriched with a coarse status (delivered / in transit / awaiting first scan) from the latest stored scan. Rows without a recipient_zip are omitted. - Capture recipient name + company into tracked_imbs so the list can show who each letter is for. Added via an idempotent additive migration (ALTER TABLE ADD COLUMN guarded by PRAGMA table_info), so existing on-disk DBs pick up the columns without a destructive rebuild; legacy rows read NULL and render as "Unnamed recipient". The fields are display-only and play no part in routing or IV-MTR keying. - Gated by SHOW_RECENT_TRACKING (default on) + RECENT_TRACKING_LIMIT. The site has no auth beyond the webhook IP gate, so the flag is a kill switch for deployments where /tracking is broadly reachable. Tests cover ordering, status derivation, the limit, null-zip omission, name/company round-trip, the additive migration (incl. re-run no-op), and the route's flag on/off + rendered name/company. Also refresh .secrets.baseline to cover existing test-fixture dummies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The
/trackingpage previously required typing a serial + ZIP from memory. It now lists the most recently generated letters as clickable references — clicking a row prefills the form and auto-connects the tracking WebSocket.Each row shows the recipient name (and company), serial, ZIP, when it was generated, and a coarse status pill (Delivered / In transit / Awaiting first scan).
How
db.recent_tracked_imbs()— newest-first registry rows, each enriched with a coarse status derived from its latest stored scan (not a live IV-MTR pull). Rows without arecipient_zipare omitted (can't form a usable link).tracked_imbs(the generate form already collected them). Added via an idempotent additive migration (ALTER TABLE ADD COLUMNguarded byPRAGMA table_info), so existing on-disk DBs pick up the columns without a destructive rebuild. Legacy rows readNULLand render as "Unnamed recipient". The fields are display-only — they play no part in routing or IV-MTR keying.SHOW_RECENT_TRACKING(default on) +RECENT_TRACKING_LIMIT(default 20). The site has no auth beyond the webhook IP gate, so the flag is a kill switch for deployments where/trackingis broadly reachable — the list exposes recipient ZIPs/serials to any visitor.Tests / checks
nix build .#checks.<sys>.lint(ruff check + format) and.typecheck(mypy) clean..secrets.baselineto cover existing test-fixture dummies.