Skip to content

Conversation

@kurtjd
Copy link
Contributor

@kurtjd kurtjd commented Dec 23, 2025

Removed panic paths from the buffer module. Instead made methods fallible and introduced an Error type.

Because certain traits are used with methods that assume infallibility (such as the drop and borrow traits), I couldn't just make these return a result. Instead, I added a Poisoned status so in the off chance that a drop or borrow call would have panicked originally, the buffer is marked poisoned and will return a Poisoned error on future accesses.

This also breaks the interfaces of a few services. For these I added a Buffer error and made methods fallible if necessary. I'm not a fan of this since any buffer errors represent an internal programming bug to the service and not something the user should expect/handle, and this breaks encapsulation. I do not want to silently just ignore buffer errors, so I'm not sure what other alternative there is here (open to suggestions).

Edit: Thinking about maybe renaming the Buffer error variant of these services to Internal or something. I'd prefer to make it more clear when an error represents an internal invariant being broken that is not something meant to be handled by the caller in any practical manner. It would act as a catchall since the specifics of what caused the error are implementation details that could change any time and not something the caller should be concerned with.

Also introduced a Never type alias which is useful now that some functions represent never-ending tasks which should never return unless there is an error (see related discussion: #634 (comment)).

Resolves #659

@kurtjd kurtjd self-assigned this Dec 23, 2025
@kurtjd kurtjd requested a review from a team as a code owner December 23, 2025 00:21
@kurtjd kurtjd added the BREAKING CHANGE Marks breaking changes label Dec 23, 2025
@kurtjd kurtjd requested review from a team as code owners December 23, 2025 00:21
@kurtjd kurtjd moved this to In review in Embedded Controller Dec 23, 2025
@kurtjd kurtjd force-pushed the audit-buffer branch 6 times, most recently from d36bf7b to 60a4319 Compare December 23, 2025 01:03
madeleyneVaca
madeleyneVaca previously approved these changes Dec 23, 2025
jerrysxie
jerrysxie previously approved these changes Dec 23, 2025
@jerrysxie
Copy link
Contributor

@kurtjd Don't forget to announce on Zulip once it is ready to be merged, thanks!

@kurtjd kurtjd requested a review from madeleyneVaca December 23, 2025 22:06
@jerrysxie
Copy link
Contributor

Bypassed policy and merge since people are on vacation.

@jerrysxie jerrysxie merged commit b195d23 into OpenDevicePartnership:main Dec 24, 2025
14 checks passed
@github-project-automation github-project-automation bot moved this from In review to Done in Embedded Controller Dec 24, 2025
@kurtjd
Copy link
Contributor Author

kurtjd commented Dec 24, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKING CHANGE Marks breaking changes

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Audit buffer

4 participants