Conversation
added 7 commits
May 2, 2026 17:58
Add a new 'last_packet_at' column to the observers table that is only bumped when an actual packet observation lands (InsertTransmission path), while 'last_seen' continues to be bumped on both status updates and packets. This allows the UI to distinguish between an observer that is alive (sending status pings) vs one that is actively forwarding packets. Schema migration backfills last_packet_at = last_seen for observers with packet_count > 0. Server API now returns last_packet_at in the Observer JSON response.
…vers - observers.js: rename 'Last Seen' column to 'Last Status', add 'Last Packet' column with a warning badge when no packets observed or packets lag behind status by >10min - observer-detail.js: add 'Last Status Update' and 'Last Packet Observation' stat cards with relative + absolute timestamps
- Ingestor: verify last_packet_at is NULL after UpsertObserver (status path), set after InsertTransmission, and unchanged by subsequent UpsertObserver calls - Server: verify last_packet_at reads back through GetObservers and GetObserverByID
The addition of the Last Packet column brings the table to 8 columns. The previous min-width of 640px was tight for 7 columns; 720px prevents cramped rendering and ensures the horizontal scroll trigger is appropriate on narrow viewports.
…istic, test comment 1. Migration ALTER error no longer swallowed: check error from ALTER TABLE and return if it fails (unless column already exists). Migration is not marked complete on failure. 2. Backfill heuristic fixed: use observations table JOIN instead of packet_count > 0, since UpsertObserver sets packet_count = 1 on INSERT even for status-only observers. 3. Test clarifying comment: document that InsertTransmission uses data.Timestamp (not time.Now()) as source-of-truth for last_packet_at, so the hardcoded assertion is correct.
Mirror the ensureObserverInactiveColumn pattern (PR #961) for the last_packet_at column added by the ingestor migration. Without this, the server SELECTs last_packet_at but never adds it — causing 500 errors on /api/observers when running against DBs the ingestor has not yet touched (e.g. the e2e fixture). Adds TestEnsureLastPacketAtColumn for correctness + idempotency.
Elektr0Vodka
added a commit
to Cornmeister/CoreScope
that referenced
this pull request
May 3, 2026
…lawbot#969) Extend detectSchema() to probe PRAGMA table_info(observers) at startup and set hasObserverLastPacket. GetObservers and GetObserverByID branch on that flag so the server works against DBs that predate the ingestor migration, avoiding a "no such column" crash on observer endpoints.
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.
Rebased version of #968 (which was itself a rebase of #905) — resolves merge conflict with #906 (clock-skew UI) that landed on master.
Conflict resolution
public/observers.js— master (#906) added "Clock Offset" column to observer table; #968 split "Last Seen" into "Last Status" + "Last Packet" columns. Combined both: the table now has Status | Name | Region | Last Status | Last Packet | Packets | Packets/Hour | Clock Offset | Uptime.What this PR adds (unchanged from #968/#905)
last_packet_atcolumn in observers DB tableVerification
cmd/server,cmd/ingestor)test-packets.js,test-hash-color.js)/api/observers—last_packet_atfield present in JSONPrior PRs
Supersedes #968. Closes #905.