Skip to content

Compare worker version components as numbers. - #45

Merged
snoack merged 1 commit into
masterfrom
fix-worker-version-parsing
Sep 30, 2026
Merged

snoack merged 1 commit into
masterfrom
fix-worker-version-parsing

Conversation

@snoack

@snoack snoack commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

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.


This change is Reviewable

@snoack
snoack requested a review from pkaminski September 30, 2026 02:25

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment thread src/Bridge.test.js Outdated
Comment on lines +24 to +29
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
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔍 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.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

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.

Done.

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.

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.
@snoack
snoack force-pushed the fix-worker-version-parsing branch from c86d658 to 36ddc2f Compare September 30, 2026 03:09

@snoack snoack left a comment

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.

@snoack made 1 comment and resolved 1 discussion.
Reviewable status: 0 of 8 files reviewed, all discussions resolved (waiting on pkaminski).

Comment thread src/Bridge.test.js Outdated
Comment on lines +24 to +29
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
);

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.

Done.

@pkaminski pkaminski left a comment

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.

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: :shipit: complete! all files reviewed, all discussions resolved (waiting on pkaminski).

Comment thread src/Bridge.test.js Outdated
Comment on lines +24 to +29
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
);

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.

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 pkaminski left a comment

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.

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: :shipit: complete! all files reviewed, all discussions resolved (waiting on snoack).

@snoack
snoack merged commit a41216d into master Sep 30, 2026
6 checks passed
@snoack
snoack deleted the fix-worker-version-parsing branch September 30, 2026 04:31
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.

2 participants