Repository navigation
feat(torrent): list a torrent's trackers and how each answers - #669
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88fe6763aa
ℹ️ 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".
| val key = status.tier to status.label | ||
| val kept = merged[key] | ||
| if (kept == null || status.weight() > kept.weight()) merged[key] = status |
There was a problem hiding this comment.
Preserve distinct tracker identities when merging statuses
When a v2 or hybrid torrent lists two tracker URLs in the same tier that differ only in path or query, trackerLabel() gives them the same label, so this key collapses their statuses into one. TrackerTiers treats these as distinct trackers and assigns distinct IDs, but the REST response and inspector silently lose one entry; a successful endpoint can consequently hide another endpoint's failure. Merge corresponding announcers using a credential-free identity that preserves distinct URLs (such as their original tracker IDs), rather than the redacted display label. This also preserves the one-status-per-tracker invariant documented in AGENTS.md.
AGENTS.md reference: AGENTS.md:L1287-L1290
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in the latest commit: statuses now merge by tier, id and label (announcers of the same tiers number their trackers alike), so two trackers on one host stay two entries. TrackerStatusTest covers it.
What
Implements the reserved
trackerscapability, for the "Product controls" row of #162: a torrent's own trackers and how each answers, which until now only showed in debug logs.TorrentController.trackers(taskId)listsTorrentTrackers in tier order: endpoint (scheme, host and port; never the path, which may hold a passkey), tier, state (idle,announcing,working,failed,timed-out; unknown wire values decode asidle), the peers the last answer named, the scrape's seeders and leechers, failures in a row, and the tracker's cleaned message.TrackerStatuscarries a credential-free label and its tier. V1 sessions already tracked statuses; v2 and hybrid sessions now publish theirs too. A hybrid announces to each tracker for both swarms and lists each once, with the status that says most. Without a session that announces, the metainfo's usable trackers (or a magnet's) are listed idle. Trackers Ketch adds from the settings are not listed.GET /api/torrents/{id}/trackers; the remote controller fails closed without the capability.Snapshots
New tab, so there is no before.
Testing
TrackerStatusTest(labels and tiers without the path, merging),TorrentTrackerViewsTest,KetchTorrentControllerTest,KotlinTorrentV2DiscoveryTest(a hybrid lists each tracker once, and none once paused),TorrentRoutesTest,RemoteTorrentControllerTest,TrackersTabTest,FilesTabTestlibrary:torrent,library:remote,library:serverandapp:sharedJVM suites; iOS and WasmJs compiles. A first full run caught a race between a hybrid's two announcers publishing a merged list, fixed by merging when the list is read.Not built here: adding or editing a task's trackers, and asking them again by hand.