-
Notifications
You must be signed in to change notification settings - Fork 249
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
Semver lastedge error #1169
Semver lastedge error #1169
Conversation
Skipping CI for Draft Pull Request. |
9073a6b
to
fb80948
Compare
fb80948
to
f2ab9f5
Compare
71e49b4
to
4641f09
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1169 +/- ##
==========================================
- Coverage 53.97% 53.95% -0.03%
==========================================
Files 108 108
Lines 11220 11212 -8
==========================================
- Hits 6056 6049 -7
Misses 4182 4182
+ Partials 982 981 -1 ☔ View full report in Codecov by Sentry. |
…lear the skips list and crosses Y thresholds counter to design intent missing proper last-max-z detection for replaces working at long last
4641f09
to
769a88f
Compare
…ways skip directly to channel head Signed-off-by: Jordan Keister <[email protected]>
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.
From a code standpoint, this look ok to me but I am pretty unfamiliar with this section of the code. In order to give what I feel would be a proper review I might need a more synchronous walkthrough of the changes.
Happy to schedule something or grab an impromptu huddle. The short version of what happened is
so I just added a quick "did it happen" check for those edges. |
for yProbe < entryCount { | ||
curVersion := bundleVersions[(*entries)[curEdge].Name] | ||
yProbeVersion := bundleVersions[(*entries)[yProbe].Name] | ||
if getMinorVersion(yProbeVersion).EQ(getMinorVersion(curVersion)) { | ||
yProbe += 1 | ||
} else { | ||
break | ||
} | ||
} | ||
// if yProbe crossed a threshold, the previous entry is the last of the previous Y-stream | ||
preChangeIndex := yProbe - 1 | ||
|
||
if curEdge != yProbe { | ||
if zmaxQueue != "" { | ||
// add skips edge to allow skipping over y iterations within an x stream | ||
(*entries)[preChangeIndex].Skips = append((*entries)[preChangeIndex].Skips, zmaxQueue) | ||
(*entries)[preChangeIndex].Replaces = zmaxQueue | ||
} | ||
zmaxQueue = (*entries)[preChangeIndex].Name | ||
} | ||
for curEdge < preChangeIndex { | ||
// add skips edges to y-1 from z < y | ||
(*entries)[preChangeIndex].Skips = append((*entries)[preChangeIndex].Skips, (*entries)[curEdge].Name) | ||
curEdge += 1 | ||
} | ||
curEdge += 1 | ||
yProbe = curEdge + 1 | ||
} |
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.
So after spending more time dissecting this for loop to really understand what each step is doing (took ~30min) I think it is good to go logically. Maybe it's just me coming back from being sick and still being a bit foggy (still recovering) but I felt that it was a bit difficult to understand this change in what I felt was a reasonable time frame (~20 min) as a reviewer, which led me to feeling rather unconfident in my review and thus withholding an "approval".
Feel free to take this recommendation or leave it as it, but I think a slight refactor for readability could be useful here. Maybe something along the lines of:
for yProbe < entryCount { | |
curVersion := bundleVersions[(*entries)[curEdge].Name] | |
yProbeVersion := bundleVersions[(*entries)[yProbe].Name] | |
if getMinorVersion(yProbeVersion).EQ(getMinorVersion(curVersion)) { | |
yProbe += 1 | |
} else { | |
break | |
} | |
} | |
// if yProbe crossed a threshold, the previous entry is the last of the previous Y-stream | |
preChangeIndex := yProbe - 1 | |
if curEdge != yProbe { | |
if zmaxQueue != "" { | |
// add skips edge to allow skipping over y iterations within an x stream | |
(*entries)[preChangeIndex].Skips = append((*entries)[preChangeIndex].Skips, zmaxQueue) | |
(*entries)[preChangeIndex].Replaces = zmaxQueue | |
} | |
zmaxQueue = (*entries)[preChangeIndex].Name | |
} | |
for curEdge < preChangeIndex { | |
// add skips edges to y-1 from z < y | |
(*entries)[preChangeIndex].Skips = append((*entries)[preChangeIndex].Skips, (*entries)[curEdge].Name) | |
curEdge += 1 | |
} | |
curEdge += 1 | |
yProbe = curEdge + 1 | |
} | |
yStreamHead := getYStreamHead(curEntry, *entries) // This function would perform the same logic as already exists in the yProbe for loop | |
if curEdge != yStreamHead { | |
if zmaxQueue != "" { | |
// add skips edge to allow skipping over y iterations within an x stream | |
(*entries)[yStreamHead].Skips = append((*entries)[yStreamHead].Skips, zmaxQueue) | |
(*entries)[yStreamHead].Replaces = zmaxQueue | |
} | |
zmaxQueue = (*entries)[yStreamHead].Name | |
} | |
// could also be made into a separate function if desired | |
for _, edge := range (*entries)[curEdge:yStreamHead] { | |
// add skips edges to y-1 from z < y | |
(*entries)[yStreamHead].Skips = append((*entries)[yStreamHead].Skips, edge.Name) | |
} | |
curEdge = yStreamHead + 1 | |
} |
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.
Overall, what threw me for a loop (pun intended) the most was wrapping my head around the multiple curEdge increments (and why) as we progressed through the loop and the initially unclear discovery of the y stream head (although looking back at it it totally makes sense as is, so feel free to keep the loop instead of breaking out to another function if you want - I just ate lunch so my mind is feeling a bit more clear now 😆 ).
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.
Have the one nit, but I don't think my concerns of readability should block this PR since functionally it is 👍 .
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: everettraven, grokspawn The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
2096c4f
into
operator-framework:master
During an onboarding session, we discovered that an author was missing an expected replaces between their last bundle version and its semver-ordered predecessor.
On investigation, it was because the channel linking step always seeks forward for a y-version change and runs off the end of the version list, and thus fails to detect the change.
When investigating, it became clear that the method was over-engineered as well, so this PR substantially simplifies the implementation.