-
-
Notifications
You must be signed in to change notification settings - Fork 185
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
Set extra=forbid for Pydantic Schema Fields #1865
Conversation
@isuruf didnt we have os version for a reason? |
We allow false for bot inspection: https://github.com/regro/cf-scripts/blob/master/conda_forge_tick/migrators/version.py#L316 It turns off all hints of any kind from the bot. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get why we are excluding configs for these keys. They are allowed by the code in smithy as far as I know.
See eg https://github.com/conda-forge/conda-smithy/blob/main/conda_smithy/configure_feedstock.py#L818
We cannot deprecate and remove them without first changing smithy to deprecate them, doing an admin migration over the feedstocks, and then finally remove them.
Those removal cycles are expensive.
|
Why is it needed to support new platforms without changing conda-smithy? My point is:
|
I see - three thoughts about this:
Affected Feedstocks
Path ForwardI see two possible paths forward here:
I will also open an issue in cf-scripts regarding the bug. It will appear below this comment. What do you think? @beckermr |
The main idea behind excluding by default is to prevent typos from leaking in silently; e.g. tiny mistakes like |
Option (2) sounds the cheapest in terms of effort and it's not too inelegant imo! |
Also, are we always validating? We could just leave the linter on for validations, but let smithy operate on the raw, unvalidated conda-forge.yml if updating the schema for new keys gets too annoying (I don't think we are adding new keys that often, fwiw, but no strong feelings). |
We should make the model match what the code accepts. The code is the source of truth. |
We're already working on (1), see regro/cf-scripts#2272 |
As simple as these changes sound, it would be better to have each of them in a separate PR, as each of them will be a separate discussion. For the bot inspection, as there is already work over at regro/cf-scripts#2272, we could also continue the discussion there. I'm happy with that, so I won't comment there immediately.
I would very much like that. There is a lot of value in the lints (and them being more strict). At least from all the errors, I had in the past, it would have saved me a lot of time.
@isuruf Can we even support new platforms without touching conda-smithy at all? Probably yes, as it would generate the matching Personally, I see great value in validating the schema and thus being a bit stricter than the code itself. When I'm building new extensions/platforms, I would be OK with getting some warnings as I would already be in uncharted territories. |
Yes, we can support new platforms without touching conda-smithy. I would be happy with just a warning. |
I recently fixed a small bug in conda-build to support new platforms without explicitly adding the new platforms. Works just fine afterwards. |
I readded the option that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are unresolved issues about extra=forbid that need to be resolved before we can merge if I understand the thread correctly.
@isuruf Are you ok keeping the extra forbid settings here now that smithy has switched to warning on validation errors? I couldn't tell from the discussion above. |
No, the linter is still failing. We have to move these specific errors to warnings. |
(please disregard a previous comment that was here) |
To make automerging go through. |
Okay, so my problem currently is: We could add some special case handling to here conda-smithy/conda_smithy/validate_schema.py Lines 50 to 56 in 56750bb
catching errors related to those 3 extra fields (that's possible by checking This would be pretty bad API design if you ask me. Providing a schema but requiring the user to ignore schema validation errors in some weird edge cases. All I still did not understand your use case @isuruf that needs the autotickbot to auto-merge when playing around with new platforms that are not yet added to conda-smithy - but I also don't have any experience with adding new platforms to conda-forge. Isn't it enough that you can run commands like There should be a schema, as strict as reasonably possible, that every feedstock in conda-forge conforms to. This would have prevented a lot of headaches I ran into while working on the autotickbot. |
I mostly agree with @ytausch. The point of the extra=forbid bits is to prevent accidental typos from happening, and imo that's an important point of failure (we fixed a few feedstocks that had been carrying some of those for years). I don't think we are adding new platforms so often (the two last ones have been osx-arm64 and win-arm64 and I don't think we are expecting any new ones) to make this UX issue acceptable. I do get that there's a bootstrapping issue when adding new platforms and this would remove one step from the "add new platform" checklist.
Could we configure automerge to ignore (certain) linter errors instead? (certain) being either specific type of error (extra keys) or a specific type of PR (opened by conda-forge bots == automated). |
Automerge relies on the GitHub status / checks apis. Getting it to ignore a subset of linter errors is not at all obviously easy to do and sounds like a pain TBH. |
I don't understand why people always want to support only their use-case and break other use-cases when there are compromises that can support both (given minor inconveniences to both). |
All of this sounds to me like failing the linter on new platforms (as it's currently implemented in this PR) is simply the option with the best tradeoff between extensibility, schema consistency, and implementation complexity. The amount of work required to add a new platform to here should be manageable, isn't it? |
Which compromise are you proposing? |
Adding special casing in #1865 (comment) and use |
Some parts of this solution sound reasonable, yes. And implementing it is probably not the end of the world for cf-scripts if we give your use case high priority. Here are my 2 reasons why I still prefer not doing it this way (I hope I don't repeat myself, my personal weight estimate in parenthesis):
In my eyes, avoiding a single simple PR for maybe one additional platform per year does not outweigh these drawbacks. However, we need to come to a solution. |
In light of #1893 please update your answer. If you have a use-case other than the bot, please say so. Otherwise please don't break my workflows. I certainly don't understand your insistence on make your use-case higher priority over other peoples' workflows. |
I don't see how #1893 changes the situation. The bot uses the entirety of conda-forge.yml, not only the bot section. My example above could have also been with
The other use case I have in mind is:
I am sorry if I gave you a reason for not commenting further. Maybe other maintainers can help us resolving this argument? |
Thanks for this comment @ytausch. Indeed we are at a bit of an impasse. I do not think other maintainers are going to help resolve this beyond suggesting additional technical approaches. We generally work by consensus and we have not reached it here. |
What about having two possible schemas? Something like:
Then folks can pick which one to use for each purpose. The linter would still use the flexible schema so it wouldn't error out on new platforms, but the bot could use the strict one if that really helps with something. Would that help achieve some consensus? |
I'd prefer the autotick bot to use the less-strict schema as well too. The conda-forge ecosystem is very fluid and the bot reporting strict validation errors is likely more noise than signal. |
So how about this option then: We reject this PR and leave the schema as-is, but introduce custom hint code that detects unknown platforms? I still don't really like this but I think we are able to find a consensus about it. |
I am ok with that. @isuruf? |
Sure. I'm okay with that. I'm also okay with your suggestion #1865 (comment). |
Superseded by #1900. |
The Pydantic model currently allows additional fields for BuildPlatform, OSVersion, ProviderType, which does not make a lot of sense and can hide errors IMO.
(This PR previously contained changed related to
bot.inspection
which were addressed separately.)