Skip to content

addresses OptionalString FIXME - #349

Open
mikebrow wants to merge 1 commit into
containerd:mainfrom
mikebrow:address-OptionalString--fixme
Open

mikebrow wants to merge 1 commit into
containerd:mainfrom
mikebrow:address-OptionalString--fixme

Conversation

@mikebrow

@mikebrow mikebrow commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

addresses the OptionalString FIXME

File Change
pkg/api/optional.go New typed New* constructors, *Ptr from-pointer constructors, Copy() methods
pkg/api/deprecated_optional.go (new) Old any-typed functions kept as deprecated wrappers
pkg/api/adjustment.go Internal calls → NewInt64, NewUInt64, NewBool, NewString, NewRepeatedString, IntPtr
pkg/api/update.go Same
pkg/api/device.go FileModePtr, UInt32Ptr for OCI spec pointer fields
pkg/api/hooks.go IntPtr for OCI spec *int field
pkg/api/resources.go Int64Ptr/UInt64Ptr/BoolPtr for OCI spec pointers; .Copy() for copy paths
pkg/api/optional_test.go Tests updated to exercise NewRepeatedString, RepeatedStringPtr, Copy()
pkg/adaptation/api.go Deprecated String/Int64/… aliases replaced with NewString/StringPtr/NewInt64/Int64Ptr/…
pkg/adaptation/result.go api.NewInt64, api.NewUInt64, api.NewBool, api.NewString, api.NewRepeatedString
pkg/adaptation/adaptation_suite_test.go Same
pkg/runtime-tools/generate/generate_suite_test.go Same
plugins/device-injector/device-injector.go api.NewFileMode(os.FileMode(...)), api.NewUInt32
plugins/rdt/main_test.go api.NewString, api.NewRepeatedString, api.NewBool

@mikebrow

Copy link
Copy Markdown
Member Author

@klihub @thaJeztah GitHub suggested you :-) Thoughts on this one?

Signed-off-by: Mike Brown <brownwm@us.ibm.com>
@mikebrow
mikebrow force-pushed the address-OptionalString--fixme branch from f8f62c2 to 9edc19f Compare October 29, 2026 21:31
@mikebrow
mikebrow marked this pull request as ready for review October 29, 2026 21:36
@mikebrow mikebrow changed the title addresses OpitionalString FIXME addresses OptionalString FIXME Oct 31, 2026
Quota: api.NewInt64(222),
Period: api.NewUInt64(333),
RealtimeRuntime: api.NewInt64(444),
RealtimePeriod: api.NewUInt64(555),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is all a lot of boiler plating (both the old, and new situation); did a quick ask to my LLM;

Could we use protobuf's native optional scalar fields instead of custom wrapper types? Those would generate regular Go pointers, allowing us to use new(uint64, 111) (Go 1.26+) instead of api.NewUInt64(111), and potentially eliminate quite a bit of boilerplate. This would require a protobuf API change, though, so perhaps something to consider separately.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good feedback.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I didn't look what would be involved to change it, but it was mostly my initial impression of "lots of boilerplating here!", but if it's possible somehow, could be worth investigating.

@klihub
klihub requested a review from samuelkarp November 18, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants