Repository navigation
Entry identity: reusable outputs in conda; warn on an uncertain first write - #621
Draft
guijacquemet wants to merge 2 commits into
Draft
guijacquemet wants to merge 2 commits into
guijacquemet wants to merge 2 commits into
Conversation
… write Conda installs setuptools as an .egg-info without RECORD, and brick_identity's closure (every extra included) reached it, so every entry record written in a conda environment was uncertain and every rerun refused with ENTRY_IDENTITY_UNCERTAIN (setuptools: RECORD missing). - entry_identity: the installers pip, setuptools and wheel are neither listed nor followed in the requirement closure (INSTALL_TOOLS); every other library without RECORD stays uncertain (ADR 0007 (b)); a caller's explicit name is still identified. uncertain_library names the library behind an uncertain brick part. - entry_record: write_entry_record warns (EntryIdentityWarning, text from identity_warning) that an output written under an uncertain identity will never be reused. - entry_errors: uncertain_code_fix; the ENTRY_IDENTITY_UNCERTAIN fix names an uncertain library and why instead of telling the user to reinstall a brick that is already a released install. - Tests with egg-info distributions in a temporary site folder; docs (contract 21.2/21.4, plan 12 question 93), CHANGELOG Unreleased (v0.10.1). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp98tSnytZ9QCrHt6297
…able fix - write_entry_record warned before the exclusive open, so a record that was not written (one already there) still said the output was written; the warning now follows the write. - The fix for an editable library said pip install "<name>==<version>", which pip skips as already satisfied; it now forces the reinstall (--force-reinstall --no-deps), as the RECORD-missing fix does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G3qp98tSnytZ9QCrHt6297
This was referenced Dec 3, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Cause. In a fresh conda environment (Python 3.12) with every brick pip-installed from its release tag, an entry output was never reusable: the first
fiberfeatures runpublished, then every rerun and everycheckof that output was refused withENTRY_IDENTITY_UNCERTAIN: ... (setuptools: RECORD missing) ... Install a released fiberfeatures (not editable ...). Conda installssetuptoolsas an.egg-infowith noRECORD.brick_identityfollows every requirement of the brick, every extra included, and that walk reached setuptools, so every record written there wasuncertain(ADR 0007 case (b)). This affects every brick's entry, not only fiberfeatures.By module:
entry_identity: the installerspip,setuptoolsandwheel(INSTALL_TOOLS) are no longer listed or followed in the requirement closure. Any other library without aRECORD, or installed editable, still makes the identity uncertain. A name a brick passes explicitly inlibrariesis still identified, even an installer. Newuncertain_library(brick)returns the library (name, version, why) behind an uncertainbrickpart, or None when the brick's own code is the cause.entry_record:write_entry_recordstill writes a record whose identity is uncertain, but now also emits anEntryIdentityWarningsaying the output will never be reused, with the reason and the fix. The text comes from the newidentity_warning(record, output=None), which a brick can print with the published path. Both are re-exported from the package.entry_errors: newuncertain_code_fix(brick, library=None). For the brick itself the fix is the ADR's text, unchanged. For an uncertain library the fix names that library, says why (noRECORD, withpip install --force-reinstall --no-deps "<name>==<version>"; or an editable install) and says the brick needs no change.entry_identity_uncertain(..., library=)andreuse_or_refuseuse it.Decisions
The smallest change ADR 0007 allows is to leave the installers out of the closure:
brick_cachekey, which takes every extra; the ADR requires "at least as strong". It also would not fix the bug, because some libraries require setuptools with no extra (torch on Python ≥ 3.12)..egg-infoby name and version would contradict ADR 0007 (b): a library without aRECORDis uncertain. Case (b) is kept for every other library.For the owner:
Notes for review
An output whose v0.10.0 record lists one of the installers counts as another identity under v0.10.1 (
ENTRY_OUTPUT_EXISTSnaming it). Upgrading preprocessing changes every brick's identity anyway, because preprocessing is one of each brick's libraries.Leaving setuptools out also leaves out
pkg_resources, which a few old libraries import at runtime. I judged that it does not compute values.The warning is a Python
warnings.warn, so a brick's CLI shows it on stderr unless the brick filters warnings. Bricks that want their own wording can printidentity_warning(record, output).Not verified: a real conda environment end to end with fiberfeatures (fiberfeatures is private and not reachable from this session). The conda case is simulated: fake
.egg-infodistributions in a temporary site folder, placed ahead of the real setuptools onsys.path.Audit follow-ups (second commit): the warning now comes only after the record is written (it used to come before the exclusive open, so a refused write still said "written"). The editable-library fix now forces the reinstall, because a plain
pip install "lib==1.0"over an editable 1.0 is skipped as already satisfied.Every brick's own test suite will now see this warning. A brick's tests usually run from an editable install, whose identity is uncertain. If a brick's pytest settings turn warnings into errors (
filterwarnings = error), its entry tests will fail until it filtersEntryIdentityWarningor expects it. I could not check the bricks' settings from here.The suggested pip command is not verified on a real conda package. pip may refuse to uninstall some
.egg-infoinstalls ("distutils installed project"). Reinstalling with pip over a conda package can also leave conda's own records out of step. Since setuptools is now excluded, this matters only for other libraries, which this test environment did not have.Tests
tests/test_entry_identity.py: a conda-stylesetuptoolsegg-info (pluswheelandpip) no longer makes the identity uncertain, and nothing is followed through it. This test fails without the fix. Also: an installer named inlibrariesis still identified; another egg-info library stays uncertain and the fix names it; the brick's own fix is the ADR's; the brick's own uncertainty comes before its libraries'.tests/test_entry_record.py: one warning on an uncertain first write, none on a certain one, and none when the record is not written; a library-uncertain record is named both in the warning and in thereuse_or_refuserefusal.python tools/check.py(ruff check, ruff format --check, pytest, code rules), Python 3.13, on the first commit: 9180 passed, 32 skipped. After the audit commit only the entry tests were rerun (test_entry_identity,test_entry_record,test_code_identity,test_entry_settings: 52 passed, 1 skipped), plus ruff.https://claude.ai/code/session_01G3qp98tSnytZ9QCrHt6297
Generated by Claude Code