Track endpoint first-seen time across reconnects - #103
Merged
Conversation
The per-session endpoint tables were auto-laid-out, so each session card sized its columns from its own longest cell and no two cards lined up. Give the tables `table-layout: fixed` and a shared colgroup, with a min-width on both the card and the table so a narrow viewport scrolls the whole set together in `.wrap` rather than squashing cards independently. URL takes the flexible remainder (it is the column worth reading in full); overlong cells ellipsise and carry the full value as a tooltip. Add a "First seen" column. A live backend's RegisteredAt restarts every time a reaped container reconnects, so it cannot answer "how long has this URL existed?" — EndpointView.FirstSeenAt is resolved from the durable session log instead, taking the earliest sighting of the endpoint slot. SessionView.FirstSeen now derives from that too. Timestamp cells show the absolute time on hover. Also add an attribute escaper for the values interpolated into HTML attributes; esc() escapes markup but leaves quotes alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EKdcQRPJZxTWq87SH34WYy
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.
Summary
Add persistent tracking of when endpoints were first seen, surviving backend reconnects and container reaps. The hub now displays "first seen" alongside "last seen" and "last used" in the admin UI, with the value sourced from the durable session history rather than the live backend's
RegisteredAttimestamp (which resets on reconnect).Changes
Core Logic
registry.go: ComputeFirstSeenAtfor each endpoint by scanning the durable session history for the earliest sighting of each endpoint slot. Live endpoints inherit this value, and offline endpoints in the history also get it populated.sessions.go:slot()method toEndpointRecordto extract the endpoint identity (without session), enabling matching across reconnects and sessions.key()to useslot()for cleaner composition.FirstSeenAtfield toEndpointViewwith documentation explaining it survives reconnects.Admin UI
admin.go:epColgroupconstant with fixed column widths for consistent alignment across session cards.tableMinWidthconstant applied to both cards and tables for synchronized horizontal scrolling.table-layout:fixedwith the colgroup, ensuring columns line up across all cards.at()helper to generatetitleattributes with absolute timestamps for truncated cells.attr()escaper for HTML attribute values (distinct from element content escaping).epRow()to includeFirstSeenAtcolumn and add tooltips to all truncatable cells.sessionCard()to display "first seen" in the session header and update table headers.Tests
sessions_test.go: AddTestRegistry_SessionsFirstSeenSurvivesReconnectto verify thatFirstSeenAtpersists when a backend is reaped and reconnects with a freshRegisteredAt.Documentation
docs-site/src/tools/run-local.md: Document the new "first seen" feature and clarify that it differs from uptime by reading from persistent history.Implementation Details
firstSeenmap is keyed by endpoint slot (not session), allowing the same endpoint to be tracked across multiple sessions.FirstSeenAtfrom the durable log.https://claude.ai/code/session_01EKdcQRPJZxTWq87SH34WYy