Repository navigation
ci: fail a Dart release that leaves a dependent on pub.dev behind - #3977
andrewkolos wants to merge 2 commits into
Conversation
On a pull request that changes a2ui_core's version, check every other package under dart/ that constrains a2ui_core and is on pub.dev. The check fails unless the pull request releases that package too, or the latest version on pub.dev already accepts the new a2ui_core.⚠️ Agent-generated
There was a problem hiding this comment.
Code Review
This pull request introduces a new Python script, check_dart_dependents.py, along with its test suite, to ensure that Dart package releases do not leave dependent packages on pub.dev incompatible. The feedback highlights a critical bug in the version constraint resolution logic: caret constraints on 0.0.x versions (where both major and minor are 0) are incorrectly treated like 0.y.z versions. In Dart's pub package manager, ^0.0.x should only allow that exact patch version. Suggestions are provided to correct this logic in the script and update the corresponding test assertions to reflect the proper behavior.
| if start.major > 0: | ||
| end = Version(start.major + 1, 0, 0) | ||
| else: | ||
| end = Version(0, start.minor + 1, 0) |
There was a problem hiding this comment.
In Dart's pub package manager, caret constraints on 0.0.x versions (where both major and minor are 0) behave differently than other 0.y.z versions. Specifically, ^0.0.x is equivalent to >=0.0.x <0.0.(x+1), meaning it only allows that exact patch version (and its prereleases), rather than stopping at the next minor version 0.1.0.
Currently, the implementation treats ^0.0.x the same as ^0.y.z and sets the upper bound to 0.1.0, which incorrectly allows incompatible patch versions (e.g., treating ^0.0.3 as allowing 0.0.4). Updating this to correctly increment the patch version when both major and minor are 0 ensures alignment with Dart's version resolution rules.
| if start.major > 0: | |
| end = Version(start.major + 1, 0, 0) | |
| else: | |
| end = Version(0, start.minor + 1, 0) | |
| if start.major > 0: | |
| end = Version(start.major + 1, 0, 0) | |
| elif start.minor > 0: | |
| end = Version(0, start.minor + 1, 0) | |
| else: | |
| end = Version(0, 0, start.patch + 1) |
| def test_caret_on_zero_minor_also_stops_at_next_minor(self): | ||
| self.assertTrue(cdd.allows("^0.0.3", V("0.0.4"))) | ||
| self.assertTrue(cdd.allows("^0.0.1-wip002", V("0.0.2"))) | ||
| self.assertFalse(cdd.allows("^0.0.3", V("0.1.0-0"))) | ||
| self.assertFalse(cdd.allows("^0.0.3", V("0.1.0"))) |
There was a problem hiding this comment.
Update the test assertions to reflect the correct Dart pub caret constraint behavior for 0.0.x versions. Since ^0.0.3 is equivalent to >=0.0.3 <0.0.4, it should not allow 0.0.4. Similarly, ^0.0.1-wip002 should not allow 0.0.2.
| def test_caret_on_zero_minor_also_stops_at_next_minor(self): | |
| self.assertTrue(cdd.allows("^0.0.3", V("0.0.4"))) | |
| self.assertTrue(cdd.allows("^0.0.1-wip002", V("0.0.2"))) | |
| self.assertFalse(cdd.allows("^0.0.3", V("0.1.0-0"))) | |
| self.assertFalse(cdd.allows("^0.0.3", V("0.1.0"))) | |
| def test_caret_on_zero_major_and_minor_stops_at_next_patch(self): | |
| self.assertFalse(cdd.allows("^0.0.3", V("0.0.4"))) | |
| self.assertFalse(cdd.allows("^0.0.1-wip002", V("0.0.2"))) | |
| self.assertTrue(cdd.allows("^0.0.3", V("0.0.3"))) |
⚠️ Agent-generated
CI resolves the Dart packages from source through the pub workspace, so it passes while the versions on pub.dev cannot be used together (#3942). This adds a check to pull requests that change
a2ui_core's version.For every other package under
dart/that constrainsa2ui_coreand is on pub.dev, the check fails unless the pull request releases that package too, or the latest version on pub.dev already accepts the newa2ui_core. The pull request releases a package when it changes the package'sversion:or the top heading of its CHANGELOG.md, leaves the two equal, and the version would become the latest on pub.dev. Packages that are not on pub.dev, such asa2ui_cli, are skipped. The failure message points at the release steps that #3973 adds.Replayed on the last two
a2ui_corereleases, #3192 and #3695, it fails both, naminga2ui_agent. On #3695:Part of #3945. The scheduled check that installs the published packages together comes after the next Dart release, since it fails until then.
Pre-launch Checklist
One time:
For this PR:
I have updated the relevant CHANGELOG.md file.I updated/added relevant documentation.If my branch is on a fork, I have verified that scripts/e2e_test.sh passes.ℹ️ Initial text drafted by agent