Repository navigation
Skip compiled conda packages instead of failing apply - #2183
Conversation
A compiled conda build of a Python package (pillow, numpy, pyyaml from conda-forge) is never the PyPI wheel a patch is made from, so nothing may be written to it. `apply` refused such a copy with `conda_build_not_pypi_release` and exit 1. That failed a run over a package socket-patch does not support yet: a manifest recorded where PyPI wheels are installed, then applied in a pixi or conda environment, could not pass. `scan --mode agent` already left the same patch out with a warning and exit 0. Compiled conda packages are now skipped: - `apply` writes nothing to the copy (also under `--force`), warns once per copy, emits a `skipped` event per record and copy, counts the records as `N not supported`, and leaves the exit status as it is. A copy that already holds a patch is still reported as already patched. - The skip is the copy's, for every record of the release, whether or not its files match one. The usual compiled build (a recipe-patched source, no wheel extension modules) used to fail as "no matching variant found". - `apply --check` does not call the copy drift. It settles a compiled copy as `apply` does, once over every record of its release and per release, so a copy that holds one record's patch is in sync, and another package in the same site-packages is judged on its own. - Under `--json`, a `scan` / `get` whose apply skips a copy of a record the run did not select carries that skip. Pure-Python conda builds are unchanged: patched when every replaced file is the release's, refused for a platform wheel's record on its own or a file that differs. Whether a copy with no `WHEEL` (an `.egg-info` install) is compiled is now read from the conda package's own file list, its record in the environment's `conda-meta`. The files of its top-level names were the only evidence before, which took a shared library another distribution put into a shared namespace package for its own, and missed one in a module the metadata does not name; with the answer now deciding between a skip and a write, both matter. That reading remains for a copy no record lists. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
PR SummaryMedium Risk Overview Detection of “compiled” for
Reviewed by Cursor Bugbot for commit f823816. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit f823816. Configure here.
Two Bugbot findings on the compiled-conda skip: - The outcomes a nested apply hands to `scan` and `get` dropped the skip of a compiled conda copy when another copy of the same record was patched, and kept one skip per record however many environments hold a copy. A `--json` run then read as fully applied, or named one of several unpatched copies. Each skipped copy now has its event, beside the applied copy's, as `apply --json` reports it. - A compiled conda copy that already holds one record's patch left a sibling record its files do not match reported as not installed, while `apply --check` passes over it. The copy now accounts for every record of its release in `apply` too. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

Problem
#2166 made
applyrefuse a compiled conda build of a Python package (pillow, numpy, pyyaml from conda-forge) withconda_build_not_pypi_releaseand exit 1. Such a build is never the PyPI wheel a patch was made from, so nothing may be written to it. But it is also something socket-patch does not support yet, and a run should not fail over it: a manifest recorded on a machine that installs PyPI wheels, then applied in a pixi or conda environment, failed CI for a package that cannot be patched there at all.scan --mode agentalready treated the same case as a skip (the patch is left out with a warning, exit 0).The owner's decision: compiled conda packages are skipped for now; they are not supported yet.
What changes
A compiled conda build is skipped, not failed. Nothing is written to it, whatever the record and whatever was passed (
--forceincluded).applyprintsWarning: <purl>: conda_build_not_pypi_release: … compiled conda packages are not supported yet, so it was skipped and is not patchedonce per copy, emits oneskippedevent per record (errorCode: conda_build_not_pypi_release), counts the records asN not supportedin the summary, and leaves the exit status as it is. The same holds for--dry-run, and for the apply thatscan --mode agentandgetrun.apply --checkdoes not call the copy drift: the same warning and events, andN not supported, skippedon its result line. It judges a compiled copy asapplydoes, per copy over every record of the release, so a copy that holds one record's patch is in sync and is not judged for a sibling record.no matching variant found.Pure-Python conda builds are unchanged: patched when every replaced file is the release's, refused with exit 1 for a platform wheel's record on its own or a file that differs.
How a copy with no
WHEELis judged compiled (an.egg-infoinstall, such as conda-forge's setuptools). It was read from the files of its top-level names, which is wrong in two ways now that the answer decides between a skip and a patch: a shared library another distribution put into a shared namespace package (google,zope) made a pure build look compiled, and a build with notop_level.txtwhose import name differs from its distribution name (PyYAML,yaml) looked pure and was patched. The conda package's own file list, its record in the environment'sconda-meta, now says which files are its own. The old reading remains only for a copy no record lists.Verification
cargo clippy --locked --workspace --all-features -- -D warnings: clean.cargo test -p socket-patch-core --lib(8324),-p socket-patch-cli --lib(1026) and-p socket-patch-cli --lib --test apply --test get --test scan --test in_process_python_envs --test rollback --test remove --test mode_migration_pypi --test in_process_pypi_apply: all pass.a_compiled_conda_build_is_skipped_even_when_the_file_matches(three record kinds, with--force,--allow-patch-conflicts,--dry-run),a_compiled_conda_build_that_differs_from_the_wheel_is_skipped_and_checks_clean(also--checkand--json),a_compiled_conda_build_holding_one_records_patch_is_in_sync,a_compiled_conda_build_beside_a_pip_installed_wheel_is_skipped_and_the_wheel_patched, the summary and event unit test, andan_egg_info_conda_build_is_judged_by_its_conda_record.scripts/backtest-pixi.pyon real pixi 0.84.2 (macOS arm64): 13 of 13 cells pass.pyyaml(compiled),setuptools(.egg-info, noINSTALLER, noWHEEL) andcertifi:apply --dry-run, with and without--force, skips pyyaml with one warning and exit 0, and reads setuptools as pure from its real conda record;apply --checkreports only the two unpatched pure packages.Code review
/code-review highran twice on this diff, and every finding it confirmed is fixed here.First round, three important:
apply --checkreported a compiled copy that holds one record's patch as out of sync. Fixed: the copy is settled once, over every record of its release.apply --check --jsonsaid every installed copy is patched while one was skipped. Fixed: the skip has its own event, and the reason readsevery installed copy that can be patched is patched..egg-infobuild in a shared namespace package was now skipped quietly, and a compiled one withouttop_level.txtwas written to. Fixed by reading the conda record, as above.Second round, two important, both in code the first round added:
apply --checkwas keyed by the copy's path, which is the site-packages directory every package of the environment shares, so another package's unpatched copy there read as not installed. Fixed: it is kept per release. Test:a_compiled_conda_build_holding_its_patch_does_not_hide_another_packages_drift.lib/python3.1 -> python3.13). Fixed: both paths are resolved first, andapply --checktreats two spellings of one directory as one copy, asapplydoes. Test:a_compiled_conda_build_under_two_spellings_of_its_directory_is_skipped_once.Smaller points fixed: a file name that merely contains
.so.is no longer a shared library; oneskippedevent per record and copy, so a second environment's copy is named; ascan/get --jsonrun carries the skip of a record it did not select; the contract's--checkrow, theget <uuid>case, the already-patched rule and whatvexdoes are stated as the code behaves.Bugbot reported two findings on the first push, both fixed in a281846:
scan/get --jsondropped the skip of a compiled copy when another copy of the record was patched, and named one of several skipped copies. Fixed: each skipped copy has its event, beside the applied copy's. Test:record_apply_outcome_says_each_copy_skipped_as_not_supported.apply --checkpasses over it. Fixed: the copy accounts for every record of its release inapplytoo.Not changed, all present before this PR:
apply --vexfails withno_applicable_patcheswhen nothing in the project is attestable. A project whose only patches are for compiled conda packages reaches that.Error:line and nofailedevent. Beside a skipped compiled copy of the same package, the envelope then carries only the skip events.--offlinewith a missing blob) fails before any copy is looked at, including one that would be skipped.🤖 Generated with Claude Code