Repository navigation
Compare worker version components as numbers. - #45
Conversation
| const sufficient = (version, minimum) => { | ||
| const worker = parseVersion(version); | ||
| const min = parseVersion(minimum); | ||
| return worker.major === min.major && ( | ||
| worker.minor > min.minor || worker.minor === min.minor && worker.patch >= min.patch | ||
| ); |
There was a problem hiding this comment.
🔍 Boundary tests bypass worker initialization
The two-digit assertions test a copied comparison, not Bridge.init. A regression in initialization can leave these tests passing; extract the comparison into a shared function or exercise initialization with a configurable minimum.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Verified in r2: the boundary assertions now exercise isVersionSufficient, the same helper called by Bridge.init(), so they no longer duplicate the production comparison. I also combined this change with #43's 4.1.2 minimum and tested the actual initialization message path across 12 versions, including the previously failing 4.1.10 and 4.1.11 cases; all pass.
The components came straight from a regex, so they were compared as text: a patch of '10' sorts below '2'. That's latent while the minimum is 4.0.0, since every component of it is zero, but it rejects a compatible worker as soon as the minimum has a non-zero component to exceed. The comparison moves into `isVersionSufficient` so the boundary cases can be tested against minimums the compiled-in constant doesn't currently hold.
c86d658 to
36ddc2f
Compare
snoack
left a comment
There was a problem hiding this comment.
@snoack made 1 comment and resolved 1 discussion.
Reviewable status: 0 of 8 files reviewed, all discussions resolved (waiting on pkaminski).
| const sufficient = (version, minimum) => { | ||
| const worker = parseVersion(version); | ||
| const min = parseVersion(minimum); | ||
| return worker.major === min.major && ( | ||
| worker.minor > min.minor || worker.minor === min.minor && worker.patch >= min.patch | ||
| ); |
pkaminski
left a comment
There was a problem hiding this comment.
Reviewed r2 together with #43 r23; no new findings. The standalone suite passes all 36 tests, and the combined suite plus auth/worker regression diagnostics passes all 119 tests. Lint passes for both PRs, and each PR's rebuilt distribution files match the committed artifacts.
@pkaminski+CODX reviewed 8 files and all commit messages, and made 2 comments.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on pkaminski).
| const sufficient = (version, minimum) => { | ||
| const worker = parseVersion(version); | ||
| const min = parseVersion(minimum); | ||
| return worker.major === min.major && ( | ||
| worker.minor > min.minor || worker.minor === min.minor && worker.patch >= min.patch | ||
| ); |
There was a problem hiding this comment.
Verified in r2: the boundary assertions now exercise isVersionSufficient, the same helper called by Bridge.init(), so they no longer duplicate the production comparison. I also combined this change with #43's 4.1.2 minimum and tested the actual initialization message path across 12 versions, including the previously failing 4.1.10 and 4.1.11 cases; all pass.
pkaminski
left a comment
There was a problem hiding this comment.
Since you didn't bump the package version in this PR you need to make sure it lands before #43.
@pkaminski reviewed 8 files and all commit messages, and made 1 comment.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on snoack).
The components came straight from a regex, so they were compared as text: a patch
of '10' sorts below '2'. That's latent while the minimum is 4.0.0, since every
component of it is zero, but it rejects a compatible worker as soon as the minimum
has a non-zero component to exceed.
The comparison moves into
isVersionSufficientso the boundary cases can be testedagainst minimums the compiled-in constant doesn't currently hold.
This change is