You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(directconn): show offered addresses, page and search devices - #5927
Related issue: #4440 (closed by #5469; this change extends the same feature after #5755)
Validation tasks: none. No v1.0 board task covers Network Access, direct connections or the peers read, and the one function outside them that this change touches, ReadAdminPeerNames, has no caller besides the peers read.
Other clients: Apple N/A (no admin screen for direct connections; silo-apple main uses neither the status nor the peers read); Android N/A (same, silo-android main); Roku N/A (same, silo-roku main)
On Admin > Server > Network Access, the Direct connections section doesn't show which addresses the server offers devices. An administrator who announces an endpoint or turns on Port mapping can't see whether the address took effect. While the feature is off, the section shows only the toggle, so the UDP port appears nowhere on the screen. STUN servers and Announced endpoints are comma-separated text fields. The Connected devices table loads every device on each 15-second poll and reads the names of every account in it.
This change adds a summary at the top of the section: the UDP port, which also shows while the feature is off, the direct state, Reachability, and a count of connected devices. Below it, the addresses the server offers are listed in three groups: the administrator's announced endpoints, addresses derived from the UDP port, and addresses detected on the host. STUN servers and Announced endpoints are edited one entry per row. The peers read pages, counts and searches on the server, and the table polls only its first page.
Approach
Status read. GET /api/v2/admin/direct-connections/status gains an optional per-host field, endpoint_candidates: one {endpoint, source} per address the engine registers, in the engine's order, capped at 64. The source comes from the engine because magicsock keeps only the first source that found an address, and the server can't work it out afterwards. An address shows under that first source only, so an announced entry equal to a STUN address shows under STUN. The field is present only while direct connections are on and the answering replica runs the engine with a valid lease and has reported a list. The engine's typed read, Endpoints(), comes from shunpike v0.1.4, which adds only that read and keeps the fork pins of v0.1.3.
Peers read. GET /api/v2/admin/direct-connections/peers takes limit (default 50, maximum 200), cursor and q, and answers {items, page, total}. Rows keep their order by account, then device. A cursor is bound to the acting administrator, q and limit; any other cursor answers 400 invalid-cursor before any row or name is read. total counts the devices that match q when the page is read. q matches the account's username, the device's name or the device ID as a case-insensitive substring.
A page without q reads names only for its own accounts and always answers 200, with empty names where the read failed. A search has to read every account's names, because a name can match, so it answers 503 dependency_unavailable when that read fails or is incomplete instead of leaving out a match. To tell the two apart, ReadAdminPeerNames now returns the names it read together with ErrPeerNamesIncomplete when an account or its devices could not be read. A missing account is still not a failure.
Contract review. This is a pre-1.0 change to an admin read; the pre-lock policy asks for these to be reviewed together:
Generated diff: make verify-apiv2-contract reports 6 changes, none breaking without approval (locked=false): three new optional query parameters and the required response properties page and total on the peers read, and the optional endpoint_candidates on the status read. contracts/api/v2/breaking-approvals.json is unchanged.
Fixtures: the existing peers fixture gains page and total. New fixtures cover a page with a next cursor, a search, a bad cursor, and a status host with endpoint_candidates.
Client impact: a caller that read the whole peers list now gets the first 50 rows unless it follows page.next_cursor. docs/direct-connections-api.md names the web admin as the only consumer of both reads, and no Apple, Android or Roku source uses them.
Release: the change lands before the /api/v2 lock, so no deprecation flow applies. Nothing changes under /api/v1. The Jellyfin-compatible surface has no matching operation, so jellycompat needs no change.
The device table. The first page is the live list and polls every 15 s while the page is visible. Load more appends the next page, and appended pages never refresh, so each poll reads one page however long the list is. A search loads its own first page 250 ms after the text stops changing. It has no interval, reconnect or focus refetch and isn't retried on failure, so one search term costs one full name read. The search field appears once the list holds more than one page of devices.
Because only the first page polls, a device that connects ahead of the appended rows pushes the first page's last row past where the appended rows begin, and the device that falls between them is on no page shown. useDirectConnectionPeerList in web/src/hooks/queries/admin/directConnections.ts detects that gap. The next Load more then reloads the page right after the first page and replaces the appended rows with it, instead of adding another page. The skipped device appears, and the rows that were loaded further down come back as Load more is pressed again. Each device shows once, even when it is on both the first page and an appended page. In a cluster, a replica without the engine answers a continuation with an empty page. While the live first page still reports more rows, that empty page is dropped, so the cursor stays and Load more can ask again.
Screen. The section now reads, top to bottom: the toggle; the summary; Run check; the offered addresses; Network (NAT mapping, IPv4, IPv6, NAT hairpin, Port mapping); This server (GSO, GRO and the other rows about the host); a closed fold for host tuning and listeners; Connected devices; and Advanced. Advanced now shows while the feature is off too. The list editor saves the same comma-separated string the two settings always held, so stored values, the settings API and the 8-entry limits don't change.
Docs: docs/direct-connections-api.md (the new field, paging, search and the name-read rules) and docs/architecture/direct-connections.md.
Translations. Silo-Server/silo-translations#226 adds 22 English strings and changes 3 descriptions (the Run check note, STUN servers and Announced endpoints). It merges first, after its translation pass, and publishes a release. Until then this branch is synced to a local build of that catalog, so .silo-translations reads version=local-7dd4abec5656. Before this pull request merges, the branch re-syncs with scripts/sync-translations --version <release>, and the web checks run again on the synced files. The Connected devices table no longer uses its old "to port" string; it stays in the catalog until a later catalog pull request removes it, after this one merges.
Validation
Contributor gate: every command in "Validate your change", on this branch's commit tree, in a Linux container with Go 1.27.4 and GOWORK=off: all pass. That covers the Go and web builds, gofmt, go mod tidy -diff, go vet, make lint-changed, make lint-router-recovery, make test-go, make test-web (390 files, 3,805 tests), web lint, format and budget, make verify-fork-pins (shunpike v0.1.4), and the OpenAPI, contract, fixture, route, migration, settings-binding, web-type, local-path, case-collision, size and bidi checks. The web checks ran on the local catalog build named under Translations.
make verify-prometheus-rules: promtool test rules in prom/prometheus:v3.5.0 reports SUCCESS.
The new Go and web tests were run against the tree with the new behavior taken out, and failed there.
Browser run on a release build of this commit, with its own Postgres and Redis. An administrator turned direct connections on, added 198.51.100.20:8094 under Announced endpoints with Add address, and saved. The settings read held direct_connections.announced_endpoints = 198.51.100.20:8094, and 4 s later the status read listed {"endpoint":"198.51.100.20:8094","source":"announced"} in endpoint_candidates. The page showed the address under "Your announced endpoints" with "Your entry", and the container's own address under "Detected on this server". The peers read answered {"items":[],"page":{"has_more":false},"total":0}, and the page showed "0 devices connected directly". Turning the toggle off and saving removed endpoint_candidates from the status read within 1 s, and the off section showed only the port tile, 8094. A second build with the en-XA pseudo-locale showed the same page.
Not covered: paging and search against real connected devices (the browser run had none; the Go and web tests cover pages, the cursor rules, search, the 503 answers and the gap reload), a native client, and a cluster with more than one API replica.
Surface and build: Admin > Server > Network Access, Direct connections.
Before: the "after" captures of feat(directconn): let administrators announce direct endpoints and see outside reachability #5755 (1440 x 900 and 390 x 844, silo.example.com:51820 announced). This pull request's base shows the same screen; the only later change to the section lists each STUN-observed address in Reachability, which renders the same with one address. While the feature is off, the base section shows only the toggle, so there is no "off" before capture.
After: a release build of this commit at 1100 px and 390 px: on, with 198.51.100.20:8094 announced; off; and on under the en-XA pseudo-locale at 1100 px. The only address that isn't a documentation address is the container's own address on the test network. Under en-XA the untranslated words are environment variable names, setting values, and the abbreviations IPv4, IPv6, GSO and GRO.
Risks
Peers contract. The default peers response now holds at most 50 rows. A caller outside the web admin that read the whole list would see fewer devices until it pages.
Search cost. Each search term reads the names of every account in the peer list, once. Where each account has its own database (SQLite), that is one read per account.
During a user-store fault, a search answers 503 where an unfiltered page answers 200 with blank names.
Clusters. The status and peers reads answer from the replica that serves them, and only the replica that runs the engine lists addresses and devices. Consecutive polls that land on different replicas can change the count, the address groups and the table between polls.
Dependency. shunpike moves from v0.1.3 to v0.1.4; the fork pins don't change.
Rollback. No migration and no setting change. The two list settings are still stored as comma-separated strings, so an older build reads them unchanged.
Nearby, not changed here:
The screen doesn't show whether an announced DNS name resolves. The server still logs a Warn record each time a name's state changes.
An address can show twice for about five minutes after it changes, because magicsock still remembers the old one. The screen's description says so.
The diagnostic rows render observed_at for any row, but only Reachability sets it, and Reachability now shows in the summary instead, so that detail can't appear today. The API schema still allows it on any row.
The new status fixture's announced entry is a loopback address, which the setting itself refuses. make verify-local-paths refuses any other IPv4 address in a fixture.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or how I checked a change nobody sees.
Adversarial review: Before any code was written, the design and the implementation plan were each reviewed and audited (review on gpt-6.2-sol, audit on claude-opus-5-5). After the change was applied, one full review of the Silo, shunpike and catalog changes on gpt-6.2-sol found five Medium, two Low and one Info finding. In this change: a delayed page from an earlier search could attach to a new search; an empty continuation could hide Load more; a failed name read for a search was retried without a user action; a failed status poll kept stale values on screen; the API guide left out the disable window and the partial-name answer; and one branch could never render. One more concerned the local script that checks the catalog change. All seven were fixed and the checks rerun, and an independent verifier on claude-sonnet-5-5 confirmed each fix. One Low finding was dropped: the status fixture announces a loopback address, which the setting refuses, but make verify-local-paths refuses any other IPv4 address in a fixture.
Note
Add endpoint candidates to direct-connections status and paginate/search the admin peers list
The direct-connections host status now includes endpoint_candidates with each endpoint's source (announced, STUN, port mapping, local, unknown). Candidates come from the engine's stored endpoint list and are only reported while the grant fence is open, in selfcheck.go and candidates.go.
The admin peers endpoint gains limit (default 50, max 200), cursor, and q search parameters, plus page metadata and a filtered total, in direct_connections_peers.go. Search is a case-insensitive substring match on account username, device name, or device ID; invalid cursors return HTTP 400.
New admin UI components show a searchable, paginated connected-devices table (ConnectedDevices.tsx), a summary with device counts and state indicators, grouped candidate addresses, and host diagnostics with translated feature/reason labels.
Adds a row-based editor for the announced-endpoints setting (AddressListField.tsx) with focus management and staged changes.
Risk: the peer-list response shape changes — items is now one page with required page and total fields, and the peers query key includes the search term (directConnections.ts); the existing peerNames reader now returns ErrPeerNamesIncomplete with partial names where it previously errored.
The Direct connections admin screen now answers "what does this server
offer devices, and who is connected" at a glance. A count line and
tiles for the UDP port, direct state and reachability sit on top. The
addresses the server offers are listed in three groups: the
administrator's own entries, addresses derived from the UDP port, and
addresses detected on the host. The feature rows follow under Network
and This server, then host tuning and listeners.
GET /api/v2/admin/direct-connections/status gains
endpoint_candidates, one {endpoint, source} per address the engine
registers. The engine reports the source, because magicsock keeps only
the first source that found an address, so an address shows under that
source only. The field is absent unless direct connections are on and
this replica's engine holds a valid lease and has reported a list.
The engine's Endpoints() read comes from shunpike v0.1.4.
GET /api/v2/admin/direct-connections/peers now pages by default: it
takes limit (default 50, maximum 200), cursor and q, and returns
{items, page, total}. Rows stay ordered by account and device. A
cursor is bound to the acting administrator, q and limit, and any
other cursor answers 400 invalid_cursor. A client that read the whole
list before now gets only the first 50 rows unless it follows
page.next_cursor. total counts the devices that match q and is read
live, so it is not a snapshot of the page.
q matches the account's username, the device's name or the device ID
as a case-insensitive substring. Because a name can match, a search
reads the names of every account in the list and answers 503
dependency_unavailable when they cannot be read, rather than report a
missing match. A page without q still reads names for its own rows
only and answers 200 with whatever names it got. To tell the two
cases apart, ReadAdminPeerNames returns the names it read together
with ErrPeerNamesIncomplete when an account or its devices could not
be read; a missing account is not a failure.
On the screen, the first 50 rows are a live snapshot refreshed every
15 s. Load more appends pages that do not refresh, and a search loads
its own first page when the text changes. The search field appears
once more than one page of devices exists. The STUN servers and
announced endpoints settings are now edited one entry per row; the
stored value is still the comma-separated string.
Signed-off-by: Anagh Kumar Baranwal <6824881+darthShadow@users.noreply.github.com>
This change exposes engine-reported endpoint candidates in admin status, adds cursor-based peer pagination and search, and updates the admin interface with host diagnostics, connected-device listings, and row-based address settings.
Changes: Direct Connections Admin
Layer / File(s)
Summary
Endpoint candidate status internal/directconn/*, internal/apiv2/direct_connections.go, contracts/api/v2/openapi.json, contracts/api/v2/fixtures/*, web/src/api/v2/schema.ts, docs/architecture/direct-connections.md, docs/direct-connections-api.md
The service stores engine-reported endpoints with their sources and includes candidates in status when available. API schemas, fixtures, and documentation describe the field.
Peer-list API and name-read behavior internal/apiv2/direct_connections_peers.go, internal/api/handlers/admin_devices_service.go, contracts/api/v2/openapi.json, contracts/api/v2/fixtures/*, docs/direct-connections-api.md, go.mod
The administrator peer endpoint supports keyset pagination and case-insensitive search, and returns page metadata and a total. Incomplete name reads are reported separately from missing accounts.
Peer-list query and pagination web/src/api/v2/schema.ts, web/src/hooks/queries/admin/directConnections.ts, web/src/hooks/queries/admin/directConnections.test.ts
The web query layer sends paginated and search requests, manages appended pages by list visit, and filters duplicate peers.
Admin status and connected-device interface web/src/components/admin/DirectConnectionsSection.tsx, web/src/components/admin/direct-connections/*, web/src/components/admin/DirectConnectionsSection*.test.tsx, web/src/components/admin/direct-connections/ConnectedDevices.test.tsx, web/src/locales/*
The admin section renders status summaries, endpoint groups, host diagnostics, and connected devices. The locale files add labels and messages for these views.
sequenceDiagram
participant Admin as Admin interface
participant Devices as ConnectedDevices
participant Query as useDirectConnectionPeerList
participant API as listAdminDirectConnectionPeers
participant Names as ReadAdminPeerNames
Admin->>Devices: Enter search text
Devices->>Query: Request peer list
Query->>API: Send query, limit, and cursor
API->>Names: Read account and device names
Names-->>API: Return names or read error
API-->>Query: Return peer page and total, or error
Query-->>Devices: Provide rows and pagination state
Loading
Suggested reviewers:quick104
Merge Risk: Moderate · up to 68723 · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
The admin device list can lose its Load more button in a multi-replica cluster, or after devices connect while the page is open. The new labels also show in English in other languages until the translation release is synced. Fix the translation pin and the pagination edge cases before merging; the server-side changes look sound.
Security architecture risk: Moderate · up to 68723
The new Connected Devices table can stop rendering if it receives an older API response. It can also continue showing disconnected devices from previously loaded pages after a successful poll reports no peers. Both issues affect administrator diagnostics; the changes do not establish a new way to grant direct-connection access.
Retained concerns
Minor · architecture · inferred: The new Web client can fail to render Connected Devices when an older API instance handles the request, including after a backend rollback that leaves an already-loaded new client running. The merge-base handler returns a successful items-only response. The v2 transport accepts it as JSON, and the new hook dereferences page without checking that it exists. Keeping the endpoint URL unchanged does not make this rollout compatible.
Minor · reliability · observed: Polling only the first page is an intentional load reduction, but the table can still present old addresses as connected after that page successfully returns zero peers. A genuine disconnect and an answer from a replica without the engine both yield an empty page. The hook retains and renders appended rows in either case. Its Load more repair runs only when the latest first page still has a cursor and its last row sorts before the saved boundary, so it cannot repair the empty-page case. The merge-base table replaced its entire list on a successful poll. This weakens an administrator’s ability to confirm which connections remain active.
observed — Administrator status gains host socket addresses and their discovery sources. The peer read still exposes device and account information only through the acting-administrator route; the search operates on peers already present on the answering process, not on arbitrary account IDs supplied by the caller.
Trust Boundaries and Controls
observed — The API requires acting-administrator authority before handling peer query parameters. The cursor is scoped to the operation, acting user and profile, trimmed search, page size, and ordering, and is decoded before peer or inventory reads. Web also checks its captured profile authority before and after fetching peer data.
observed — Status requires enabled state and a report from the current engine. In leased deployments it checks the engine record’s grant fence at read time. Replacement engines start with a fresh record, and workers write only to their own record, so a replacement does not inherit the prior engine’s candidate list.
Public contracts
observed — Status adds optional per-host endpoint_candidates. Peers now returns items, page, and total and accepts limit, cursor, and q. A cursor resumes an ordered live list; it does not pin a snapshot or a replica.
Dependencies
observed — shunpike moves from v0.1.3 to v0.1.4. The engine event worker calls the new Endpoints read before publishing host and confirmation updates. Timely coordination therefore depends on that read returning promptly; its implementation and latency bound were not established from the inspected source.
Service and deployment topology
observed — Behind a load balancer, status and peer reads describe the answering API process, not a cluster-wide view. A replica without the engine reports no peers and does not identify which replica holds the engine.
Data and control flow
observed — Explicit search reads the names for all peers in the answering replica’s list before filtering and paging. Unfiltered requests page first, then read names only for accounts on that page. The shared Postgres path batches inventory reads; the SQLite path reads per account.
Resilience and Maintainability Implications
observed — An incomplete name lookup rejects an explicit search with 503 rather than presenting a partial result as complete. The unfiltered view remains usable with partial or blank names, and later polls can restore them. The Web search does not poll or retry the failed lookup automatically; changing and re-entering the term starts a fresh read.
observed — Peer polls update only the first page. Load more can repair a detected gap at the first-page boundary, but does not revalidate previously appended peers after an empty or terminal first page. Run check refreshes status, not peer pages; remounting Connected Devices discards appended rows.
Hardening Proposals
proposed — Validate the peer response at the Web boundary and handle an items-only response explicitly during deployment and rollback. For loaded peer pages, visibly distinguish an unrefreshed result from a current connection and provide a peer-list refresh that discards old continuations.
Rollout and rollback
inferred — The deployment operator must ensure the new Web bundle reaches only API instances serving the paged contract, or deploy a compatibility bridge before mixing versions. The client does not verify page metadata before use. The same prerequisite applies to backend rollback while newer browser sessions remain open. Existing full-list API consumers need to follow next_cursor before treating the result as complete.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title "feat(directconn): show offered addresses, page and search devices" matches the main changes: the status read now reports endpoint candidates (offered addresses), and the peers read gains pa…
Description check
The description is detailed and directly about the changeset. It covers the problem, the endpoint_candidates status field, paginated and searchable peers read, the web admin table and address editor, …
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "feat(directconn): show offered addresses, page and search devices" matches the main changes: the status read now reports endpoint candidates (offered addresses), and the peers read gains paging and search. It is specific and conventional. The summary confirms the change set covers these areas.
Full details: Description check
Explanation
The description is detailed and directly about the changeset. It covers the problem, the endpoint_candidates status field, paginated and searchable peers read, the web admin table and address editor, validation, risks, and a translation dependency. It matches the raw summary's files and behavior.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
The summary treats unread settings as a disabled feature
While settings are loading or after they fail to load, enabled can make the summary present the feature as disabled without confirmation. Gate the summary on form.loaded, or pass an explicit unknown or loading state based on the settings read.
File web/src/components/admin/DirectConnectionsSection.tsx, line 136:
The summary treats unread settings as a disabled feature
Do not pass `enabled={false}` to the summary when the settings snapshot is still loading or failed: `enabled` is derived from a value that is not yet known, so the summary can present the feature as disabled without confirmation. Gate the summary on `form.loaded`, or pass an explicit unknown/loading state based on the settings read.
Kody rule violation: [Distinguish unknown settings from disabled policy](https://kodus.siloserver.org/settings/code-review/1247142351/kody-rules/35c0c0eb-6d7c-4be1-b4cc-a4ade104b8a7?teamId=ba9922fc-c0ea-4cf8-87bb-9d4f42ffc73e)
The reason will be displayed to describe this comment to others. Learn more.
While the settings are loading or failed to load, the summary shows only the UDP port tile. That value comes from the status read and is right in either state. The summary shows no Off state, the toggle can't be edited until the settings load, and a failed load shows its own error with Retry above the summary. The screen before this change hid the diagnostics and the device table on the same saved value. Leaving this as is.
The reason will be displayed to describe this comment to others. Learn more.
Understood. Given that the summary shows only the UDP port—not an Off state—when settings are unavailable, and the load error is shown separately, the reported concern does not appear to apply. Leaving the implementation as is.
The reason will be displayed to describe this comment to others. Learn more.
Connected-device rows omit the server port
Administrators cannot see which server UDP port a device is connected to. Render peer.local_port alongside peer.peer_endpoint as the previous table did.
Prompt for LLM
File web/src/components/admin/direct-connections/ConnectedDevices.tsx, lines 84-86:
Connected-device rows omit the server port
The peer table no longer displays `local_port`, so administrators cannot see which server UDP port a device is connected to, unlike before this change. Render `peer.local_port` alongside `peer.peer_endpoint` as the previous table did.
Suggested code:
<span dir="ltr">{peer.peer_endpoint}</span>
<span className="text-muted-foreground ms-1">{t("web.admin.settings.network.direct.connected.toPort", { port: peer.local_port })}</span>
The reason will be displayed to describe this comment to others. Learn more.
This is intended. Every row's local_port is the same value, the UDP port of the one engine, so the old table repeated one number on each row. The summary now shows that port once, in its UDP port tile. The unused string is removed in a later catalog pull request.
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the clarification. The omission is intentional: all devices share the engine’s UDP port, which is already shown in the summary, so repeating it on every row would be redundant. I withdraw the suggestion.
The reason will be displayed to describe this comment to others. Learn more.
Completed appended pages hide peers that connect later
Newly connected devices beyond the last appended page can remain inaccessible because hasMore consults that stale page even when the live first page reports more rows. Reconcile or invalidate appended pages when the live peer set changes so another continuation can be requested.
Prompt for LLM
File web/src/hooks/queries/admin/directConnections.ts, line 245:
Completed appended pages hide peers that connect later
After the last appended page reports no more rows, newly connected devices beyond that page remain inaccessible because `hasMore` only consults the stale appended page even when the live first page reports more rows. Reconcile or invalidate appended pages when the live peer set changes so a continuation can be requested again.
The new Web client can fail to render Connected Devices when an older API instance handles the request, including after a backend rollback that leaves an already-loaded new client running. The merge-base handler returns a successful items-only response. The v2 transport accepts it as JSON, and the new hook dereferences page without checking that it exists. Keeping the endpoint URL unchanged does not make this rollout compatible.
Polling only the first page is an intentional load reduction, but the table can still present old addresses as connected after that page successfully returns zero peers. A genuine disconnect and an answer from a replica without the engine both yield an empty page. The hook retains and renders appended rows in either case. Its Load more repair runs only when the latest first page still has a cursor and its last row sorts before the saved boundary, so it cannot repair the empty-page case. The merge-base table replaced its entire list on a successful poll. This weakens an administrator’s ability to confirm which connections remain active.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 4ae28e2b-1da9-45d1-b768-a5d15f56851a
Commits
Reviewing files that changed from the base of the PR and between 835131f and 6872379.
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Major · Data Integrity & Integration · Quick win
Sync a released catalog with the translations.
The default scripts/sync-translations rejects this local-* pin. All 38 real non-English locale files also lack the 22 new direct-network keys, so those labels fall back to English. Complete the catalog translation pass and sync its release before merging.
As per coding guidelines, “Every piece of text a user can see ships with its catalog entry and translations.”
The reason will be displayed to describe this comment to others. Learn more.
Expected at this stage. The strings are in Silo-Server/silo-translations#226, which merges first after its translation pass. Before this pull request merges, the branch re-syncs with scripts/sync-translations --version <release>, which pins the release and brings in the other locales. The description says the same under Translations.
The reason will be displayed to describe this comment to others. Learn more.
@darthShadow Thanks for clarifying the translation plan. The released pin and translated locale files still need verification before merge. I’ll leave the finding for that check.
Learnings used
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 5311
File: .silo-translations:0-0
Timestamp: 2026-11-25T19:37:26.525Z
Learning: Within repository "Silo-Server/silo-server", only for files matching one of [".silo-translations"]: For the feat/silo-sync feature, the maintainer confirmed that PRs into the integration branch may use a --local translation catalog sync while the feature's interface keys are collected into one catalog change and translation pass. Do not require a published catalog pin in each integration-branch PR. Before the integration-branch PR into main opens, sync with --version <release> and commit the published pin in .silo-translations and the regenerated files.
Learnt from: Quick104
Repo: Silo-Server/silo-server PR: 5320
File: .silo-translations:2-3
Timestamp: 2026-11-25T19:41:55.534Z
Learning: Within repository "Silo-Server/silo-server", only for files matching one of [".silo-translations"]: For the feature PRs targeting `feat/silo-sync`, the maintainer approved collecting the feature's interface keys in one `silo-translations` catalog change and translation pass. Those PRs may use a `--local` sync and a local pin in `.silo-translations` until the catalog release exists. Verify the published pin and regenerated files on the PR from `feat/silo-sync` into `main`.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
The candidate list clears before enabled turns false.
When a disable setting is read, the replica stops the engine and clears endpoint_candidates before the next check completes. enabled stays true until that check publishes its result. A status read in that window can return enabled: true without endpoint_candidates. The documentation says the two fields disappear together, which is incorrect.
Describe the two transitions separately. State that the candidate list clears when the replica applies the disabled setting. State that enabled becomes false only when the next check completes.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Check the current live page before accepting an empty continuation.
Suppose an appended page retains a next cursor, but a poll temporarily returns an empty first page. Load more then captures liveHasMore=false. If the live first page reports more rows before the continuation completes, this guard still accepts an empty terminal response.
When the restored first-page boundary equals the saved boundary, gap stays false. The terminal response then hides Load more and prevents access to the remaining devices.
Check the current visit's live first-page state at completion, not only the state captured at the click. Keep terminal-page acceptance when the current first page does not report more rows.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Keep a reload path after a terminal page becomes stale.
Load devices dev-001 through dev-100, then connect dev-101. The next poll reports total=101, but the first-page boundary stays at dev-050. Thus, gap is false and the terminal appended page keeps hasMore false. The table hides Load more, and subsequent polls cannot expose dev-101.
Provide a manual restart path from the live first-page cursor when this state occurs. Setting hasMore alone is insufficient because the terminal appended page has no cursor.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Searched continuations can hide Load more after an empty terminal page.
The retention guard at line 226 applies only to unfiltered lists. Line 266 sets liveHasMore to false for every search. A replica without the engine can answer a searched continuation with an empty page and has_more false. The client then accepts that page and removes Load more, while the searched first page can still report more matches. The remaining matches stay hidden until the search changes.
Use the same retention rule for searches. Drop an empty continuation whenever the first page still reports more rows. Line 226 already does this for live lists.
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
enhancementNew feature or requestgoPull requests that update go codejavascriptPull requests that update javascript codepriority: P2Limited scope, workaround exists, or polishsize/XXXL3000+ added + deleted lines (all files); change volume, not priority.
1 participant
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.
Problem
Related issue: #4440 (closed by #5469; this change extends the same feature after #5755)
Validation tasks: none. No v1.0 board task covers Network Access, direct connections or the peers read, and the one function outside them that this change touches,
ReadAdminPeerNames, has no caller besides the peers read.Other clients: Apple N/A (no admin screen for direct connections; silo-apple
mainuses neither the status nor the peers read); Android N/A (same, silo-androidmain); Roku N/A (same, silo-rokumain)On Admin > Server > Network Access, the Direct connections section doesn't show which addresses the server offers devices. An administrator who announces an endpoint or turns on Port mapping can't see whether the address took effect. While the feature is off, the section shows only the toggle, so the UDP port appears nowhere on the screen. STUN servers and Announced endpoints are comma-separated text fields. The Connected devices table loads every device on each 15-second poll and reads the names of every account in it.
This change adds a summary at the top of the section: the UDP port, which also shows while the feature is off, the direct state, Reachability, and a count of connected devices. Below it, the addresses the server offers are listed in three groups: the administrator's announced endpoints, addresses derived from the UDP port, and addresses detected on the host. STUN servers and Announced endpoints are edited one entry per row. The peers read pages, counts and searches on the server, and the table polls only its first page.
Approach
Status read.
GET /api/v2/admin/direct-connections/statusgains an optional per-host field,endpoint_candidates: one{endpoint, source}per address the engine registers, in the engine's order, capped at 64. The source comes from the engine because magicsock keeps only the first source that found an address, and the server can't work it out afterwards. An address shows under that first source only, so an announced entry equal to a STUN address shows under STUN. The field is present only while direct connections are on and the answering replica runs the engine with a valid lease and has reported a list. The engine's typed read,Endpoints(), comes from shunpikev0.1.4, which adds only that read and keeps the fork pins ofv0.1.3.Peers read.
GET /api/v2/admin/direct-connections/peerstakeslimit(default 50, maximum 200),cursorandq, and answers{items, page, total}. Rows keep their order by account, then device. A cursor is bound to the acting administrator,qandlimit; any other cursor answers400invalid-cursor before any row or name is read.totalcounts the devices that matchqwhen the page is read.qmatches the account's username, the device's name or the device ID as a case-insensitive substring.A page without
qreads names only for its own accounts and always answers200, with empty names where the read failed. A search has to read every account's names, because a name can match, so it answers503 dependency_unavailablewhen that read fails or is incomplete instead of leaving out a match. To tell the two apart,ReadAdminPeerNamesnow returns the names it read together withErrPeerNamesIncompletewhen an account or its devices could not be read. A missing account is still not a failure.Contract review. This is a pre-1.0 change to an admin read; the pre-lock policy asks for these to be reviewed together:
make verify-apiv2-contractreports 6 changes,none breaking without approval (locked=false): three new optional query parameters and the required response propertiespageandtotalon the peers read, and the optionalendpoint_candidateson the status read.contracts/api/v2/breaking-approvals.jsonis unchanged.pageandtotal. New fixtures cover a page with a next cursor, a search, a bad cursor, and a status host withendpoint_candidates.page.next_cursor.docs/direct-connections-api.mdnames the web admin as the only consumer of both reads, and no Apple, Android or Roku source uses them./api/v2lock, so no deprecation flow applies. Nothing changes under/api/v1. The Jellyfin-compatible surface has no matching operation, so jellycompat needs no change.The device table. The first page is the live list and polls every 15 s while the page is visible. Load more appends the next page, and appended pages never refresh, so each poll reads one page however long the list is. A search loads its own first page 250 ms after the text stops changing. It has no interval, reconnect or focus refetch and isn't retried on failure, so one search term costs one full name read. The search field appears once the list holds more than one page of devices.
Because only the first page polls, a device that connects ahead of the appended rows pushes the first page's last row past where the appended rows begin, and the device that falls between them is on no page shown.
useDirectConnectionPeerListinweb/src/hooks/queries/admin/directConnections.tsdetects that gap. The next Load more then reloads the page right after the first page and replaces the appended rows with it, instead of adding another page. The skipped device appears, and the rows that were loaded further down come back as Load more is pressed again. Each device shows once, even when it is on both the first page and an appended page. In a cluster, a replica without the engine answers a continuation with an empty page. While the live first page still reports more rows, that empty page is dropped, so the cursor stays and Load more can ask again.Screen. The section now reads, top to bottom: the toggle; the summary; Run check; the offered addresses; Network (NAT mapping, IPv4, IPv6, NAT hairpin, Port mapping); This server (GSO, GRO and the other rows about the host); a closed fold for host tuning and listeners; Connected devices; and Advanced. Advanced now shows while the feature is off too. The list editor saves the same comma-separated string the two settings always held, so stored values, the settings API and the 8-entry limits don't change.
Docs:
docs/direct-connections-api.md(the new field, paging, search and the name-read rules) anddocs/architecture/direct-connections.md.Translations. Silo-Server/silo-translations#226 adds 22 English strings and changes 3 descriptions (the Run check note, STUN servers and Announced endpoints). It merges first, after its translation pass, and publishes a release. Until then this branch is synced to a local build of that catalog, so
.silo-translationsreadsversion=local-7dd4abec5656. Before this pull request merges, the branch re-syncs withscripts/sync-translations --version <release>, and the web checks run again on the synced files. The Connected devices table no longer uses its old "to port" string; it stays in the catalog until a later catalog pull request removes it, after this one merges.Validation
GOWORK=off: all pass. That covers the Go and web builds,gofmt,go mod tidy -diff,go vet,make lint-changed,make lint-router-recovery,make test-go,make test-web(390 files, 3,805 tests), web lint, format and budget,make verify-fork-pins(shunpikev0.1.4), and the OpenAPI, contract, fixture, route, migration, settings-binding, web-type, local-path, case-collision, size and bidi checks. The web checks ran on the local catalog build named under Translations.make verify-prometheus-rules:promtool test rulesinprom/prometheus:v3.5.0reports SUCCESS.198.51.100.20:8094under Announced endpoints with Add address, and saved. The settings read helddirect_connections.announced_endpoints=198.51.100.20:8094, and 4 s later the status read listed{"endpoint":"198.51.100.20:8094","source":"announced"}inendpoint_candidates. The page showed the address under "Your announced endpoints" with "Your entry", and the container's own address under "Detected on this server". The peers read answered{"items":[],"page":{"has_more":false},"total":0}, and the page showed "0 devices connected directly". Turning the toggle off and saving removedendpoint_candidatesfrom the status read within 1 s, and the off section showed only the port tile,8094. A second build with theen-XApseudo-locale showed the same page.503answers and the gap reload), a native client, and a cluster with more than one API replica.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-5927/
Surface and build: Admin > Server > Network Access, Direct connections.
silo.example.com:51820announced). This pull request's base shows the same screen; the only later change to the section lists each STUN-observed address in Reachability, which renders the same with one address. While the feature is off, the base section shows only the toggle, so there is no "off" before capture.198.51.100.20:8094announced; off; and on under theen-XApseudo-locale at 1100 px. The only address that isn't a documentation address is the container's own address on the test network. Underen-XAthe untranslated words are environment variable names, setting values, and the abbreviations IPv4, IPv6, GSO and GRO.Risks
503where an unfiltered page answers200with blank names.v0.1.3tov0.1.4; the fork pins don't change.Nearby, not changed here:
observed_atfor any row, but only Reachability sets it, and Reachability now shows in the summary instead, so that detail can't appear today. The API schema still allows it on any row.make verify-local-pathsrefuses any other IPv4 address in a fixture.Checklist
AI Disclosure
claude-opus-5-5,claude-sonnet-5-5(Claude Code);gpt-6.2-sol(Codex)gpt-6.2-sol, audit onclaude-opus-5-5). After the change was applied, one full review of the Silo, shunpike and catalog changes ongpt-6.2-solfound five Medium, two Low and one Info finding. In this change: a delayed page from an earlier search could attach to a new search; an empty continuation could hide Load more; a failed name read for a search was retried without a user action; a failed status poll kept stale values on screen; the API guide left out the disable window and the partial-name answer; and one branch could never render. One more concerned the local script that checks the catalog change. All seven were fixed and the checks rerun, and an independent verifier onclaude-sonnet-5-5confirmed each fix. One Low finding was dropped: the status fixture announces a loopback address, which the setting refuses, butmake verify-local-pathsrefuses any other IPv4 address in a fixture.Note
Add endpoint candidates to direct-connections status and paginate/search the admin peers list
endpoint_candidateswith each endpoint's source (announced, STUN, port mapping, local, unknown). Candidates come from the engine's stored endpoint list and are only reported while the grant fence is open, in selfcheck.go and candidates.go.limit(default 50, max 200),cursor, andqsearch parameters, plus page metadata and a filteredtotal, in direct_connections_peers.go. Search is a case-insensitive substring match on account username, device name, or device ID; invalid cursors return HTTP 400.itemsis now one page with requiredpageandtotalfields, and the peers query key includes the search term (directConnections.ts); the existingpeerNamesreader now returnsErrPeerNamesIncompletewith partial names where it previously errored.Macroscope summarized 6872379.