Skip to content

feat(rattler): make clobber behavior configurable (#1027)#2082

Merged
baszalmstra merged 3 commits intoconda:mainfrom
devvaansh:feat/configurable-clobber-behavior
Feb 22, 2026
Merged

feat(rattler): make clobber behavior configurable (#1027)#2082
baszalmstra merged 3 commits intoconda:mainfrom
devvaansh:feat/configurable-clobber-behavior

Conversation

@devvaansh
Copy link
Copy Markdown
Contributor

@devvaansh devvaansh commented Feb 20, 2026

Description

This PR introduces a configurable behavior for handling file collisions (clobbering) during package installation. Previously, rattler would always rename "losing" files to a clobbers/ directory. While safe, this can hide potential packaging bugs or environment inconsistencies.

We now provide a ClobberMode enum to give callers control:
ClobberMode::Rename (default): Maintains existing behavior where colliding files are moved to the clobbers/ directory.
ClobberMode::Error: Intercepts clobbered paths during the post_process step and returns a ClobberingDetected error, failing the installation.

Fixes #1027

How Has This Been Tested?

I have added two new asynchronous tests in crates/rattler/src/install/clobber_registry.rs:
test_clobber_mode_error: Verifies that when ClobberMode::Error is set and a transaction contains overlapping files, post_process returns PostProcessingError::ClobberingDetected.
test_clobber_mode_rename_is_default: Verifies that without explicit configuration, the driver still defaults to the renaming behavior and successfully creates the clobbers/ directory structure.

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.

Tools:Claude

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added sufficient tests to cover my changes.

Add a ClobberMode enum that controls what happens when multiple packages
install the same file path:

- ClobberMode::Rename (default): existing behavior, losers are renamed
  to __clobbers__/ directory
- ClobberMode::Error: raises an error if any clobbering is detected
  during post-processing

This is exposed through InstallDriverBuilder::clobber_mode() and
integrates into the post_process() step. When Error mode is active
and clobbered paths exist, a ClobberingDetected error is returned.

Closes conda#1027
@baszalmstra
Copy link
Copy Markdown
Collaborator

Please fill in the template correctly. You said you used an AI, which?

@devvaansh
Copy link
Copy Markdown
Contributor Author

devvaansh commented Feb 20, 2026

Please fill in the template correctly. You said you used an AI, which?

just mentioned in the description

@baszalmstra baszalmstra merged commit 2bd0f53 into conda:main Feb 22, 2026
18 checks passed
@github-actions github-actions Bot mentioned this pull request Feb 22, 2026
@devvaansh devvaansh deleted the feat/configurable-clobber-behavior branch February 22, 2026 11:28
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.

Make behavior configurable when installing a package overwrites a file (allow raising an error)

2 participants