Skip to content

feat: report byte totals and recently closed connections - #582

Merged
linroid merged 3 commits into
mainfrom
feat/connection-totals-closed
Oct 18, 2026
Merged

linroid merged 3 commits into
mainfrom
feat/connection-totals-closed

Conversation

@linroid

@linroid linroid commented Oct 17, 2026

Copy link
Copy Markdown
Owner

What changes

Engine (library:core, library:api)

  • ConnectionRegistry adds each connection's bytes to running totals when it closes, so ActiveConnections.receivedBytes / sentBytes (new, null by default) cover every connection since the engine started and never drop. The sampler never reports a total lower than its last one, covering the moment between a connection leaving the live map and adding its bytes.
  • Closed connections are kept, newest first, with ActiveConnection.closedAt (new, null by default), their final counts and no rates: the last 256 for 10 minutes, at most limit per snapshot, in ActiveConnections.closed (new, empty by default). A connection still listed as open is left out of closed. Closed entries never change, so idle repeats stay deduplicated.
  • Older servers and clients keep working on the defaults. The server routes, the event stream and RemoteKetch pass both through as they are, and RemoteConnectionsTest checks that end to end over a real socket.

App (ui/connections)

  • The header adds "· X received · Y sent" once a device reports totals.
  • An Open / Closed / All switch sits before the protocol chips. It shows only while closed connections are known, defaults to Open, and the chip counts follow it.
  • Closed rows are dimmed and show "Closed 1m 35s ago" where the speeds would be. Their Open column and the sort use how long they were open. The hover card adds Closed and Was open. Search, sort and the saved sort work as before.
  • New strings are in strings_connections.xml, translated into all 9 other languages.

Snapshots

Before After
Closed
Closed, hover card
All, dark

Tests

  • ConnectionRegistryTest: totals survive closes, closed entries keep their final counts and close order, the cap, expiry on virtual time, and idle dedupe with closed entries.
  • ActiveConnectionsTest: defaults for older JSON, and a round trip with totals and closed connections.
  • ConnectionRoutesTest, RemoteConnectionsTest: pass-through on /api/connections and end to end through RemoteKetch.
  • ConnectionGridModelTest, ConnectionRowsTest: closed cells, the switch, de-duplication, sort and search, and headerSummary.
  • New snapshot scenario: ConnectionGridSnapshots.page_totalsAndClosed_dimClosedRowsAndSayWhenTheyClosed.

Ran: :library:api:jvmTest, :library:core:jvmTest --tests '*Connection*', :library:server:test --tests '*Connection*' '*RemoteStreamTest*' '*EventHubTest*', :library:remote:jvmTest, and :app:shared:jvmTest for the connection, localization, hardcoded-text and design-token tests. iOS and Android were not compiled.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 17, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T16:23:29.620767Z 376ee45 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 376ee457c6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 048 files  ± 0   2 076 suites  ±0   33m 24s ⏱️ -12s
13 746 tests +30  13 481 ✅ +29  265 💤 +1  0 ❌ ±0 
16 737 runs  +30  16 472 ✅ +29  265 💤 +1  0 ❌ ±0 

Results for commit d55d670. ± Comparison against base commit 2462373.

This pull request removes 4 and adds 34 tests. Note that renamed tests count towards both.
com.linroid.ketch.engine.ConnectionRegistryTest ‑ open_pastMaximum_countsDroppedAndReturnsNoOpHandle
com.linroid.ketch.engine.ConnectionRegistryTest ‑ open_pastMaximum_countsDroppedAndReturnsNoOpHandle[jvm]
iosSimulatorArm64Test.com.linroid.ketch.engine.ConnectionRegistryTest ‑ open_pastMaximum_countsDroppedAndReturnsNoOpHandle[iosSimulatorArm64]
jsNodeTest.com.linroid.ketch.engine.ConnectionRegistryTest ‑ open_pastMaximum_countsDroppedAndReturnsNoOpHandle[js, node]
com.linroid.ketch.app.snapshot.ConnectionGridSnapshots ‑ page_totalsAndClosed_dimClosedRowsAndSayWhenTheyClosed[jvm]
com.linroid.ketch.app.state.ConnectionGridModelTest ‑ connectionCell_closed_isIdle_andReadsItsTimesFromItsDevice[jvm]
com.linroid.ketch.app.state.ConnectionGridModelTest ‑ observe_closedAndTotals_comeApartFromTheOpenCells[jvm]
com.linroid.ketch.app.ui.connections.ConnectionRowsTest ‑ connectionRows_listClosedAfterOpen_onceEach_andTheSwitchPicksThem[jvm]
com.linroid.ketch.app.ui.connections.ConnectionRowsTest ‑ headerSummary_addsTotals_onlyWhenTheDevicesCountThem[jvm]
com.linroid.ketch.engine.ConnectionRegistryTest ‑ closed_expireAfterTheRetention
com.linroid.ketch.engine.ConnectionRegistryTest ‑ closed_expireAfterTheRetention[jvm]
com.linroid.ketch.engine.ConnectionRegistryTest ‑ closed_keepsFinalCountsAndWhenItClosed_newestFirst
com.linroid.ketch.engine.ConnectionRegistryTest ‑ closed_keepsFinalCountsAndWhenItClosed_newestFirst[jvm]
com.linroid.ketch.engine.ConnectionRegistryTest ‑ closed_keepsOnlyTheLatest
…

@linroid
linroid merged commit 610d5b8 into main Oct 18, 2026
14 checks passed
@linroid
linroid deleted the feat/connection-totals-closed branch October 18, 2026 00:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant