Skip to content

adapter/jj: avoid false conflict detection on literal marker text - #70

Merged
kridaydave merged 2 commits into
mainfrom
fix/pr-real-bug
Nov 8, 2026
Merged

kridaydave merged 2 commits into
mainfrom
fix/pr-real-bug

Conversation

@kridaydave

Copy link
Copy Markdown
Contributor

Problem

JjAdapter::extract_snapshot_with_conflicts (src/adapter/jj.rs:231-233 before this change) flagged a file as conflicted when any single merge-marker line appeared in its content:

if text.lines().any(is_conflict_marker_line) {
    conflicted.push(path.to_string());
}

Legitimate files (documentation, test fixtures, tutorials) that contain marker-like text such as a bare <<<<<<< HEAD line were misclassified as conflicted and silently excluded from the snapshot. That means adjudication never saw those files and could miss real disputes involving them.

Evidence (before fix)

New test test_literal_marker_text_is_not_a_conflicted_file failed against the old heuristic:

running 1 test
test adapter::jj::tests::test_literal_marker_text_is_not_a_conflicted_file ... FAILED

thread 'adapter::jj::tests::test_literal_marker_text_is_not_a_conflicted_file' panicked at src/adapter/jj.rs:
a lone marker line in normal content must not flag the file as conflicted

test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 100 filtered out

Fix

Detect a conflict region by requiring both an opening marker (<<<<<<<) and a closing marker (>>>>>>>) to be present (content_has_conflict_markers), instead of flagging on any single marker line. Real jj/git materialized conflicts always form such a region; a lone marker in normal content does not.

Verification

  • cargo test adapter::jj::tests --lib: 6 passed, 0 failed (includes the new literal-marker and real/diff3 conflict cases).
  • cargo test (full suite): 98 passed, 3 failed — the 3 failures are store::tests::test_plaintext_guard_reports_cleanup_failure, test_plaintext_paths_refuse_on_stat_errors, test_remove_now_attempts_every_path, all permission-based tests that fail when run as root (EACCES/chmod restrictions are bypassed). They are unrelated to this change (git diff touches only src/adapter/jj.rs) and reproduce independently of it in a root environment.

root added 2 commits November 8, 2026 21:31
extract_snapshot_with_conflicts flagged a file as conflicted when any
single merge-marker line appeared in its content. Legitimate files
(docs, test fixtures) that contain text like '<<<<<<< HEAD' were
silently excluded from the snapshot, so adjudication missed them.

Require both an opening (<<<<<<<) and closing (>>>>>>>) marker to
identify a real conflict region.
@kridaydave
kridaydave merged commit 43d0361 into main Nov 8, 2026
5 checks passed
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