cleanup(tcfs-sync): dead-code + DRY in the conflict/reconcile chokepoints (pre .git-aware-resolution)#512
Draft
Jesssullivan wants to merge 1 commit into
Draft
cleanup(tcfs-sync): dead-code + DRY in the conflict/reconcile chokepoints (pre .git-aware-resolution)#512Jesssullivan wants to merge 1 commit into
Jesssullivan wants to merge 1 commit into
Conversation
…ints Behavior-preserving cleanup of the conflict-resolution chokepoints ahead of the (separate) .git-aware conflict-resolution feature. No sync/conflict behavior changes. - reconcile.rs classify_path: delete the stale dead comment block trailing the match (the case it describes is already handled by the (Some, None, Some) arm). Comment-only. - reconcile.rs list_remote_index: use the existing DIR_MARKER_SUFFIX const instead of the byte-identical literal "/.tcfs_dir". Value-identical. - conflict.rs compare_clocks: collapse the Some(Ordering::Equal) and None arms into one Some(Ordering::Equal) | None arm; their ConflictInfo construction was byte-identical, so both still produce the same Conflict outcome. - reconcile.rs: extract the identical outcome -> ReconcileAction tail shared by compare_both_exist and compare_both_exist_symlink into one private helper outcome_to_action(). Pure code motion. - git_safety.rs: delete the dead pub fn restore_git_from_bundle (zero callers; superseded by restore_git_bundle_into). Deliberately excludes the rejected-unsafe items (the Conflict-arm/mark_conflict swap, the (true,true)=>None exhaustiveness arm, the UpToDate-on-hash-failure policy, and the refs/heads/*.lock literal) — those are feature-PR territory. Refs the G5-git-5 concurrent-write corruption gap in docs/ops/repo-roam-test-plan-2026-06-08.md.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A small, behavior-preserving dead-code + DRY cleanup of the conflict-resolution / reconcile chokepoints in
crates/tcfs-sync, prepping them for the (separate, later).git-aware conflict-resolution feature. No sync/conflict behavior changes.Items (each behavior-preserving)
reconcile.rsclassify_path— delete stale dead comment block. Removed the trailing comment after the(None, None, None)match arm describing a "Local exists, not remote, but was tracked" case that is already handled by the(Some, None, Some)arm above. Comment-only; no logic change.reconcile.rslist_remote_index— useDIR_MARKER_SUFFIXconst. Replaced the literal"/.tcfs_dir"with the existingconst DIR_MARKER_SUFFIX: &str = "/.tcfs_dir"(byte-identical value, already used inlist_remote_empty_dirs). Value-identical.conflict.rscompare_clocks— collapse two identical Conflict arms. TheSome(Ordering::Equal)andNonearms built byte-identicalConflictInfo; merged into oneSome(Ordering::Equal) | None =>arm with a singlenow/unwrap_or_default(). Both inputs still produce the sameSyncOutcome::Conflictwith the sameConflictInfo. Logically identical.reconcile.rs— extract the sharedoutcome -> ReconcileActiontail. The four-arm match mappingSyncOutcometoReconcileActionwas byte-identical incompare_both_existandcompare_both_exist_symlink. Extracted into one private helper and called from both sites. Pure code motion, zero behavior change.Helper signature:
git_safety.rs— delete deadpub fn restore_git_from_bundle.grep -rn restore_git_from_bundle crates/ tests/showed zero callers; it is superseded byrestore_git_bundle_into(the fn actually used bytcfs-cliandengine.rs). Removed.Deliberately excluded (rejected as unsafe — left exactly as-is)
These are behavior-changing / feature-PR territory and were intentionally not touched:
reconcile.rsConflict arm /mark_conflictswap (behavior-changing).conflict.rs(true, true) => None(needed for match exhaustiveness).AutoResolver/ConflictResolver/Resolutionvariants /compare_clockssignature /partial_cmp_vc/is_concurrent/chunk_hashes/is_legacy(all live, incl. integration tests).reconcile.rsUpToDate-on-hash-failure policy + theSystemTimedouble-compute.refs/heads/*.lockliteral-not-glob ingit_safety.rs(left for the feature PR).Why now
These are the chokepoints the upcoming
.git-aware conflict-resolution feature will modify. Clearing dead code and the duplicatedoutcome -> actionmapping first keeps the two reconcile paths (regular file + symlink) in lockstep and shrinks the feature PR's blast radius. See the G5-git-5 CONCURRENT-WRITE CORRUPTION gap indocs/ops/repo-roam-test-plan-2026-06-08.md, which is expected to fail until conflict resolution is made.git-aware.Validation (full local CI gate)
cargo fmt --all -- --check— clean (exit 0).cargo clippy --workspace --all-targets— zero warnings intcfs-sync; the only workspace warnings are 2 pre-existingneedless_borrowincrates/tcfsd/src/grpc.rs(lines 1442, 1876), confirmed identical onorigin/mainand unrelated to this diff.cargo test -p tcfs-sync— 324 passed, 0 failed.cargo test -p tcfsd— 58 passed, 0 failed (run becauseconflict.rsis consumed bytcfsd).