Skip to content

CL33-09: Make seq num range resilient to mixed up beginning and end.#404

Closed
winder wants to merge 2 commits into
mainfrom
will/cl33-09
Closed

CL33-09: Make seq num range resilient to mixed up beginning and end.#404
winder wants to merge 2 commits into
mainfrom
will/cl33-09

Conversation

@winder
Copy link
Copy Markdown
Contributor

@winder winder commented Dec 20, 2024

Avoid overflow when End < Start by swapping values to be in the correct order.

@winder winder requested a review from dimkouv December 20, 2024 20:10
@winder winder marked this pull request as ready for review January 7, 2025 14:34
@winder winder requested a review from a team as a code owner January 7, 2025 14:34
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 7, 2025

Metric will/cl33-09 main
Coverage 76.5% 76.4%

}

func NewSeqNumRange(start, end SeqNum) SeqNumRange {
if end < start {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should we even allow this to begin with?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I went back and forth about this question. This could generate an error but would require updating >150 spots where we use it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are they all tests?

}

func (s SeqNumRange) Length() int {
if s.End() < s.Start() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This check is probably not needed considering you've already covered that on the constructor level

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Also, it's misleading to shuffle with the state in the read method. If you need a defensive check then probably calling absolute value on the computed length should work, no?

}

func NewSeqNumRange(start, end SeqNum) SeqNumRange {
if end < start {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, I'm not sure about that. Shouldn't we error when someone mixes start with the end? We could hide some underlying bug when "healing" that state during runtime

@makramkd
Copy link
Copy Markdown
Collaborator

This still relevant @winder ?

0xAustinWang pushed a commit that referenced this pull request Apr 28, 2025
…o-tel-collector-deployment-without-operator

feat(beholder): migrate helm chart from operator to helm chart
@winder winder closed this Sep 29, 2025
@RensR RensR deleted the will/cl33-09 branch November 27, 2025 14:23
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.

4 participants