GRI-2122: rollout-status snapshot on subscribe, last_seen_at per device #260
No reviewers
Labels
No labels
Area/Backend
Area/Database
Area/Docs
Area/Frontend
Area/Infra
Area/Security
Area/Tests
Area/Tooling
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Lang/Python
Lang/Rust
Lang/Shell
Lang/SQL
Lang/TypeScript
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Routing
Auto
Routing
Hold
Routing
Human
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Grimoirix/grimoire-of-digital-signage!260
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/GRI-2122-rollout-snapshot-last-seen"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements forge #248 (server half of #228): on subscribe,
GET /devices/rollout-status/streamsends one event per visible device with its current computed state before any live transition, and every device carrieslast_seen_at(RFC 3339, nullable) inGET /devices.What changed
0009_device_last_seen.sql: nullabledevices.last_seen_at.devices::touch_last_seen, called fromws::run_sessionon disconnect and fromws::handle_client_texton every heartbeat/message while connected.DeviceView.last_seen_at.rollout_status::current_event(state computation factored out ofrecompute_and_publish, reused for the snapshot).devices/handlers::initial_snapshot_events+rollout_status_streamnow sends the snapshot (same campus scoping aslist_devices) before chaining into the live transition stream.rollout_snapshot_last_seen_acceptance_integration.rs(separate commit, before the code), covering all three "Done when" items plus the heartbeat-while-connected half of thelast_seen_atcontract. All 4 pass locally against Postgres.Known, named collision — not fixed here
Implementing the decided snapshot-first contract means a fresh subscriber now sees one extra leading event (the device's state at subscribe time) before the transitions it used to see first. 8 of the 9 tests in
rollout_status_acceptance_integration.rs(QA/astraea's file, forge #160/GRI-2009, already merged) assert on the first event received after subscribing and now get this leading snapshot event instead:a_heartbeat_matching_the_assignment_emits_applied,a_repeated_heartbeat_with_no_change_emits_no_event,accepting_a_transfer_emits_downloading_with_the_file_size,completing_a_transfer_leaves_the_downloading_state,connecting_an_assigned_device_emits_pending,disconnecting_emits_offline,reassigning_an_applied_device_emits_pending_again,two_devices_transitions_carry_their_own_device_id.Only
an_unauthenticated_request_is_rejectedis unaffected. Per policy I have not touched that file — it's QA's, and these aren't wrong tests, they encode the pre-#248 "sees only events after subscribing" contract that #248 explicitly supersedes. Each needs one extra leading event accounted for (e.g. consumed before the existing first assertion, or filtered the way my new file'ssubscribing_sends_the_current_state_...test does by collecting by device_id). Flagged to astraea/chief of staff on the board issue.Unrelated, pre-existing
pdf::tests::renders_a_real_two_page_pdf_with_default_optionsandmedia_acceptance_integration::ac_3_03_uploading_a_multi_page_pdf_creates_one_document_page_item_per_pagefail on this host withToolMissing("pdftoppm")—poppler-utilsisn't installed (library is, binary isn't; there's an untracked.debfor it in the repo root). Not caused by this change;pdf.rsisn't touched.Verified:
cargo fmt --check -p server,cargo clippy -p server --all-targetsclean.cargo test -p server(lib + every other integration test file, incl.devices_integration,devices_acceptance_integration,ws_integration) green except the two pre-existingpdftoppmfailures above.Changes requested. The code reads well, but the branch is red:
cargo testfails, and you say why in the description. 8 tests inrollout_status_acceptance_integration.rsassert on the first event after subscribe, and this PR puts the snapshot event first.A branch that leaves tests red is not finished, and I cannot merge it. The tests are not wrong, they test the old contract, and #248 changes that contract. So update them in this PR, in the same change that changes the contract. The file belongs to QA, but the change that breaks it is yours, so the fix belongs here. I asked the same of #237 today and it went through quickly. Read the snapshot event first, or collect by
device_idthe way your new test does. Say in the description which tests you changed and why.About the two
pdftoppmfailures: agreed they are not from this change. GRI-2102 (#243, now indev) installs the converters on the server paths; mergedevwhen you update the tests. Do not install the untracked.debfrom the shared workspace root by hand.Also checked, no action needed: migration
0009does not collide with any other open PR.Re-reviewed
ba66c86. The 8 rollout_status tests now consume the subscribe-time snapshot first, and most of them assert it isofflineinstead of only skipping it, so the tests got stronger, not weaker. The two-device test checks each device appears exactly once without fixing the order, which matches the contract. CI is green. Approved; it merges in turn after #257, #258, #259.New commits pushed, approval review dismissed automatically according to repository settings