-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add context to better locate runtime coercions #6204
Conversation
Have fun by starting with |
More examples: https://maudoux.be/changes.html |
Well, it has some impact on performance, but that remains under control:
|
Do you want to update TODOs, mark this draft, or save things for future PRs? |
Did you consider using the existing call stack stuff? Relatedly, it would be nice to use the positions of the subterm that is trying to be casted. But I see that was discussed at #6200 I would not be opposed to merging this as-is, and circling back to these issues, but others may disagree. |
I guess this is as good as I can achieve in reasonable time.
Well, first I thought it would not work. Now I am not too sure anymore. It should be feasible, but it requires shifting around several That being said, the current version has the advantage that it requires any user of these functions to provide an explanation string, which ensures that we do not inadvertently omit them.
It is extremely complex in nix, as often there is no good position for values. We do keep some positions for the keys of attribute sets, and sometimes for functions, when feasible. For example
fails with
And nowhere is there any mention of the list itself, nor the value that failed to be a proper int. And that would be difficult. Would you point 💡 One thing we could do is print the fautly values to help users get a ffeling of what happens.
I think it is ready to merge. Better merge early and improve often :-). |
Yeah, I think the cast functions should take the argument, and do the try-catch themselves on behalf of the caller. That still ensures one doesn't forget to provide a reason for the cast! |
Very nice looking! |
Except for painful conflicts... I guess this will have to wait the hackathon tomorrow. |
@Ericson2314 Not sure I will be able to join the hacking session, but if you could find some time to review the changes, that would be much appreciated. I am quite happy with the result, but I lack real tests, and there are so many changes that typos can always slip in. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-26/18252/1 |
This caused traces 'at «none»:0: (source not available)'.
068ead3
to
d33d15a
Compare
@layus Merged, thanks! |
Revert #6204 to fix regression, add nixpkgs/lib/tests as regression test
[Backport 2.13-maintenance] Revert #6204 to fix regression, add nixpkgs/lib/tests as regression test
Unfortunately this PR has caused a regression in 2.13.0. Symptoms include infinite recursions and some sort of regression in the module system.
I haven't managed to find it, so for the time being, I've reverted this change. |
Do we have any test cases for these issues? I think a PR with the "revert of the revert" + some failing tests would be a good starting point, and then hopefully @layus or another person can pick up the baton from there. |
Hi, having a look right now. There are plenty of potential fixes. Finding failing tests would be tremendously useful indeed. Any help welcome. For now I am focusing on reproducing the nixpkgs-lib-tests failures. |
@layus so far I have not seen a behavioral regression, only a change (and improvement in the error message) in the error message output. I added a reproducer to more quickly try out Nix versions: #7621 (comment) |
So first there is indeed a change where I introduced "frame" traces (pardon the naming here). Think of them as more important trace points, like function calls and builtins.derivation calls.
I think 2 is better because we keep the terseness of the output, and it even makes sense, as a message that a human took time to write for debugging purposes deserves to be printed in the end :-). |
Agreed, 2 is likely to be a better match for user expectations. |
Ok, so the fix is here: layus@65c2c94 |
This reverts commit 9b33ef3.
This reverts commit 9b33ef3.
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/tweag-nix-dev-update-43/25185/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-team-report-2022-10-2023-03/27486/1 |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-06-22-nix-team-meeting-minutes-65/29643/1 |
Add tons of helpful error messages in locations with poor error reporting.
This includes mostly type errors. As these are runtime errors, the precise location of the faulty value is usually lost at that time. This translates textually the type expectations (requirements ?) hard-coded in the sources.
TODOs:
Fixes #6200 #6191 #6031