-
Notifications
You must be signed in to change notification settings - Fork 166
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
Check deprecated iobundle type #4634
base: master
Are you sure you want to change the base?
Check deprecated iobundle type #4634
Conversation
will be used in the following commits Signed-off-by: Christoph Ostarek <christoph@zededa.com>
49e5d68
to
8cc307e
Compare
@christoph-zededa , although IoUSB is deprecated, is there any use case where IoUSB can still be used? I'm wondering if these changes can break systems using old device models + EVE with IoUsbController? |
I added be643f3 to remove all remaining uses of |
tools/spdx-check.sh
Outdated
@@ -111,6 +111,10 @@ file_to_be_checked() { | |||
return 1 | |||
fi | |||
done | |||
if grep -qi "do not edit" "$file"; |
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.
Which files exactly are you referring to?
Even if a file is generated by a tool, I still think it should contain the header—it's recommended so we know the consequences of using that generating tool. While I agree that we can (and already do) ignore some generated files, we can still add headers to files that come from tools we maintain ourselves.
Could you clarify which specific files you have in mind here?
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.
iotype_string.go
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.
COuld we change it to "Code generated by.*stringer"
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.
done
@@ -0,0 +1,55 @@ | |||
// Code generated by "stringer --type IoType"; DO NOT EDIT. |
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.
Interesting, I didn't know about that tool—I've always handled it manually. While it looks useful, I'm wondering how maintainable it is. If we change an enum, will the tool be run automatically? If not, then we shouldn't really treat the output as entirely auto-generated, and we’d need to maintain it ourselves. If it is run automatically, then we can skip the header.
So, I see two options:
- Automate the tool run so we don't need a header, or
- Treat the file as manually maintained and add the header.
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'm wondering how maintainable it is
it throws a compile error if one makes incompatible changes
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.
And after that, one has to go and fix it manually. So. it's not rerun automatically. So, it's manually maintained file =)
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.
We also have lots of other auto-generated files checked in.
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.
Like under vendors and API? Or something else?
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.
Yes, eve-api
is probably the biggest chunk (another case are all these draw.io diagrams).
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.
Perhaps a small argument for checking in the generated code is that if you use an IDE outside of the build container then some source files are missing and your IDE may become unhappy; also people running go test
on their system directly have to create these files first.
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 didn't see this custom String() function earlier. Doesn't the golang built-in String() for an enum produce the correct output?
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.
Unfortunately not, that's why they created https://pkg.go.dev/golang.org/x/tools/cmd/stringer
ioBundle := &aa.IoBundleList[i] | ||
ioBundle.Error.removeByType(ErrIOBundleDeprecatedType{}) | ||
|
||
if ioBundle.Type == IoUSB { |
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.
Where exactly does this type originate? Could it come from the controller or from persistent storage? If it can be stored and then a user updates EVE to a newer version, might they encounter this error? Or is it only ever set by our internal code, making it impossible for an older or external value to appear?
If it can come from an older source, is there any way we could safely handle unknown types — perhaps trying to guess the correct type and logging a warning—rather than breaking the system that was previously running without issues?
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.
It is derived from an eve-api
type: PhyIoUSB = 2;
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.
Nobody is reading these warnings ;-) - see also #4634 (comment)
Afaik the commercial users got informed about the change.
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.
Afaik the commercial users got informed about the change.
Unfortunately, it does not prevent them from making mistakes and then requesting fixes from the engineering... We know such cases =(
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 must have missed something in the past reviews/discussions and I don't recall us communicating to users that all existing models which published in the controllers (including the eden model files which we can change) need to be changed from IoTypeUsb to IoTypeUsbController.
I thought we introduced IoTypeUsbController as a more clear name, but that existing uses of IoTypeUSb would be interpreted to mean the same thing as IoTypeUsbController. If that is not the case I think we will break existing usage.
Let's set up some time on Monday to talk about this. Perhaps I'm missing something.
Alternatives:
|
I would like @eriknordmark to share his experience in handling such situations. I don't think it's the first time we have to introduce a potentially breaking change. |
@christoph-zededa, in general, how did you come to the idea of this change? Is it related to some issue? |
It is because of two issues I saw this week:
|
these files have been auto-generated and IMHO do not pass the threshold of originality and so do not need a copyright moreover it is a hassle to manually add the copyright every time again Signed-off-by: Christoph Ostarek <christoph@zededa.com>
so far only for IoUSB is checked IoUsb should not be used anymore in favor of IoUsbController and IoUsbDevice Signed-off-by: Christoph Ostarek <christoph@zededa.com>
that is either IoUSBController or IoUSBDevice Signed-off-by: Christoph Ostarek <christoph@zededa.com>
to hopefully fix flaky test in the future Signed-off-by: Christoph Ostarek <christoph@zededa.com>
dedad09
to
4691a87
Compare
also make spdx checker ignore 'do-not-edit' files.