Skip to content

feat(torrent): list a torrent's trackers and how each answers - #669

Merged
linroid merged 3 commits into
mainfrom
feat/torrent-trackers
Nov 14, 2026
Merged

linroid merged 3 commits into
mainfrom
feat/torrent-trackers

Conversation

@linroid

@linroid linroid commented Nov 14, 2026

Copy link
Copy Markdown
Owner

What

Implements the reserved trackers capability, for the "Product controls" row of #162: a torrent's own trackers and how each answers, which until now only showed in debug logs.

  • API: TorrentController.trackers(taskId) lists TorrentTrackers 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 as idle), the peers the last answer named, the scrape's seeders and leechers, failures in a row, and the tracker's cleaned message.
  • Engine: TrackerStatus carries 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.
  • Server and remote: GET /api/torrents/{id}/trackers; the remote controller fails closed without the capability.
  • Apps: a Trackers tab in a torrent's inspector, on devices with the capability, refreshed every 3 s while it shows. Translated in every language.

Snapshots

New tab, so there is no before.

Light Dark

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, FilesTabTest
  • The whole library:torrent, library:remote, library:server and app:shared JVM 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T04:29:47.851463Z 88fe676 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.

@claude

claude Bot commented Nov 14, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@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: 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".

Comment on lines +43 to +45
val key = status.tier to status.label
val kept = merged[key]
if (kept == null || status.weight() > kept.weight()) merged[key] = status

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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.

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 284 files  + 7   2 312 suites  +7   57m 9s ⏱️ - 1m 41s
16 173 tests +33  15 891 ✅ +32  282 💤 +1  0 ❌ ±0 
19 650 runs  +47  19 368 ✅ +46  282 💤 +1  0 ❌ ±0 

Results for commit ccda8f8. ± Comparison against base commit edf5327.

@linroid
linroid merged commit 707f0ca into main Nov 14, 2026
14 checks passed
@linroid
linroid deleted the feat/torrent-trackers branch November 14, 2026 04:55
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