Skip to content

Persist authenticated v2 content in a bounded catalog - #180

Closed
linroid wants to merge 3 commits into
torrent-v2-06-recheckfrom
torrent-v2-07-catalog
Closed

linroid wants to merge 3 commits into
torrent-v2-06-recheckfrom
torrent-v2-07-catalog

Conversation

@linroid

@linroid linroid commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Persist authenticated raw info and piece layers in a bounded catalog addressed by full v2 identity. Hybrid reads authenticate all requested topics; exact info bytes are retained, while tracker URLs, comments and other caller context are omitted. Existing entries are validated before reuse and corrupt objects are rejected without overwrite.

Publication flushes a uniquely created temporary object before atomic no-replace hard-link publication and cleans up its unchanged temporary file on failure. Reads enforce the 32 MiB bound before loading and reject growth during the read.

Stack: based on #179, advancing #162 step 07. Runtime admission, streaming/spilling at full layer limits, catalog references/GC, directory-fsync power-loss guarantees, checkpoint v2 references and task ownership persistence remain pending. This does not by itself enable restart of downloads.

Validation: six focused catalog tests and iOS simulator compilation pass for the publication-race fix. New catalog tests cover reopening, caller-context separation, hybrid topics and external layers, corrupt/oversized objects, publication failure/retry, and valid/invalid competing-target races. The inherited #179 fix flushes rechecked files once and revokes tentative pieces on flush failure.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 12, 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-12T15:14:33.651515Z d6b88c6 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: d6b88c6d08

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

}
checkNotNull(root(create = false))
// Another catalog instance may already have published the same authenticated object.
if (read(target, identity) == null) fileSystem.atomicMove(temp, target)

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 Avoid replacing a target created after the final check

When another process creates or corrupts the target after read(target, identity) returns null but before this call, Okio's atomicMove replaces the existing destination, so put overwrites an entry that it never authenticated despite the catalog's non-overwrite guarantee. Publication needs a no-replace primitive or equivalent synchronization, followed by authentication of the winning target when the destination already exists.

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 5d61004. Catalog publication now uses atomic no-replace hard-link creation (Files.createLink on JVM/Android, POSIX link on iOS), then authenticates the winning target whether publication succeeded or another entry already existed. There is no replacing-move fallback. The regression creates valid and invalid competing targets at the publication boundary and proves they remain unchanged. All six catalog tests pass and the iOS simulator implementation compiles.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  574 files  + 5    574 suites  +5   3m 58s ⏱️ -5s
2 506 tests +18  2 506 ✅ +18  0 💤 ±0  0 ❌ ±0 
3 250 runs  +30  3 250 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit c1fc31f. ± Comparison against base commit cbc0856.

♻️ This comment has been updated with latest results.

@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #234 (V2 catalog, checkpoints and crash 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
Consolidates #180–#185, preserving source 9f23c0d.
Includes the foundation listener cancellation regression fix discovered by consolidation CI.
@linroid
linroid deleted the torrent-v2-07-catalog branch September 20, 2026 11:12
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