Repository navigation
Strip distro .devN markers from the Colab pins - #11326
Conversation
My own regression, from the oracle refresh in #11324. I dispatched the smoke matrix on main to confirm the torchcodec fix and all eight legs failed earlier than before, in 'Install Colab-shaped venv': ERROR: No matching distribution found for mako==1.3.2.dev0 The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had 1.3.2.dev0. The freeze is a snapshot of an image, so it records versions as the image labels them; the seed already strips a local version (+cu128) for exactly this reason and had nothing for .devN. One unresolvable pin fails the bulk resolve for all 690 of them. Strip the marker to the base version rather than skipping the package: the image really does carry Mako, and skipping would quietly shrink the venv this job exists to reproduce. Two tests, both replaying the seed's own transformation: no seeded pin may carry a .dev or + marker PyPI cannot resolve, and a package whose marker was stripped must still be pinned rather than dropped. Removing the strip fails both, the first naming mako==1.3.2.dev0 exactly as CI did. tests/notebooks: 324 passed, 2 skipped. Not verified here: this box cannot run the smoke matrix. The failure and the version list PyPI offered both come from the dispatched run on main (35432057179), and the fix is checked against the committed snapshot rather than against a resolve.
|
@codex review |
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 08bb56740f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Strip to the base version rather than skipping the package: the image | ||
| # really does carry it, and skipping would quietly shrink the venv this | ||
| # job exists to reproduce. | ||
| ver = re.sub(r"\.dev\d+$", "", ver) |
There was a problem hiding this comment.
Limit
.devN stripping to known distro rewrites
When a refreshed Colab snapshot contains a genuine published development release, this unconditional rewrite changes (for example) pkg==2.0.dev3 into the distinct final release pkg==2.0, which may not exist and no longer reproduces the captured environment. The repository already recognizes .devN as a real PEP 440 prerelease in scripts/notebook_validator.py (_split_prerelease, lines 431–446), so the Mako distro anomaly should be handled through an explicit package/version rewrite rather than applied to every future pin.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Agreed, and the counterexample is the right one: .devN is a genuine PEP 440 prerelease, so rewriting by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a different release that may not exist and is not what the image had. Mako is a distro anomaly, not a rule.
Fixed in 9d36618. It now goes through an explicit distro_dev_version entry in colab_to_cpu_pin.json, keyed on the exact (package, recorded version) with the reason recorded beside it. Anything unlisted passes through untouched and fails the resolve loudly, which is a human's call rather than a guess. Putting the blind pattern strip back fails a new test that an undeclared .devN pin is left alone.
| ver = re.sub(r"[+\-].+$", "", ver) | ||
| ver = re.sub(r"\.dev\d+$", "", ver) | ||
| out.append(f"{name}=={ver}") |
There was a problem hiding this comment.
Test the workflow's actual seed transform
If the production rewrite at .github/workflows/notebooks-ci.yml:574 is removed or broken, both new tests still pass because this helper independently performs the same substitution before making any assertions. Consequently, the regression that caused every smoke leg to fail is not actually guarded; the test should extract or execute the workflow's seed logic, or otherwise assert that the workflow itself contains the required transformation.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This one was the more serious of the two and you are exactly right. The helper re-implemented the seed transform, so deleting the rewrite from the workflow left both tests green - the regression they exist to catch was not guarded at all. Worse, the sabotage I ran to check them removed the strip from the test helper rather than from the workflow, so it demonstrated nothing.
Fixed in 9d36618: the tests now lift the seed heredoc out of notebooks-ci.yml and execute it, with only the output paths redirected and the snapshot's python_version set to the running interpreter, since that guard is about the snapshot matching the runner and has its own test. Sabotage is against the workflow now: removing the rewrite fails both pin tests, naming mako==1.3.2.dev0 exactly as CI did.
🛡️ Codex Security ReviewSecurity review completed. No security issues were found in this pull request. Reviewed commit: Only the user who started this review can view the report in Codex. ℹ️ About Codex security reviews in GitHubThis is an experimental Codex feature. Security reviews are triggered when:
Once complete, Codex will leave suggestions, or a comment if no findings are found. |
Two defects, both reported, both real. The blind strip was wrong. .devN is also a genuine PEP 440 prerelease, and rewriting it by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a different release that may not exist and is not what the image had. Mako is a distro anomaly, not a rule. It now goes through an explicit distro_dev_version entry keyed on the exact (package, recorded version), so a pin nobody has judged passes through untouched and fails the resolve loudly, where a human decides. The tests were worse: they re-implemented the seed transform, so deleting the rewrite from the workflow left both of them green. The regression they exist to catch was not guarded at all, and the sabotage I ran to 'prove' them removed the strip from the test helper rather than from the workflow, so it proved nothing. They now lift the seed heredoc out of the workflow and execute it, with only the output paths redirected and the snapshot's python_version set to the running interpreter -- that guard is about the snapshot matching the runner and has its own test. Sabotage against the workflow this time. Removing the rewrite fails both pin tests, naming mako==1.3.2.dev0 exactly as CI did; putting the blind pattern strip back fails the new test that an undeclared .devN pin is left alone. tests/notebooks: 325 passed, 2 skipped.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9d36618eb5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| offenders = [pin for pin in _run_seed(tmp_path) if ".dev" in pin or "+" in pin] | ||
| assert not offenders, ( |
There was a problem hiding this comment.
Restrict the marker assertion to declared distro rewrites
Although the workflow now correctly preserves undeclared development releases, this newly added assertion still rejects every seeded .devN version. When a future Colab snapshot legitimately contains a published prerelease such as pkg==2.0.dev3, _run_seed preserves it as intended, but this test fails and misleadingly labels it a distro-only marker, effectively forcing maintainers to rewrite or suppress a valid pin. Check only the exact from versions declared in distro_dev_version (the separate undeclared-pin test already verifies pass-through behavior).
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Right, and it contradicted the test directly beside it: that one injects an undeclared pkg==2.0.dev3 and requires the seed to preserve it, while this one rejected every seeded .devN. A snapshot carrying a genuine published prerelease would have satisfied the design and failed the suite.
Fixed in faa582f. It now checks the versions declared in distro_dev_version: a pin still carrying a declared from version is one the rewrite failed to apply, which is the actual regression. Local versions stay a blanket check, since the seed strips +cu128 from every pin whatever the package, so any survivor there is a defect.
Verified both directions: removing the rewrite from the workflow still fails it with ['mako==1.3.2.dev0'], and a freeze carrying some-real-pkg==2.0.dev3 now passes with the prerelease preserved.
The assertion I added contradicted the test beside it. One deliberately injects an undeclared pkg==2.0.dev3 and requires the seed to preserve it; the other rejected every seeded .devN. A future snapshot carrying a genuine published prerelease would satisfy the design and fail the suite, pushing a valid pin towards being rewritten or suppressed for no reason. Check the versions declared in distro_dev_version instead: a pin that still carries a declared "from" version is one the rewrite failed to apply, which is the actual regression. Local versions stay a blanket check, because the seed strips +cu128 from every pin whatever the package, so any survivor there is a defect. Still catches the real thing: removing the rewrite from the workflow fails it with ['mako==1.3.2.dev0']. And a freeze carrying some-real-pkg==2.0.dev3 now passes, with the prerelease preserved. tests/notebooks: 325 passed, 2 skipped.
dd94188 to
faa582f
Compare
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: faa582f3ce
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if not rewrites: | ||
| pytest.skip("no distro .devN rewrites are declared") |
There was a problem hiding this comment.
Fail when the required rewrite mapping disappears
If distro_dev_version is deleted or misspelled while the committed freeze still contains Mako==1.3.2.dev0, the production seed treats Mako as undeclared and passes the unresolvable pin to pip. In the revised tests, test_no_declared_distro_marker_survives_the_seed then computes an empty declared set and passes, while this test skips, so the suite remains green despite recreating the exact CI regression; make the absence of a rewrite for the known current offender a failure while it remains in the freeze.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is a hole I put there by scoping the checks to the mapping. With distro_dev_version gone the declared set is empty, so the marker test passes vacuously and the rewrite test skips, while the seed hands pip the unresolvable Mako==1.3.2.dev0 and the matrix dies exactly as it did. A green suite over the original regression.
Fixed in db83cb9 by reading the requirement from the freeze, which is what the image actually has. Every .devN entry must now be judged one way or the other: a distro label with a distro_dev_version rewrite, or a prerelease upstream really published, listed under a new published_prerelease key and passed through untouched. Neither answer is derivable from the version string, so a new one fails until a person says which it is.
Deleting distro_dev_version now fails, and so does misspelling it, which was the quieter half of your point.
…udly Scoping the checks to what distro_dev_version declares left a hole I put there: delete or misspell that key and the declared set is empty, so the marker test passes vacuously and the rewrite test skips, while the seed hands pip the unresolvable Mako==1.3.2.dev0 and every leg of the matrix dies exactly as it did. A green suite over the original regression. Read the requirement from the FREEZE instead, which is what the image actually has. Every .devN entry must be judged one way or the other: a distro label with a distro_dev_version rewrite, or a prerelease upstream really published, listed under the new published_prerelease key and passed through untouched. Neither answer is derivable from the version string, so a new one fails until a person says which it is. Deleting distro_dev_version now fails, and so does misspelling it, which is the case that would otherwise have been silent. tests/notebooks: 326 passed, 2 skipped.
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
* Strip distro .devN markers from the Colab pins My own regression, from the oracle refresh in unslothai#11324. I dispatched the smoke matrix on main to confirm the torchcodec fix and all eight legs failed earlier than before, in 'Install Colab-shaped venv': ERROR: No matching distribution found for mako==1.3.2.dev0 The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the distro build, which labels itself 1.3.2.dev0. PyPI has 1.3.2 and never had 1.3.2.dev0. The freeze is a snapshot of an image, so it records versions as the image labels them; the seed already strips a local version (+cu128) for exactly this reason and had nothing for .devN. One unresolvable pin fails the bulk resolve for all 690 of them. Strip the marker to the base version rather than skipping the package: the image really does carry Mako, and skipping would quietly shrink the venv this job exists to reproduce. Two tests, both replaying the seed's own transformation: no seeded pin may carry a .dev or + marker PyPI cannot resolve, and a package whose marker was stripped must still be pinned rather than dropped. Removing the strip fails both, the first naming mako==1.3.2.dev0 exactly as CI did. tests/notebooks: 324 passed, 2 skipped. Not verified here: this box cannot run the smoke matrix. The failure and the version list PyPI offered both come from the dispatched run on main (35432057179), and the fix is checked against the committed snapshot rather than against a resolve. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Rewrite the distro pin by name, and test the workflow's own seed script Two defects, both reported, both real. The blind strip was wrong. .devN is also a genuine PEP 440 prerelease, and rewriting it by pattern would turn a real pkg==2.0.dev3 into pkg==2.0, a different release that may not exist and is not what the image had. Mako is a distro anomaly, not a rule. It now goes through an explicit distro_dev_version entry keyed on the exact (package, recorded version), so a pin nobody has judged passes through untouched and fails the resolve loudly, where a human decides. The tests were worse: they re-implemented the seed transform, so deleting the rewrite from the workflow left both of them green. The regression they exist to catch was not guarded at all, and the sabotage I ran to 'prove' them removed the strip from the test helper rather than from the workflow, so it proved nothing. They now lift the seed heredoc out of the workflow and execute it, with only the output paths redirected and the snapshot's python_version set to the running interpreter -- that guard is about the snapshot matching the runner and has its own test. Sabotage against the workflow this time. Removing the rewrite fails both pin tests, naming mako==1.3.2.dev0 exactly as CI did; putting the blind pattern strip back fails the new test that an undeclared .devN pin is left alone. tests/notebooks: 325 passed, 2 skipped. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Scope the marker assertion to declared rewrites, not to .devN as a shape The assertion I added contradicted the test beside it. One deliberately injects an undeclared pkg==2.0.dev3 and requires the seed to preserve it; the other rejected every seeded .devN. A future snapshot carrying a genuine published prerelease would satisfy the design and fail the suite, pushing a valid pin towards being rewritten or suppressed for no reason. Check the versions declared in distro_dev_version instead: a pin that still carries a declared "from" version is one the rewrite failed to apply, which is the actual regression. Local versions stay a blanket check, because the seed strips +cu128 from every pin whatever the package, so any survivor there is a defect. Still catches the real thing: removing the rewrite from the workflow fails it with ['mako==1.3.2.dev0']. And a freeze carrying some-real-pkg==2.0.dev3 now passes, with the prerelease preserved. tests/notebooks: 325 passed, 2 skipped. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Judge every .devN pin from the freeze, so losing the mapping fails loudly Scoping the checks to what distro_dev_version declares left a hole I put there: delete or misspell that key and the declared set is empty, so the marker test passes vacuously and the rewrite test skips, while the seed hands pip the unresolvable Mako==1.3.2.dev0 and every leg of the matrix dies exactly as it did. A green suite over the original regression. Read the requirement from the FREEZE instead, which is what the image actually has. Every .devN entry must be judged one way or the other: a distro label with a distro_dev_version rewrite, or a prerelease upstream really published, listed under the new published_prerelease key and passed through untouched. Neither answer is derivable from the version string, so a new one fails until a person says which it is. Deleting distro_dev_version now fails, and so does misspelling it, which is the case that would otherwise have been silent. tests/notebooks: 326 passed, 2 skipped. --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
My own regression, from the oracle refresh in #11324, found by dispatching the smoke matrix on
mainto confirm #11325 rather than waiting for the cron.All eight legs now fail earlier than before, in
Install Colab-shaped venv:Why
The Colab image moved to Ubuntu 24.04 in this rotation, and its Mako is the distro build, which labels itself
1.3.2.dev0. PyPI has1.3.2and never had1.3.2.dev0.The freeze is a snapshot of an image, so it records versions as the image labels them. The seed step already strips a local version for exactly this reason:
and had nothing for
.devN. One unresolvable pin fails the bulk resolve for all of them.Makois the only new offender: the other marked entries in the snapshot are the+cu128torch builds, which the rewrite map already handles, and they predate this refresh.The fix
Strip the marker to the base version, which PyPI does publish. Not a skip: the image really does carry Mako, and skipping would quietly shrink the venv this job exists to reproduce.
Verification
Two tests, both replaying the seed's own transformation rather than asserting against a hand-written list:
.devor+marker PyPI cannot resolve;Removing the strip fails both, the first naming
mako==1.3.2.dev0exactly as CI did.tests/notebooks: 324 passed, 2 skipped.Not verified here
This box cannot run the smoke matrix. The failure, and the version list PyPI offered, both come from the dispatched run on
main(35432057179); the fix is checked against the committed snapshot rather than against a live resolve. The matrix iscron/dispatchonly, so it will not run on this PR either — I will dispatch it onmainagain once this lands.Also worth recording from that run:
static + transitive resolveand the rest of Notebooks CI are now green onmain, so #11324's half is confirmed. The torchcodec fix in #11325 is still unconfirmed, because the install step now fails before the import check it repairs is reached.