Skip to content

fix(clobber registry): directory and file clobbering#1497

Merged
baszalmstra merged 6 commits intoconda:mainfrom
remimimimimi:fix-clobbering
Jul 14, 2025
Merged

fix(clobber registry): directory and file clobbering#1497
baszalmstra merged 6 commits intoconda:mainfrom
remimimimimi:fix-clobbering

Conversation

@remimimimimi
Copy link
Contributor

Description

Introduce new path conflict resolver that would allow to gracefully resolve path conflicts between file/directory in addition of previously handled file/file conflicts. See tests in package_path_resolver.rs in order to understand how it will resolve different types of conflict.

Current state is draft since we don't do anything on-disk yet.

@baszalmstra
Copy link
Collaborator

This is shaping up very nicely! Awesome work so far! Much clearer!

@remimimimimi remimimimimi force-pushed the fix-clobbering branch 6 times, most recently from bf1c6e3 to 5e95fb5 Compare July 10, 2025 17:18
@remimimimimi
Copy link
Contributor Author

I changed implementation of reprioritize method so now we have performance on par with previous implementation. I'm also much more confident that this function is correct.

image

This one should handle file vs directory conflicts as well as
directory merging correctly most of the time.

There are still several places where I think code can fail. And I
think follow up should be, more rigorous, property-based testing for
`path_trie` crate.

Legends say that 2nd generation was lost somewhere in the sea of
rebases.
@remimimimimi remimimimimi marked this pull request as ready for review July 10, 2025 18:07
Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really like the structure and your approach! I left a few comments.

Comment on lines +524 to +525
assert_yaml_snapshot!(prefix_record_clobber_2.files);
assert_yaml_snapshot!(prefix_record_clobber_2.paths_data);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having multiple snapshots in a single test can be annoying because you run the test, get a snapshot change, update the snapshot and assume the test succeeds now. However, another snapshot might still fail. If possible I prefer to combine snapshots in a single snapshot to avoid this confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See https://insta.rs/docs/cli/#test. I don't think that it would be easy or actually useful to combine snapshots.

If you want to use nextest runner, then you can call cargo insta test --test-runner nextest --review.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont particularly agree that people should just change their workflow, but this is fine for me.

We change names to more intuitive as well as fix some PR comments
along the way.
Copy link
Collaborator

@baszalmstra baszalmstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

Since `new` is called on existing prefix records this means that they
were reprioritized based on the topological sort, so we have to do the
same this during the creation of `ClobberRegistry` in order to have
synced on-memory and on-disk representations.
@baszalmstra baszalmstra merged commit d6e3a76 into conda:main Jul 14, 2025
18 checks passed
This was referenced Jul 14, 2025
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.

3 participants