Repository navigation
fix(control): drop the gate's stale bytecode before importing it (#2472) - #2489
Merged
Merged
Conversation
wp18_selftest_gate.py does `import wp18_conformance_gate as G`. Python keys a .pyc on (source mtime in whole seconds, source size), and editing the gate's verdict from `else 2` to `else 0` preserves the size, so an edit-run-edit loop inside one second hands this control the PREVIOUS state's bytecode. Measured here, while testing this very gate: five hand mutations in quick succession left a .pyc that made the control report five failures with `git status` clean and the source sha matching HEAD. I spent a round chasing a phantom regression on a tree that was byte-identical to master. tri gates mutate clears this between mutants -- that fix landed two days ago after a reviewer found it. A person at a terminal does not, and neither did this control. Three lines remove the class. Verified: mutate, run (leaving a mutant .pyc), revert, run immediately -> exit 0 on a clean tree. And the guard does not weaken the control: both drift mutations are still killed. Refs #2472
Contributor
…inal (#2472) tri gates mutate was taught to clear Python's bytecode cache two days ago. I then hit the identical defect by hand, on the same gate, while checking a recommendation: five quick mutations left a stale .pyc and the control reported five failures on a tree matching HEAD exactly. Fixing a hazard inside one tool leaves it live wherever a person does the same thing manually -- and the manual path is the one used while investigating, which is when a false red costs most. Plus: every verdict taken before finding the broken instrument is suspect, not wrong, and the write-up should say the numbers are a re-measurement. And refuting a recommendation needs more rigour than accepting one -- three mutations of increasing narrowness plus a no-op as a control on the control. Refs #2472
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-08-23 02:15:33 UTC
Summary
Seal Status
|
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
A grep for files importing a sibling module found three that matter and none was guarded. wp18_selftest_gate.py was fixed in the previous commit; this adds the other two. wp18_gate_selfconsistent_selftest.py imports wp18_conformance_gate verify_exhaustive.py imports ternary_model The second is the worst of the three: verify_exhaustive is the gate that proves four backends agree with a SEPARATELY WRITTEN model, so a stale model means the comparison is against a version nobody is looking at. Proven on it, both directions: a same-size edit to ternary_model.py gives exit 1, and reverting then running immediately gives exit 0. Without the guard the second run reads the broken model. Refs #2472
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-08-23 02:22:36 UTC
Summary
Seal Status
|
After fixing the stale-bytecode trap in the control where I hit it, one grep for the SHAPE of the defect -- files importing a sibling module -- found two more. The one nobody had tripped over was the worst: verify_exhaustive imports the separately-written model it compares four backends against, so a stale .pyc means the fourth opinion is not the one anyone is reading. Plus: prove the fix on the instance you did NOT stumble into, or you have only confirmed the diagnosis you already had. And note that every mutation a mutation-tester makes is size-preserving by design, which makes a mutation harness and this cache natural enemies. Refs #2472
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
PR DashboardGenerated at: 2026-08-23 02:23:04 UTC
Summary
Seal Status
|
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.
wp18_selftest_gate.pydoesimport wp18_conformance_gate as G. Python keys a.pycon (source mtime in whole seconds, source size), and editing the gate's verdict fromelse 2toelse 0preserves the size — so an edit-run-edit loop inside one second hands this control the previous state's bytecode.Measured here, while testing this very gate
Five hand mutations in quick succession left a
.pycthat made the control report five failures withgit statusclean and the source sha matching HEAD. I spent a round chasing a phantom regression on a tree byte-identical to master.Worse: every "mutant killed" verdict taken before that discovery was suspect, because the control could have been red for the wrong reason. All of them were re-run after clearing the cache. They hold — but that is a re-measurement, not the original one.
The same defect, one layer over
tri gates mutateclears this between mutants; that fix landed two days ago after a reviewer found it in the neighbouring module. A person at a terminal does not clear it, and neither did this control.Three lines remove the class: drop the gate's cached bytecode before importing it.
Verified
Refs #2472