Skip to content

Comments

Improve resolver error messages for single-project workspaces#6095

Merged
zanieb merged 2 commits intomainfrom
zb/resolver-errors-projects
Aug 15, 2024
Merged

Improve resolver error messages for single-project workspaces#6095
zanieb merged 2 commits intomainfrom
zb/resolver-errors-projects

Conversation

@zanieb
Copy link
Member

@zanieb zanieb commented Aug 14, 2024

Extends #6092 to improve resolver error messages for workspaces that have a single member.

As before, this requires a two-step approach of

  1. Traversing the derivation tree and collapsing some members. In this case, we drop the empty root node in favor of the project.
  2. Using special-case formatting for packages. In this case, the workspace package is referred to with "your project" instead of its name.

@zanieb zanieb added the error messages Messaging when something goes wrong label Aug 14, 2024
@zanieb zanieb force-pushed the zb/resolver-errors-projects branch from faa52cc to 6bb296a Compare August 14, 2024 22:50
@zanieb zanieb marked this pull request as ready for review August 14, 2024 22:50
@zanieb zanieb requested a review from charliermarsh August 14, 2024 22:50
@zanieb zanieb added the preview Experimental behavior label Aug 14, 2024
/// workspaces, avoiding a level of indirection like "And because your project
/// requires your project, we can conclude that your projects's requirements are
/// unsatisfiable."
fn drop_root_dependency_on_project(
Copy link
Member Author

Choose a reason for hiding this comment

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

I initially thought I'd need to convert the dependency nodes from project -> other to root -> other but it seems like I can get away with not doing that! It depends on some behavior from #6092, otherwise we wouldn't display a proper conclusion but the message I added there about an unsatisfiable project suffices as a conclusion.

) {
match tree {
DerivationTree::External(_) => {}
DerivationTree::Derived(derived) => {
Copy link
Member

Choose a reason for hiding this comment

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

I'm glad this pattern is working for us.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I'd previously had a hard time grokking PubGrub's collapse_no_versions so I thought this would be harder but it wasn't too bad and I think it could be a very powerful approach in the future.

@zanieb zanieb force-pushed the zb/resolver-errors-workspaces branch 2 times, most recently from c32128c to b03445b Compare August 15, 2024 00:37
Base automatically changed from zb/resolver-errors-workspaces to main August 15, 2024 02:41
@zanieb zanieb force-pushed the zb/resolver-errors-projects branch from 6bb296a to 4d032bc Compare August 15, 2024 03:02
@zanieb zanieb enabled auto-merge (squash) August 15, 2024 03:03
@zanieb zanieb merged commit 76e3248 into main Aug 15, 2024
@zanieb zanieb deleted the zb/resolver-errors-projects branch August 15, 2024 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants