Skip to content

Own v2 downloads through joined pause and resume lifecycles - #227

Closed
linroid wants to merge 2 commits into
torrent-v2-11-session-scrapefrom
torrent-v2-08-session-lifecycle
Closed

linroid wants to merge 2 commits into
torrent-v2-11-session-scrapefrom
torrent-v2-08-session-lifecycle

Conversation

@linroid

@linroid linroid commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Adds a scoped owner for the full-metainfo v2 download pipeline. Pause and shutdown join discovery, dial workers, peer actors, and storage commits before acknowledging completion or releasing lifetime admission. Resume rechecks owned payloads before discovery, so files modified while paused cannot retain verified progress. Failures can be retried without overlapping terminal jobs.

The owner validates metadata identity and selection against storage before I/O, and progress comes from verified storage. Tests include real TCP download/repair after paused-file modification, delayed discovery cleanup, repeated failure/retry, pre-I/O selection rejection, and shutdown admission ordering.

Stacked on #226 for #162. This is the lifecycle prerequisite for engine registration; public v2 resolution, incoming full-identity routing, checkpoint/TaskStore wiring, rate controls, discovery integration, and seeding remain roadmap work. It does not advertise public v2 capability. The TCP peer is a Ketch fixture, so this is not independent v2 interoperability evidence.

Validation: full JVM and executed iOS simulator suites, native-runtime dependency guard, and the existing two Transmission v1 conformance scenarios.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 13, 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-09-13T00:33:56.676281Z 09f525d 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: 09f525d4a9

ℹ️ 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".

discover: suspend (SendChannel<PeerEndpoint>) -> Unit,
body: suspend (TorrentV2DownloadSession) -> T,
): T = coroutineScope {
require(layout.infoHash == document.info.hash && peerId.size == 20)

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 Bind the session to the document's full layout

For hybrid metainfo, this check accepts TorrentContentLayout.from(document.info) even though the store derives its canonical layout with document.hybrid. If a subset includes a file whose v1 index differs because of padding entries, requireBinding succeeds using the store's IDs, but resume later stops when the scheduler rejects that ID against the non-hybrid layout. Validate the complete layout or construct it from the document internally before starting the session.

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 d72fce5. Session admission now compares the supplied layout against storage's canonical hybrid-aware layout, including file IDs/indices, offsets/lengths, piece length, and protocol/payload totals. The selected-file-after-padding regression failed before the guard and passes afterward. The child engine slice constructs the canonical hybrid layout and downloads that selected file over real TCP. Combined validation passes 613 JVM tests, 592 executed iOS simulator tests, the native-runtime guard, and both existing v1 conformance scenarios.

@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  767 files  + 5    767 suites  +5   4m 20s ⏱️ ±0s
3 197 tests +18  3 197 ✅ +18  0 💤 ±0  0 ❌ ±0 
4 407 runs  +30  4 407 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit d72fce5. ± Comparison against base commit 584e0cc.

♻️ This comment has been updated with latest results.

linroid added a commit that referenced this pull request Sep 20, 2026
Consolidates #227–#228, preserving source b55c481.
Includes the foundation listener cancellation regression fix discovered by consolidation CI.
@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #238 (V2 engine lifecycle, rate controls and restart recovery) in the consolidated eight-PR stack for #162.

The replacement preserves this PR's code and subsequent fixes; its description links the original head and review discussions. The only additional consolidation fix is the CI-discovered listener cancellation regression, documented on the replacement. All eight replacements have passed their required CI checks.

Closing without merging. This branch and its discussions remain available for reference. Review index: #162 (comment)

@linroid linroid closed this Sep 20, 2026
linroid added a commit that referenced this pull request Sep 20, 2026
…ry (#238)

Consolidates #227–#228, preserving source b55c481.
Includes the foundation listener cancellation regression fix discovered by consolidation CI.
@linroid
linroid deleted the torrent-v2-08-session-lifecycle branch September 20, 2026 11:13
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