Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InstallableFlake::getCursors(): Force re-evaluation in case of cached failure #10513

Closed
wants to merge 1 commit into from

Conversation

edolstra
Copy link
Member

Motivation

This fixes the "cached failure of attribute ..." message in case the flake output fails at top-level (i.e. in getCursors()).

Issue #3872.

Test case borrowed from #10368.

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions bot added the with-tests Issues related to testing. PRs with tests have some priority label Apr 15, 2024
Copy link
Member

@Ma27 Ma27 left a comment

Choose a reason for hiding this comment

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

Can you explain why this was re-implemented here when 3dfb4bf already exists?

As I mentioned before, that part of #10368. So far I didn't get an answer.

Again, to me it seems as if forceErrors was added just where it was needed. This PR doesn't address that. This risks that in another case the , true is forgotten again in the future (and if we have especially bad luck that won't even be caught by this testcase).

Finally, I'd highly appreciate it if you could cc people if you develop alternative patches for discussion.

@edolstra
Copy link
Member Author

@Ma27 To be honest I don't understand the motivation of 3dfb4bf. If cached failures don't cause re-evaluation, that's a bug that we should fix (like this PR does). We shouldn't force the user to work around it with some ad hoc CLI flag (and we already have --no-eval-cache in any case).

@Ma27
Copy link
Member

Ma27 commented Apr 19, 2024

As described in the commit message (3dfb4bf) and my comment right above yours (#10513 (review)), there's an argument forceErrors = false in AttrCursor::maybeGetAttr which is added in a very ad-hoc way to a few methods where it was needed.

As soon as e.g. AttrCursor::maybeGetAttr(std::string_view) or AttrCursor::getAttr(std::string_view) are used, you'll have the same issue again because these set forceErrors to false. That's why I wanted to make sure there's a single way to either force errors or not. The idea is to let commands like nix search set the global setting evalSettings.forceErrorsInEvalCache to false so that errors aren't forced when searching. For now, I'd set the setting to true by default, but what I'd like to see is that the eval cache actually caches errors so that you don't have to re-run (potentially expensive) evaluations just to get a full error message (or a trace).

and we already have --no-eval-cache in any case

This is not the same though: I want caching, but (for now - as described above) not for errors. With that reasoning you wouldn't need any fix for this bug because all you have to do is to bypass the eval cache.

We shouldn't force the user to work around

The default is true, so by default the user doesn't have to set anything.
And as soon as we can set it to false because - as described above - error messages are cached this may still be useful for debugging purposes. Or it can be removed then. I think I'm fine with both.

If cached failures don't cause re-evaluation, that's a bug that we should fix (like this PR does)

If that's the case then why does this code-path exist in the first place?!

@edolstra
Copy link
Member Author

Closing in preference for #10564.

@edolstra edolstra closed this Apr 22, 2024
@edolstra edolstra deleted the fix-cached-failure branch April 22, 2024 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants