Skip to content

fix(install): regenerate conflicted lockfiles#843

Merged
jdx merged 1 commit into
mainfrom
fix/install-conflicted-lockfile
Jun 7, 2026
Merged

fix(install): regenerate conflicted lockfiles#843
jdx merged 1 commit into
mainfrom
fix/install-conflicted-lockfile

Conversation

@jdx

@jdx jdx commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • detect Git conflict markers in the active lockfile and treat them as a regenerable prefer-frozen parse failure
  • add WARN_AUBE_LOCKFILE_CONFLICT_MARKERS for the regeneration path
  • cover plain aube install rewriting a conflicted aube-lock.yaml fixture
  • move an existing linker test module below its helper so the all-targets clippy gate passes

Testing

  • cargo fmt --check
  • cargo test -p aube-codes
  • cargo build
  • BATS_NUMBER_OF_PARALLEL_JOBS=1 test/bats/bin/bats -j 1 --filter 'aube install regenerates lockfile with merge conflict markers' test/install.bats
  • cargo clippy --all-targets -- -D warnings
  • cargo test -p aube-linker package_name_tests

Note: mise run test:bats test/install.bats could not run in this environment because GNU parallel is missing, so the focused BATS regression was run directly with -j 1.

This PR was generated by Codex.


Note

Medium Risk
Changes prefer-frozen lockfile parse behavior on merge artifacts; other parse errors still fail, but wrong marker detection could mask corruption or trigger unintended re-resolve.

Overview
Install now treats a lockfile that still has Git merge conflict markers (<<<<<<<, =======, >>>>>>>) as recoverable in Fix/Prefer frozen modes instead of failing parse: it emits WARN_AUBE_LOCKFILE_CONFLICT_MARKERS, skips using the broken file as existing, and continues so the lockfile is regenerated from package.json. Detection lives in aube_lockfile::active_lockfile_has_conflict_markers; --lockfile-only dedupes the warning when pre-parse already warned.

Linker: is_safe_package_component is moved above the package_name_tests module (clippy / module order only).

Tests: BATS covers full install and --lockfile-only rewriting a conflicted aube-lock.yaml fixture.

Reviewed by Cursor Bugbot for commit 75e2d41. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Detects Git merge conflict markers in lockfiles and regenerates the lockfile from project dependencies to continue installation.
  • Warnings

    • Introduces a new warning informing users when an active lockfile contains Git conflict markers and is being regenerated.
  • Tests

    • Added a test validating lockfile regeneration removes conflict markers and preserves expected dependencies.

@coderabbitai

coderabbitai Bot commented Jun 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe8aeaa7-e940-4c80-81fe-7e4e7ec30d0f

📥 Commits

Reviewing files that changed from the base of the PR and between c2f6007 and 75e2d41.

📒 Files selected for processing (8)
  • crates/aube-codes/src/warnings.rs
  • crates/aube-linker/src/materialize.rs
  • crates/aube-lockfile/src/io.rs
  • crates/aube-lockfile/src/lib.rs
  • crates/aube/src/commands/install/mod.rs
  • crates/aube/src/commands/install/resolve.rs
  • docs/error-codes.data.json
  • test/install.bats
✅ Files skipped from review due to trivial changes (2)
  • crates/aube-linker/src/materialize.rs
  • crates/aube-lockfile/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (2)
  • crates/aube-lockfile/src/io.rs
  • crates/aube-codes/src/warnings.rs

📝 Walkthrough

Walkthrough

This PR adds detection for Git merge conflict markers in on-disk lockfiles, registers a new warning code, and updates install to warn once and regenerate the lockfile (skipping the conflicted file) while preserving prior error reporting for other parse failures.

Changes

Lockfile Conflict Marker Recovery

Layer / File(s) Summary
Warning code definition and module export
crates/aube-codes/src/warnings.rs, crates/aube-lockfile/src/lib.rs
Adds WARN_AUBE_LOCKFILE_CONFLICT_MARKERS and its CodeMeta entry; reflows pub use io::{...} formatting.
Conflict detection utility
crates/aube-lockfile/src/io.rs
Adds active_lockfile_has_conflict_markers and has_conflict_markers scanner to detect <<<<<<</=======/>>>>>>> patterns in lockfile content.
Install command integration
crates/aube/src/commands/install/resolve.rs, crates/aube/src/commands/install/mod.rs
pre_parse_lockfile and run_lockfile_only detect conflicted lockfiles, emit the new warning (once), return Ok(None)/skip the lockfile, and preserve existing diagnostics for other parse errors; new flag flows through LockfileOnlyInput.
Package component helper relocation
crates/aube-linker/src/materialize.rs
Moves private is_safe_package_component next to its tests; behavior unchanged.
Integration tests for conflict recovery
test/install.bats
Adds helper to write a conflicted aube-lock.yaml and a test verifying install regenerates the lockfile and removes conflict markers.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

In burrows deep where markers lie,
A rabbit sniffs the merge-torn sky.
It nudges locks with gentle paws,
Regenerates them without a cause.
Hoppity fix—conflict undone. 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(install): regenerate conflicted lockfiles' accurately and concisely summarizes the main change: detecting Git conflict markers in lockfiles and regenerating them.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/install-conflicted-lockfile

Comment @coderabbitai help to get the list of available commands and usage tips.

@jdx jdx force-pushed the fix/install-conflicted-lockfile branch from a00e403 to c2f6007 Compare June 7, 2026 16:58
@greptile-apps

greptile-apps Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes aube install gracefully recover when the active lockfile contains Git merge conflict markers, instead of aborting with a parse error. In Fix/Prefer frozen modes, detected markers trigger a WARN_AUBE_LOCKFILE_CONFLICT_MARKERS warning and a full regeneration from package.json; the --lockfile-only path shares the same detection and correctly emits the warning exactly once.

  • Adds active_lockfile_has_conflict_markers / has_conflict_markers in aube-lockfile::io with a lockfile_candidates-ordered scan matching the parser's own precedence.
  • Threads lockfile_conflict_marker_warning_emitted from pre_parse_lockfile through LockfileOnlyInput so the run_lockfile_only re-parse path suppresses the duplicate warning.
  • Moves is_safe_package_component above its test module in materialize.rs (no logic change) to satisfy clippy --all-targets; adds two BATS tests covering full install rewrite and single-warning behavior.

Confidence Score: 5/5

Safe to merge — the conflict-marker recovery path is narrowly scoped to Fix/Prefer modes and --lockfile-only, other parse errors still fail loudly, and two targeted BATS tests cover the new behavior end-to-end.

The detection logic is correct and appropriately conservative (requires the standard <<<<<<< / ======= / >>>>>>> patterns), the deduplication flag logic in mod.rs is provably sound under all mode combinations, and the linker reorder is a no-op rename. No correctness issues were identified.

No files require special attention.

Important Files Changed

Filename Overview
crates/aube-lockfile/src/io.rs Adds active_lockfile_has_conflict_markers and private has_conflict_markers; detection logic correctly handles CRLF on the separator and requires trailing space on angle-bracket markers.
crates/aube/src/commands/install/resolve.rs Adds conflict-marker recovery in pre_parse_lockfile and run_lockfile_only; deduplication flag correctly suppresses the second warning in the --lockfile-only path.
crates/aube/src/commands/install/mod.rs Computes lockfile_conflict_marker_warning_emitted after pre_parse_lockfile and threads it into LockfileOnlyInput; logic is sound — all four guard conditions are necessary and sufficient.
crates/aube-linker/src/materialize.rs Moves is_safe_package_component above the test module to satisfy --all-targets clippy; pure reorder, no logic change.
test/install.bats Adds two BATS tests covering full install rewrite and single-warning guarantee; conflict fixture is representative and assertions are appropriate.

Reviews (2): Last reviewed commit: "fix(install): regenerate conflicted lock..." | Re-trigger Greptile

Comment thread crates/aube/src/commands/install/resolve.rs

@coderabbitai coderabbitai 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.

🧹 Nitpick comments (1)
test/install.bats (1)

33-64: 💤 Low value

Consider verifying warning emission.

The test successfully verifies the behavioral outcome (lockfile regeneration), but doesn't confirm that the warning code WARN_AUBE_LOCKFILE_CONFLICT_MARKERS was actually emitted.

For integration-level testing, the current approach is reasonable. If you want stronger coverage, you could add an assertion on the warning output.

💡 Optional: Add warning verification
 	run aube install
 	assert_success
+	assert_output --partial "conflict markers"
 	run grep -E '^(<<<<<<<|=======|>>>>>>>)' aube-lock.yaml
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/install.bats` around lines 33 - 64, The test "aube install regenerates
lockfile with merge conflict markers" verifies lockfile cleanup but doesn't
assert the warning was emitted; update the test to capture/install command
output and assert that the warning identifier
WARN_AUBE_LOCKFILE_CONFLICT_MARKERS (or its human-readable message) appears in
stdout/stderr after running `aube install` (the second run that triggers
regeneration) so the integration test verifies both behavior and the expected
warning emission.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@test/install.bats`:
- Around line 33-64: The test "aube install regenerates lockfile with merge
conflict markers" verifies lockfile cleanup but doesn't assert the warning was
emitted; update the test to capture/install command output and assert that the
warning identifier WARN_AUBE_LOCKFILE_CONFLICT_MARKERS (or its human-readable
message) appears in stdout/stderr after running `aube install` (the second run
that triggers regeneration) so the integration test verifies both behavior and
the expected warning emission.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3b6c219d-8ff2-454b-aad5-ec0324e2c18d

📥 Commits

Reviewing files that changed from the base of the PR and between 15fc05c and c2f6007.

📒 Files selected for processing (6)
  • crates/aube-codes/src/warnings.rs
  • crates/aube-linker/src/materialize.rs
  • crates/aube-lockfile/src/io.rs
  • crates/aube-lockfile/src/lib.rs
  • crates/aube/src/commands/install/resolve.rs
  • test/install.bats

@jdx jdx force-pushed the fix/install-conflicted-lockfile branch from c2f6007 to b893ea1 Compare June 7, 2026 17:15

jdx commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

Addressed the review feedback:

  • --lockfile-only now carries whether the pre-parse already emitted WARN_AUBE_LOCKFILE_CONFLICT_MARKERS, so the same conflicted lockfile does not produce duplicate warnings.
  • The BATS regression now asserts the warning text is emitted for normal install recovery.
  • Added a focused --lockfile-only regression that counts conflict markers and verifies it appears exactly once.

Validation after the change:

  • cargo fmt --check
  • cargo build
  • BATS_NUMBER_OF_PARALLEL_JOBS=1 test/bats/bin/bats -j 1 --filter 'merge conflict markers' test/install.bats
  • mise run test:bats test/install.bats (69 tests)
  • cargo clippy --all-targets -- -D warnings

This comment was generated by Codex.

@jdx jdx force-pushed the fix/install-conflicted-lockfile branch from b893ea1 to 75e2d41 Compare June 7, 2026 17:16

jdx commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

Fixed the failing assert render produces no diff check by running mise run render and committing the generated docs/error-codes.data.json entry for WARN_AUBE_LOCKFILE_CONFLICT_MARKERS.

Validation:

  • mise run render now leaves the worktree clean.

This comment was generated by Codex.

@jdx jdx merged commit cee3f38 into main Jun 7, 2026
19 checks passed
@jdx jdx deleted the fix/install-conflicted-lockfile branch June 7, 2026 17:33
@greptile-apps greptile-apps Bot mentioned this pull request Jun 7, 2026
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