Repository navigation
Conversation
Since the receipt shim refactor (4a23e31, #116), the trust pins live in scripts/receipt_pins.py, but the gate surface still listed only the files that held them before. receipt's append gate calls a proposal gate-changing only when it touches gate_surface, so a resolver-shaped append that also edited the pins, or bumped receipt in pyproject.toml and uv.lock, was judged as plain data: accepted, and never named. Reproduced with the base gate invoked as the trusted CI job invokes it: 3dd95a0's gate accepted the release-20 append plus a receipt_pins.py edit as "+5 appended vs base, release 20", and #299's gate accepted #297's seven rows plus a pins edit as "+7 appended vs base, release 21". The surface now covers: - scripts/**: the judge runs a script there, so scripts/ is sys.path[0], and both pull request jobs also put it on PYTHONPATH. A new module there shadows imports (the standard library's included), and a sitecustomize.py runs at startup. Both were observed. - pyproject.toml and uv.lock, which pick the receipt version the judge runs, and uv.toml, .python-version and .venv/**, which uv also reads from the project it provisions the judge from. Each was observed to change what `uv sync --locked --no-dev --project <dir>` and `uv run` do. The same candidates are now refused as mixed, naming the decider, while both pure appends still pass and a pins-only change is reported as gate-only. The resolver's proposals change only ledger/** and releases/manifests/**, so they stay data proposals. Tests: every decider is refused as mixed beside a witnessed append and named when changed alone; a pure append beside unchanged deciders passes; an audit-hook run shows every file the gate opens or imports from its own checkout is on the surface; and the shim's surface is pinned as a deliberate superset of the originals'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fix/gate-surface-trust-pins Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
All of scripts/ on the surface would refuse a catalog-builder change shipped with the ledger/series_catalog.json it generates, as #128 did. The catalog tests require the two to land together, so that shape could not be split. The surface now lists the gate's own scripts and receipt_pins.py, plus the files that set up its interpreter and environment: scripts/sitecustomize.py, scripts/__pycache__/** (Python loads an unchecked-hash .pyc there in place of its source; observed), pyproject.toml, uv.lock, uv.toml, .python-version and .venv/**. A new module under scripts/ that shadows one of the gate's imports is now off the surface. A strict-xfail test records that limit; the fix is for the gate to stop importing from scripts/. Tests: a builder change beside an append stays a data proposal; the decider list gains the unchecked-hash .pyc; fixtures force-add the changed decider so an ignore file cannot drop it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A "dir/**" entry matches only paths below dir, so a symlink committed at .venv or scripts/__pycache__ itself was unclassified and passed beside a ledger append. List each such directory bare as well, with a test that a symlink there is refused as mixed. Add the other files that decide the judge's environment or the anchor bytes it checks out: .python-versions, hatch.toml and hatch_build.py (uv installs this project with hatchling), a root sitecustomize.py (the editable install puts the root on sys.path), and .gitattributes and releases/.gitattributes. Record the limit that remains: a new module on the judge's import path, under scripts/ or at the root, and the project's own build inputs such as README.md. Running the judge isolated and without installing the project closes it. Pin the exact surface and the exact widening over the original gate in the tests, and let the shadowing xfail pass only on an AssertionError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
fix/gate-no-scripts-imports
branch
from
December 1, 2026 17:04
07a697d to
91f227d
Compare
Git applies scripts/.gitattributes, .github/.gitattributes and .github/workflows/.gitattributes when it checks out the judge. receipt 0.6.2 already refuses filter, ident and working-tree-encoding on every surface path at any depth, and Python reads either line ending, so none of the three can change a verdict today. Listing them keeps that from depending on the receipt version. A structural test now checks that every .gitattributes above a surface entry is on the surface. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The thesis-ledger append gate could import a module that a data proposal added off the gate surface. scripts/ was sys.path[0] and on PYTHONPATH, and uv's editable install of this project put the base checkout's root on sys.path. A scripts/tempfile.py, a scripts/receipt/ or scripts/receipt_pins/ package, or a root sitecustomize/ package would then run inside the judge on every later pull request. - The gate and verify_release_chain.py compile scripts/receipt_pins.py by path; the scripts.receipt_pins fallback is gone. - Both pull request jobs build the base gate's environment with `uv sync --no-install-project` and start it with `uv run --no-sync ... python -I`, with no PYTHONPATH. A base gate that still imports its pins by name gets the project installed, as before, so the new workflow still judges with an older base gate. - The push path and ci.yml's `verify_release_chain.py --full` start the same way. - The strict xfail becomes end-to-end tests that run the workflow's own step scripts against all five shadows. A fake uv builds a real venv and models the editable install. Controls show each shadow runs when its way in is open. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An in-session adversarial check of the isolated-gate change found the following: - The root sitecustomize/ control assumed the interpreter ships no sitecustomize of its own. Ubuntu's /usr/bin/python3 does, and the push run's test venv is built on it, so that control would fail on every merge into the ledger branch. It now skips where the interpreter's own comes first. The legacy controls cover the spellings an old gate looks up at the root whatever the interpreter: a root receipt_pins.py, a scripts/__init__.py and a scripts/receipt_pins/ package. - The step harness ran a candidate whose gate matched the base's, so a workflow that ran, or chose its branch from, the candidate's gate passed every test. On a pull request the candidate's gate now forges a pass if run and carries the by-name import if read. In the legacy tests it loads its pins by path. Every start's script must be the judging checkout's own. - The legacy tests also keep the scripts/ shadows in the base, which -I keeps off sys.path in that branch too. - A new test runs ci.yml's verify step as GitHub would, beside every shadow. - The workflow, pins and README now name the legacy branch's limits: the root is on sys.path last, so a module the old gate looks up there still reaches it. They also say the trusted job needs main's copy, and word the legacy branch's deletion condition so it can be met. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
fix/gate-no-scripts-imports
branch
from
December 1, 2026 18:37
d517251 to
b2216cc
Compare
MaxGhenis
added a commit
that referenced
this pull request
Dec 1, 2026
Carries #459's workflow change into main, byte for byte, because pull_request_target runs main's copy. Both pull request jobs check the base commit out with --attr-source set to the empty tree, so the judge runs from its committed bytes. A .gitattributes anywhere in the base can no longer stop that checkout (a boolean working-tree-encoding, a required filter whose smudge fails), which would fail the trusted job on every later pull request, the one that removes the file included. The candidate keeps its attributes. #459 holds the step tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Both pull request jobs check the base commit out to run its gate, and git applied the base's .gitattributes to that checkout at every depth. Some attributes stop the checkout partway, with exit 128: a boolean working-tree-encoding, or a required filter whose smudge fails. The job then fails on every later pull request, the one that removes the file included, until an admin steps in. Two pull requests that each pass alone can merge into such a base: one adds the attribute, the other the file it names. Other attributes rewrite the bytes the judge runs from or pins. An encoding on the gate's scripts stops Python; receipt refuses a proposal that adds one, but that is a property of the receipt version. eol=crlf on the trust anchors, which receipt does not refuse, makes the gate refuse every append. Both jobs now check the base out with --attr-source set to the empty tree, so the judge runs from its committed bytes whatever the base's attributes say. The runner's own git config still applies; GitHub's ubuntu runners set no core.autocrlf or core.attributesFile. Under the root .gitattributes today (text eol=lf, binary and -text) a checkout of this repository writes the same bytes with and without attributes. The trusted job's candidate keeps its attributes: if they stop its checkout, that refuses the candidate. An older git rejects --attr-source as an unknown option instead of ignoring it, as it would attr.tree. The step tests run the workflow's own scripts against three bases: one holding a boolean working-tree-encoding off the surface, one an encoding on the gate's scripts, and one eol=crlf on the anchors. On both paths, the pull request that removes either of the first two is judged, the witnessed append beside the third is accepted, and the judge's scripts and anchors match their committed bytes. The control takes the empty tree out of the trusted job's step: git refuses the checkout, Python the rewritten gate, or the gate the rewritten anchors. The step harness now sets LC_ALL=C, so git's messages are untranslated. The README and the comments say where the attributes still apply: the push path, a local run, and the trusted job until the default branch carries this workflow. Reported by the #308 session's attribute check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
added a commit
that referenced
this pull request
Dec 1, 2026
Carries #459's workflow change into main, byte for byte, because pull_request_target runs main's copy. Both pull request jobs check the base commit out with --attr-source set to the empty tree, so the judge runs from its committed bytes. A .gitattributes anywhere in the base can no longer stop that checkout partway (a boolean working-tree-encoding, a required filter whose smudge fails), which would fail the trusted job on every later pull request, the one that removes the file included. Nor can it rewrite the gate's scripts or trust anchors. The candidate keeps its attributes. #459 holds the step tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MaxGhenis
force-pushed
the
fix/gate-no-scripts-imports
branch
from
December 1, 2026 20:05
a7180d6 to
05b49e2
Compare
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.
Draft, stacked on #308. This branch contains #308's commits (head
c29e1de4). It will be rebased ontocodex/thesis-ledger-factsonce #308 merges, and it does not merge before #308.What this fixes
A data proposal could add a module off the gate surface that the append gate's judge would then import on every later pull request:
scripts/. The judge runs a script there, soscripts/wassys.path[0], and both pull request jobs also put it onPYTHONPATH. Most ofscripts/is off the surface, becausescripts/build_series_catalog.pyships with theledger/series_catalog.jsonit generates (Series catalog: canonical registry for the thesis fact ledger #128). Ascripts/tempfile.py, or ascripts/receipt/,scripts/receipt_pins/orscripts/sitecustomize/package, would stand in for a module the gate imports..pthfile appended the base checkout's root tosys.path. A rootsitecustomize/package would run at the judge's startup. The editable build also readREADME.md, so deleting it would break every later trusted run.#308 recorded these five shadows as a strict xfail.
Change
scripts/check_thesis_facts_append.pyandscripts/verify_release_chain.pycompilescripts/receipt_pins.pyfrom its path. Thescripts.receipt_pinsfallback is gone. Compiling from source also means a__pycache__entry cannot stand in for the pins..github/workflows/thesis-facts-append.ymlnow set up and start the base gate this way:uv sync --locked --no-dev --no-install-project --project "$base_gate", so no editable.pthexists and nothing is built from the checkout.uv run --no-sync --project "$base_gate" python -I, with noPYTHONPATH.--no-syncstopsuv runfrom installing the project again.-Ikeeps the script's directory offsys.pathand ignoresPYTHON*variables.--helpquestions and both arms of eachcase.PYTHONNOUSERSITE=1goes.verify_release_chain.py --fullstep inci.ymlstart the same way.scripts/receipt_pins.pyand the README say why the rest ofscripts/and the root can stay off the surface.Ordering
pull_request_targetruns main's copy of the workflow, so the trusted job needs a second pull request into main carrying this branch's workflow byte for byte, as in #242. That is #460. Neither order of landing breaks a run:ca7c6fcf) imports its pins asreceipt_pins, then falls back toscripts.receipt_pins, which it finds only through the root. Started isolated, it fails withNo module named 'scripts'; I checked this against a real--no-install-projectenvironment.from scripts.receipt_pins importline. If the line is there, the job installs the project as before, and the start is stillpython -I.pull_requestjob runs this pairing, because its base is today's gate.sys.path, so main's current invocation still runs it.What the legacy branch still lets through
A base whose gate still imports its pins by name keeps that gate's limits.
-Ikeepsscripts/offsys.path, but the installed project puts the root on it, last. So a module that the old gate looks up and finds nowhere earlier reaches it: a rootreceipt_pins.py, ascripts/__init__.pyor ascripts/receipt_pins/package. A rootsitecustomize/package also runs, wherever the interpreter has nositecustomizeof its own. In exchange, thescripts/shadows (scripts/tempfile.py,scripts/receipt/,scripts/sitecustomize/) close even for such a base. The workflow,scripts/receipt_pins.pyand the README all say this.Delete the legacy branch once no base reachable from
codex/thesis-ledger-factsimports its pins by name. A gate older than the pins (before #116) imports its sibling scripts by name, cannot start under-I, and stops the step. No reachable base is that old.Landing order
Land #460 first. Until main carries the new workflow, the trusted job starts every base gate the old way, with
scripts/onPYTHONPATHand the project installed. A base gate from this PR then loads its pins by path, butscripts/tempfile.py,scripts/receipt/andscripts/sitecustomize/still reach it, and so does a rootsitecustomize/package where the interpreter has none of its own. The trusted check closes only once #460 is on main.CI's
setup-uv@v5may run a different uv than the 0.11.7 I tested. This PR's ownpull_requestjob takes the legacy branch, because its base is today's gate; its trusted job runs main's current copy. The first isolated runs on ubuntu are this PR's push job on merge, then the next pull request'spull_requestjob, and its trusted job once #460 is on main.Base checkout attributes
The #308 session's attribute check found one more way for the base to stop the judge, and routed it here because this PR owns the workflow change. Both pull request jobs checked the base out with its own
.gitattributes, at every depth:working-tree-encoding, or a required filter whose smudge fails, stops the checkout partway with exit 128. The job then fails on every later pull request, the one that removes the file included, until an admin steps in. Two pull requests that each pass alone can merge into such a base: one adds the attribute, the other the file it names.eol=crlfon the trust anchors, which receipt does not refuse, makes the gate refuse every append ("anchor bytes are not code-pinned").Both jobs now check the base out with
--attr-sourceset to the empty tree, so the judge runs from its committed bytes. The runner's own git config still applies; GitHub's ubuntu runners set nocore.autocrlforcore.attributesFile. Under today's root.gitattributes, a checkout of this repository with and without attributes is byte-identical (588 files). The trusted job's candidate keeps its attributes: if they stop its checkout, that refuses the candidate. An older git rejects--attr-source(2.41+) as an unknown option rather than ignoring it, as it wouldattr.tree. The runner images list git 2.56.1.The attributes still apply on the push path, in a local run, and in the trusted job until #460 is on main, so the
.gitattributesentries stay on the surface.Tests
The strict xfail becomes
test_a_module_that_shadows_a_gate_import_cannot_change_the_verdict. It runs the workflow's own step scripts, extracted from the YAML, forpull_request_target,pull_requestand push:refs/pull/N/merge, and the runner sets a hostilePYTHONPATH.uvbuilds a real venv at<project>/.venv. Its locked dependencies are the test interpreter's site-packages, listed as plain paths, so the test repository's own editable.pthis never processed. Asyncwithout--no-install-project, or arunwithout--no-sync, writes the editable.pththat puts the project root onsys.path, as hatchling's does. Before each isolated start it records the judge'ssys.path.from scripts.receipt_pins importline would steer the workflow into the legacy branch. The tests check that every start runs the judging checkout's own gate.Across 3 paths × 5 shadows, neither marker appears and the refusal stands. The judge's
sys.pathholds only the standard library, its venv and the locked dependencies; neither the root norscripts/appears in it. Further tests:test_a_true_append_beside_shadowing_modules_is_accepted: with all five shadows in the base, the witnessed append still passes on all three paths.test_a_base_gate_that_imports_its_pins_by_name_still_judgescovers the ordering. A base gate rewritten to import its pins by name, with the threescripts/shadows beside it, takes the legacy branch on both pull request jobs. It refuses the frozen-row rewrite and accepts the true append, and no shadow runs. In the refused case the candidate's gate loads its pins by path, so a workflow that chose the branch from the candidate's copy would take the isolated branch, where the old gate cannot start.test_ci_verifies_the_release_chain_isolated_beside_shadowing_modulesrunsci.yml's own "Verify witnessed release chain" step beside all five shadows: the chain verifies, no shadow runs, and the one start is isolated.test_a_gitattributes_in_the_base_cannot_stop_or_rewrite_the_base_gateruns both pull request jobs against three bases: a booleanworking-tree-encodingindocs/, off the surface; a UTF-16LE encoding on the gate's scripts; andeol=crlfon the anchors. The pull request that removes either of the first two is judged, the witnessed append beside the third is accepted, and the judge's scripts and anchors match their committed bytes. Its control,test_the_same_attributes_stop_a_base_gate_checked_out_with_them, takes the empty tree out of the trusted job's step: git refuses the checkout, Python the rewritten gate, or the gate the rewritten anchors. The step harness setsLC_ALL=C, so git's messages are untranslated.Controls show that each shadow runs when its way in is open:
test_the_same_shadow_runs_when_scripts_is_on_the_path:scripts/tempfile.py,scripts/receipt/andscripts/sitecustomize/, with the gate started the old way.test_a_base_gate_that_imports_its_pins_by_name_keeps_its_limits: a rootreceipt_pins.py, ascripts/__init__.py, ascripts/receipt_pins/package and a rootsitecustomize/package, through the legacy branch. The rootsitecustomize/case skips where the interpreter ships asitecustomizeof its own, as Debian's, Ubuntu's and Homebrew's do, since theirs comes first.Mutation check. Each of these edits to the workflow makes the e2e tests fail:
uv runwithout--no-sync;-I;With the project installed, the root
sitecustomize/package runs and leaves its marker.test_policyengine_ledger.py,test_release_chain.pyandtest_thesis_append_adversarial.pycopied the gate into fixtures without its pins. They now copyreceipt_pins.pytoo.Real uv 0.11.7, macOS, Python 3.14.7, on a copy of an earlier head,
91f227d9, with a rootsitecustomize/package added (later heads change only comments in the workflows):uv sync --no-cache --locked --no-dev --no-install-projectsucceeds withREADME.mddeleted.uv run --no-sync ... python -Ianswers--help, the marker stays absent, and the venv holds no editable.pth.verify_release_chain.py --fulland the push-path gate, started as CI now starts them, both pass (35 releases).Local runs on
05b49e27(macOS, Python 3.14.7, git 2.55.0) of the CI "Ledger observation invariants" list, plustest_legacy_targets_retired.pyandtest_build_series_catalog.py: 620 passed and 5 xfailed. The 5 are the existing strict xfails intest_thesis_append_adversarial.py. On an earlier head, the shadow, legacy andci.ymltests also passed under Homebrew's Python 3.14.7, whose standard library ships asitecustomize: 29 passed, and the rootsitecustomize/control skipped as designed.🤖 Generated with Claude Code