Skip to content

Improve managed recovery and collection; bump tgrep to 1.3.0 - #233

Merged
Shengyu Fu (shengyfu) merged 6 commits into
mainfrom
shengyfu-maintenance-loop-verification
Dec 2, 2026
Merged

Shengyu Fu (shengyfu) merged 6 commits into
mainfrom
shengyfu-maintenance-loop-verification

Conversation

@shengyfu

@shengyfu Shengyu Fu (shengyfu) commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: e9471af763fe770ee32d7617295528a470a21bd4

Dimension Assessment Rationale
Change confidence 9/10 ↑ CI passed all ten jobs, including full workspace tests on native Windows ARM64, Windows x64, Linux, and macOS, plus existing lifecycle measurements, Clippy, formatting, and the Windows Rust 1.88 release build.
↑ ARM64 CI reproduced the unsupported /CETCOMPAT linker flag; architecture scoping fixed it while preserving x64 hardening.
↓ Catalog/verifier contention failed two jobs before an unchanged rerun passed; original incident-scale contention remains unverified, and runtime integration predates the follow-ups.
Diagnosis confidence 9.5/10 ↑ Native phase-4 replay left the receipt pending on 1.2.10 and recovered it on the first pass with 1.3.0.
↑ Regression tests reproduce deferred-receipt starvation, retained proofs after partial deletion, and malformed receipts blocking resumed recovery before their fixes.
↑ Native ARM64 linking failed with LNK1246 for /CETCOMPAT before the architecture-specific fix.
Evidence fit 8.5/10 ↑ Reproduction uses the incident's resumed phase-4 cursor and preparing/not-committed receipt state; the regression suite now also passes natively on Windows ARM64.
↓ The original 411 MB catalog, 8.4 GB cache, and ARM64 disk-contention workload were not replayed; runtime retry fixes are separate.

Summary

  • Recover interrupted receipts without waiting for a long metadata-cleanup traversal to wrap back to the operation phase. The bounded fast path preserves live producers and leaves half the examination/time budgets for ordinary recovery, preventing deferred receipts from starving cleanup. Malformed receipts and eligibility errors are reported per receipt without blocking unrelated cleanup.
  • Unlink a fully verified member in one journaled step when it fits the remaining deletion-byte budget; retain bounded truncation for larger members.
  • Continue productive automatic collection traversals at the base retry interval until a complete traversal changes nothing, then back off.
  • Reclaim seal rows for confirmed removed members while their object remains pending deletion. Preserve member deletion receipts and surviving members' proofs, allowing collection to resume with exact accounting.
  • Bump the workspace and both lockfiles to 1.3.0, update release examples, and document the lifecycle behavior.
  • Add windows-11-arm to the existing full CI test matrix, with checks for an ARM64 runner and native aarch64-pc-windows-msvc Rust host. Scope /CETCOMPAT to Windows x64; retain control-flow guard, static CRT, and /DYNAMICBASE on both Windows architectures.

Validation

  • Current head e9471af763fe770ee32d7617295528a470a21bd4: all ten CI jobs passed, and all 16 PR checks passed.
  • Native Windows ARM64 job confirms host: aarch64-pc-windows-msvc and passes the full locked workspace suite, including 525 core unit tests, 399 CLI unit tests (2 existing ignored), 117 shared-daemon tests (4 existing ignored), 3 native Windows catalog tests, 42 managed lifecycle tests, pinned legacy compatibility controls, and vendored tests/doctests. No new skips or relaxed assertions; the existing two-test-thread setting and 40-minute timeout are unchanged.
  • The first ARM64 build exposed LNK1246 from the unconditional x64-only /CETCOMPAT flag. After scoping that flag, local Windows catalog tests passed 3/3, verbose compiler commands retained all four x64 hardening flags, and native ARM64 compilation succeeded.
  • The first full-suite attempt at the current head hit busy/catalog-io during an ARM64 migration test and member-verifier-active in a macOS collection fault test. Both failed jobs passed on an unchanged rerun; no automatic test retries were added. These contention failures remain visible in attempt 1 of the linked run.
  • Review-fix commit af1c02029b75a6974024b4326f52ffdaace938f4: all nine CI jobs passed, including full workspace tests and managed lifecycle measurements on Windows, Linux, and macOS. All 15 PR checks, including CodeQL and CLA, passed at that revision.
  • The malformed-receipt regression failed before the fix and passed afterward. The macOS prefix-mutation fixture retains its safety assertions with a smaller deletion budget and bounded sweeps; native macOS CI confirms it passes. The Windows polling test now waits for live query publication instead of treating disk evidence as a reader-swap barrier; Windows CI confirms it passes.
  • Review follow-up local checks: 34 collection/recovery core tests, 6 watcher integration tests, workspace all-target Clippy with managed test hooks, formatting, and diff checks passed.
  • Initial local verification: 130 managed core unit tests and 399 CLI unit tests passed (2 CLI tests ignored).
  • At the repository's normal two-thread concurrency: 3 Windows catalog tests, 42 managed lifecycle tests, 12 collection/recovery daemon tests, and 3 metadata/proof daemon tests passed.
  • Workspace all-target Clippy with managed test hooks, formatting, diff checks, and the locked release build passed.
  • Windows x64 binary from 1a7b9b281f05eb86f2eef0944cf1cd97243cba06 integrated with the runtime fixes: complete two-file SDK suite 9/9, separate seeded journal probe 1/1, and native phase-4 recovery resolved the predecessor on the first pass. This integration predates the review and CI follow-ups and was not rerun against the current head.
  • The collection fixture reached zero unreferenced checkpoint bytes with the incident's collection budgets and grace disabled; the tuned-policy fixture also drained successfully. These are small-fixture results, not an original-incident throughput claim.

Compatibility and scope

No protocol or storage-format change; deprecated v1 remains supported. Existing authentication, ownership, byte limits, and conservative accounting remain in force.

Checkpoint deduplication, transaction batching, larger proof blocks/Merkle storage, VACUUM, and new backlog telemetry are not included. Freed SQLite pages are reused, not returned to the filesystem by VACUUM.

Companion runtime recovery/backoff changes were tested separately. Its download pin remains on published 1.2.10 until matching 1.3.0 release assets exist; this PR does not publish a release.

Shengyu Fu (shengyfu) and others added 3 commits December 1, 2026 10:36
…ection; bump to 1.3.0

- maintenance.recover now resolves unfinished receipts of ended instances,
  cancelled or expired operations on every pass, including passes resumed
  past the operation phase, after releasing their reservations. Previously
  a sweep resumed past phase 3 left such receipts pending until the cursor
  wrapped, so offline collection kept deferring on the stuck token.
- Collection unlinks a verified member that fits the remaining deletion
  budget in one journaled step instead of chunked tail truncations.
- The daemon starts another collection traversal at the base retry
  interval after a productive one, until a traversal changes nothing.
- Document the new behavior and bump the workspace to 1.3.0.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Page through pending receipts and reserve half the pass budget for the ordinary recovery sweep. Preserve live producer reservations and cover one-row and multi-row limits with a regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Release proof rows in bounded housekeeping batches while an object remains pending deletion. Keep its member deletion receipts and every surviving member's proofs, and verify collection resumes with exact accounting.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 22:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The macOS prefix-mutation test panics after its payload is deleted, and malformed pending receipts can repeatedly abort cleanup, blocking unrelated catalog work.

2 open issues
What changed in this PR

This PR improves managed shared-daemon recovery and collection, and prepares tgrep 1.3.0 without changing the protocol or storage format.

Changes:

  • Add a bounded fast path for interrupted receipts during resumed recovery.
  • Speed up verified-member deletion, reclaim removed-member proofs earlier, and continue productive collection sweeps.
  • Add regression tests, document lifecycle behavior, and update release versions and examples.
File Description
tgrep-core/​src/​managed/​maintenance.rs Add interrupted-receipt recovery and regression tests.
tgrep-core/​src/​managed/​housekeeping.rs Reclaim proofs for removed members before object deletion completes.
tgrep-core/​src/​managed/​collection.rs Unlink verified members within budget and test collection behavior.
tgrep-cli/​src/​serve/​shared/​managed.rs Continue productive collection sweeps at the base retry interval.
SHARED_WORKTREE_INDEXES.md Document recovery, deletion, cleanup, and scheduling behavior.
fuzz/​Cargo.lock Update the core package version to 1.3.0.
CONTRIBUTING.md Update release-tag examples to v1.3.0.
Cargo.toml Set the workspace version to 1.3.0.
Cargo.lock Update first-party package versions to 1.3.0.

Review effort: Balanced

Comment thread tgrep-core/src/managed/collection.rs Resolved
Comment thread tgrep-core/src/managed/maintenance.rs Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 1, 2026 23:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Resetting the receipt scan position on every pass lets deferred receipts repeatedly consume the fast-path budget, delaying recoverable receipts until the full cleanup traversal wraps.

No open issues 🎉

1 previously missed issue

In code that hasn't changed since last review

Medium severity Deferred receipts can starve recoverable receipts on the fast path

tgrep-core/​src/​managed/​maintenance.rs:1038

Resetting after on every pass lets deferred receipts monopolize the fast path: with max_examined = page_objects = 4, two lower-ID cancelled receipts with live producers consume both slots on every resumed cleanup pass. A recoverable receipt behind them still waits for the full cleanup traversal to wrap, defeating expedited recovery for that receipt. Retain or rotate a separate receipt-scan position across passes while preserving the half-budget cap, and add a regression with a recoverable receipt behind a deferred prefix.

2 resolved since last review

Review effort: Balanced

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the managed-daemon recovery and storage-reclamation changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings December 2, 2026 01:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The linked successful CI run excludes the new Windows ARM64 job, leaving native ARM64 validation outstanding for crash-recovery, deletion-accounting, and filesystem-locking changes.

No open issues 🎉

Review effort: Balanced

Keep CFG, static CRT and ASLR on both Windows architectures; native ARM64 rejects /CETCOMPAT with LNK1246.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings December 2, 2026 01:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Destructive reclamation and accelerated receipt recovery alter crash-recovery invariants, while the original large-catalog ARM64 contention workload remains unverified and the cited CI run does not cover the added ARM64 job.

No open issues 🎉

Review effort: Balanced

@shengyfu
Shengyu Fu (shengyfu) merged commit 2cae6ca into main Dec 2, 2026
25 of 27 checks passed
@shengyfu
Shengyu Fu (shengyfu) deleted the shengyfu-maintenance-loop-verification branch December 2, 2026 03:17
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.

2 participants