Skip to content

Recover committed tracker edits ahead of TaskStore - #223

Closed
linroid wants to merge 2 commits into
torrent-v2-11-tracker-revisionsfrom
torrent-v2-11-tracker-checkpoint-recovery
Closed

linroid wants to merge 2 commits into
torrent-v2-11-tracker-revisionsfrom
torrent-v2-11-tracker-checkpoint-recovery

Conversation

@linroid

@linroid linroid commented Sep 12, 2026

Copy link
Copy Markdown
Owner

A tracker edit may reach its on-disk checkpoint before TaskStore publishes new resume data. Session startup now reads the journal-owned checkpoint and adopts a newer tracker configuration before discovery starts. Received/uploaded counters keep the greater value, including same-revision checkpoints; payload progress still comes from rechecking bytes.

Recovery validates checkpoint identity, bounded size, task/hash/output/selection binding, and positive revision consistency. Decoding and retained tracker state require session-budget admission. Pause, save, and shutdown cannot overwrite the committed file with stale state if recovery fails. This complete-checkpoint reader can reject a decode when configured memory is insufficient; streaming recovery and large-profile performance evidence remain follow-up work.

Stacked on #222; advances #162. Public controls, idempotent commands, independent v2 interoperability, and remaining roadmap/release gates are still open.

Validation: 584 JVM and 563 executed iOS tests passed with zero failures/errors/skips; native-runtime guard and two pinned v1 conformance scenarios passed. New tests use the real engine with stale resume data and corrupted payloads, recover same-revision counters, reject replaced or wrongly bound checkpoints, and verify admission/cancellation cleanup. The failed-recovery shutdown regression overwrote the newer bytes before the write guard and passes with the guard.

@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-12T23:19:28.766853Z c898319 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: c898319d1e

ℹ️ 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 state = trackerConfigurationBudget ?: return
store.withPersistedCheckpoint(state) { saved ->
val current = store.trackerConfigurationSnapshot()
if (saved.trackerRevision > current.revision) {

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 Refresh the revision after recovering the disk checkpoint

When replaceTrackers() is the first operation on a restored session and this branch adopts a disk checkpoint newer than TaskStore, actualRevision has already been captured from the stale in-memory checkpoint before recover() runs. The later store.replaceTrackerConfiguration(..., actualRevision) therefore throws TrackerRevisionConflict even when the caller supplied no expectedRevision, so an unconditional edit unexpectedly fails and requires a retry. Recover the checkpoint before determining the revision, or refresh the revision after recovery while preserving the caller's optional conflict check.

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 34fce20. Before recovery is complete, edits no longer pre-check against the TaskStore revision. The final store commit checks the caller's optional expected revision against recovered state; an unconditional edit uses the current revision. The new regression covers first-operation edits with no expected revision, the recovered revision, and an explicitly stale revision. It failed before the fix (expected 0, actual 1) and the recovery/session focused suite passes afterward.

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

  747 files  + 5    747 suites  +5   4m 14s ⏱️ -19s
3 134 tests +18  3 134 ✅ +18  0 💤 ±0  0 ❌ ±0 
4 302 runs  +30  4 302 ✅ +30  0 💤 ±0  0 ❌ ±0 

Results for commit 34fce20. ± Comparison against base commit ee5a578.

♻️ This comment has been updated with latest results.

@linroid

linroid commented Sep 20, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #237 (Tracker lifecycle, editing and discovery privacy) 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
linroid deleted the torrent-v2-11-tracker-checkpoint-recovery 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