fix(server): retain checkpoint index metadata for specially flagged entries - #13768
XiaChuerwu wants to merge 1 commit into
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This production-path fix adds nontrivial Git index parsing, sparse-checkout handling, and private-index repair logic to alter when checkpoint captures reuse metadata versus rebuild it. Although the tests are extensive and the scope is localized, the runtime decision and implementation complexity merit human review. You can add or adjust custom eligibility rules. Learn more. |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughCheckpoint index reuse now handles assume-unchanged and skip-worktree flags by inspecting staged records and repairing flagged entries in the private index. Sparse-rule and repair failures can trigger a fresh-index fallback. Tests cover capture contents, source-index preservation, racy edits, and split indexes. ChangesCheckpoint index reuse
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~25 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable issue remains from this review. The gitlink case rebuilds the private index as intended, and the checked sparse-rule behavior matches the implementation. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Checkpoint capture now repairs more flagged entries instead of rebuilding its private index. The review found no new access boundary or material security risk, and the existing fallback remains in place. Simultaneous captures were not covered by the available tests. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
Fixes #13741. Follow-up to #10792 and #12154: manual skip-worktree or assume-unchanged entries still discard the copied checkpoint index and force a cold rebuild. The reported non-sparse mapped-drive worktree repeatedly hit the 30-second Git timeout. Manual flags in sparse checkouts have the same fallback.
Fix
Keep ordinary entries' cached metadata and reinsert flagged entries into the private index using
update-index --index-info, clearing their flags/stat without losing tracked status. Use sparse rules to distinguish manual in-cone flags from ordinary exclusions. Preserve skip bits during private inspection so Git cannot silently clear them before we invalidate stale metadata; final staging retains its existing behavior.When repairing manual sparse entries, invalidate remaining excluded file entries' stat data too, then restore their skip bits. This captures present exclusions with same-size/same-mtime edits without deleting absent exclusions or expanding sparse directories. Restore the conservative index timestamp after all index writes. The real index/config remain untouched.
Keep the existing fallback for malformed/truncated inspection output, failed repair, excluded assume-unchanged entries, and unsupported flagged gitlinks. This composes with #13543 rather than replacing its saved-index optimization.
Verification
vp test run apps/server/src/vcs/GitVcsDriver.test.ts -t 'checkpoint (capture|index|refreshes|falls back)|sparse checkpoint': 49 passed, 20 skipped on Windows (exit 0).pnpm --filter t3 typecheck: passed.git diff --check: passed.Earlier full-file run before the sparse extension: 55 passed, 1 failed. The unchanged
restores empty checkpoints without changing paths outside the workspacetest fails withENOENTwritingnested/added.txt; the same failure was reproduced with both original HEAD files. That unrelated fixture is not modified here.Regressions cover ordinary index-cache reuse, h/S/s flags, streamed inspection, ignored-but-tracked edits/deletions, same-size/same-mtime changes in flagged entries, sparse exclusions, nested workspaces, split indexes, failure fallback, unchanged real index, and racy timestamps. An unflagged file with deliberately preserved stat metadata remains subject to Git's pre-existing stat-cache limitations; this is not a general fix for that case.
An earlier non-sparse packaged-app patch completed one previously failing checkpoint in 11.09 seconds after restart. This is one observation, not a benchmark guarantee or runtime verification of the later sparse extension.
Model: GPT-6 Astra. Harness: Claude Code via T3 Code.
Summary by CodeRabbit