Check required-version before parsing rules#22410
Check required-version before parsing rules#22410MichaReiser merged 10 commits intoastral-sh:mainfrom
Conversation
|
Nice |
|
|
Hmm, the ecosystem changes are a bit surprising. Can you try rebasing on main? |
|
Hm do those changes mean it found more autofixes? That would be weird. I'll apply your suggested change and merge in with latest main. |
MichaReiser
left a comment
There was a problem hiding this comment.
Thanks. This is great and nice find with DeTable.
I only have a question whether we need the required_version fallback and if we retain the spans in error messages if the required version fails to parse.
| let required_version = RequiredVersion::try_from(required_version.to_string()) | ||
| .with_context(|| format!("Failed to parse {}", path.display()))?; |
There was a problem hiding this comment.
I suspect that we lose the span in the error message compared to when deserializing the value as part of the serde deserialization. I'm inclined to return Ok here and defer to the "full" deserialization in that case.
There was a problem hiding this comment.
I'll add a test for this case too.
There was a problem hiding this comment.
You were right, changed it as you suggested.
|
Thanks for the review and merge @MichaReiser! |
Summary
Fixes #19922.
The approach I used is to check the required-version separately before parsing the TOML. This feels a bit ugly because we have to parse the TOML separately, but other approaches I considered seemed worse:
Test Plan
New test cases added.