Repository navigation
Python cleanup rule reads the whole contract; telemetry oracle reads self.logger (Part of #8863) - #9263
Merged
Conversation
…self.logger (Part of #8863, #8862) Cleanup: the rule matched call forms only (close/shutdown/...), so `with`, `try/finally` and `del` -- named by the cleanup contract -- were missed. It now also counts `with x:` / `with f(..)`, `finally:`, `del x`, and rmtree/unlink/rmdir/removedirs/remove calls. Telemetry: the 0.28 precision was the oracle's error. It read only a bare `logger.x(..)` receiver and missed `self.logger.x(..)`; the engine rule was right. Self-scan of gitgalaxy/ (3,720 Python functions), before -> after: def_cleanup recall 0.17 -> 0.99, precision 0.86 -> 0.88 def_telemetry recall 1.00 -> 1.00, precision 0.20 -> 1.00 (oracle fix) Scan CPU 51.92s -> 51.91s user (7.51s -> 7.53s wall). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…8862) Regenerated with `crucible_check.py --update --yes` in this checkout's own full-precision and zero-dependency venvs (GITGALAXY_DISABLE_GIT_HISTORY=1). 13 files per fixture changed. Why the output changed: the Python `cleanup` rule now counts `with`, `finally:`, `del` and rmtree/unlink/remove calls (contract: #8862), so Python functions that were 0 now score, which moves their archetype and fingerprint inputs. Every file-level difference (3,566) is a .py file; the rest are repo-level aggregates that follow from it (repository fingerprint, file/function archetype distribution, resource_cleanup_close_free_dispose, summary, LLM brief, gpu json). Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
squid-protocol
marked this pull request as ready for review
November 25, 2026 01:28
… on drafts) Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Contributor
squid-protocol
added a commit
that referenced
this pull request
Nov 25, 2026
Merged origin/main (incl. #9263's Python bless) and the Go time/sleep branch (#9265), took main's fixtures for the conflicts, and regenerated with crucible_check.py --update --yes in clean venvs. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ
squid-protocol
added a commit
that referenced
this pull request
Nov 25, 2026
…racts name (Part of #8868) (#9267) * Go thread_sleeps counts timer constructors; Go time oracle follows the contract (Part of #8868, #8863) Re-measured the Batch A rows of #8868 against origin/main (tokio, retrofit, redis, prometheus): Rust, Java and C `time_date_logic` recall are already 1.00 (the old gaps were fixed since). Go `time_date_logic`'s 0.77 recall was the oracle reading `time.After` / `NewTicker` / `Tick` / `NewTimer` as time; the contract puts timed waits under thread_sleeps, so the oracle now lists clock, calendar and duration forms only (Go time recall 1.00). The real gap was Go `thread_sleeps` (#8868 contract: "a sleep, a timed wait, a timeout-driven deferral"): it missed `time.NewTicker`, `Tick`, `NewTimer`, `AfterFunc`. Now counted: prometheus recall 0.89 -> 1.00, precision 0.99. language-crucible Go: 2 -> 3 functions fire. Scan CPU unchanged (5.5 s user, three alternating runs). Goldens re-blessed with crucible_check.py --update --yes in clean venvs: 6 files per fixture, all 18 file-level differences are .go. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * Go time_date_logic no longer counts time.Sleep (owner decision, Part of #8868) The contract files a sleep under thread_sleeps ("a sleep, a timed wait"); a clock, calendar value or duration is time_date_logic. prometheus Go time_date_logic precision 0.69 -> 0.79 (recall 1.00). Goldens re-blessed in clean venvs. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> * #8868 Batches B and C: Go/C/Rust/JS/TS rules count what their contracts name (Part of #8868, #8863) Batch B (contract-named misses), after re-measuring each row on origin/main: - C panics_and_aborts: `return -1` (an error return, not an abort) no longer counts; `_exit` does. - Go io: http.Get/Post/..., net.Listen/Dial. - Rust io: `fs::read/write/...` after `use std::fs;`. - Oracle: C no longer reads close/fclose as io (cleanup's, per the contract and the rule's own comment); Rust no longer reads a bare `exit` (`span.exit()` is a method call, not a process exit). Batch C (precision, causes traced): - Go closures: the rule matched method declarations `func (s *S) Name() {`; now function literals only. - Rust closures: also `|x| x + 1` and `move |x|`, anchored where an expression starts. - Rust short_circuit: `||` after `(`/`,`/`=`/`move` is a no-argument closure and `&&T` is a reference type; an operator counts when an operand ends right before it. - JS/TS time_date_logic: setTimeout/setInterval/clearTimeout/clearInterval are timed waits (thread_sleeps), not clock values (same ruling as Go time.Sleep); setImmediate joins thread_sleeps. - TS io: same operative-form rule as JS (bare path/http/sql/database are everyday words). Goldens re-blessed with crucible_check.py --update --yes in clean venvs; unmodified origin/main re-blesses with 0 changed files, so every moved entry is attributable to this change. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ * Re-bless golden masters on the merged base (Part of #8868) Merged origin/main (incl. #9263's Python bless) and the Go time/sleep branch (#9265), took main's fixtures for the conflicts, and regenerated with crucible_check.py --update --yes in clean venvs. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ * Re-bless golden masters after merging main again (Part of #8868) Main moved four commits; only the golden fixtures conflicted, so main's were taken and regenerated with crucible_check.py --update --yes in clean venvs. Same files and languages as the previous bless. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ * Update the tests that encoded the old time/sleep behavior; re-bless the two Rust DOOM ports (Part of #8868) CI on #9267 found four real consequences of the intended rule changes: - test_go_java_leading_boundary_4108: time.Sleep no longer counts as time (it is a timed wait); the case moves to a "timed waits are not time" test (time.Sleep, time.After, NewTicker). - test_rule_overlap_guard_8010: setTimeout is now shared by concurrency+thread_sleeps only (it left time_date_logic). - test_typescript_strict (double-classification sweep): clearTimeout is cleanup alone; setTimeout is not time. - DOOM-rosetta goldens for room4doom and rust-doom: the Rust closure / short_circuit rules change the complexity inputs, so 56+ function hashes move (109 file-level changes, no verdict change). Unmodified origin/main checks clean on both ports, so the drift is this change's. Blessed with doom_rosetta_check.py --only room4doom,rust-doom --update --yes. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ * family_sweep_nightly: check the platform so the shell-spawn guard passes (Part of #8863) #9291 merged with `bash heavy-run.sh` in a subprocess and no platform check, so tests/test_shell_tests_platform_guard.py fails on main and on every PR's merge ref. The nightly is a Linux-box job (heavy-run.sh needs flock(1)); on any other platform it now says so and exits 0. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_018srRvgGYqVYmsdY3wcgsrQ (cherry picked from commit 0177861) --------- Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
What this does
Two Python keyword-family fixes from the ratified #8862 contracts (epic #8863).
cleanup(engine rule). The rule counted call forms only (close(,shutdown(, ...). The contract also names the opener of a guaranteed-teardown region anddel, sowith,try/finallyanddelwere missed. The rule now countswith x:/with f(..),finally:,del x, andrmtree/unlink/rmdir/removedirs/removecalls.telemetry(oracle, not engine). The reported 0.28 precision was the oracle's error: it read only a barelogger.x(..)receiver and ignoredself.logger.x(..). The engine rule was already right; the oracle now reads the receiver's last name.Measured (self-scan of
gitgalaxy/, 3,720 Python functions, oracle =ast)def_cleanupdef_telemetryScan CPU: 51.92 s -> 51.91 s user (wall 7.51 s -> 7.53 s). One repository, one oracle: exploratory, not a quotable L2 number.
keyword-rosetta and language-crucible (measured 2026-11-24)
data/python(3,905 functions), 3 alternating runs, full-precision venv: engineorigin/main24.39 / 24.39 / 24.04 s user (mean 24.27); this branch 24.09 / 24.36 / 24.15 s (mean 24.20). No cost.def_cleanup > 0: 29 -> 330 (site total 29 -> 439);def_telemetryunchanged at 3.tools/rebless.py python --dry-runagainst both engineorigin/mainand this branch: nothing moved (the planted corpus only hasconn.close()). Norosetta:rebless-owedfor Python.pytest -m golden_crucible): fails on this branch with 13 extra Graph SQLite mismatches inpython/*artifacts (the new cleanup counts). My shared venv drifts on unmodifiedorigin/maintoo, so I did not bless from it. Instead I ran the documentedcrucible_check.py --update --yesin this checkout's own clean venvs (second commit): 13 files per fixture changed; all 3,566 file-level differences are.pyfiles, the rest are repo-level aggregates that follow from them (fingerprint, archetype distribution,resource_cleanup_close_free_dispose, LLM brief). CI'scrucible-auditis the independent check of that bless.Still open
with/deltext inside strings and comments (documented prism/detector: string-literal shielding is selective by signal family (if/try/open count inside a literal, eval does not) #2535 behaviour; literal shielding is the separate ratified decision).ruff format --checkflags one pre-existing line infamily_oracle.py(not touched here).Tests: new
tests/test_python_cleanup_rule.py; 579 related tests pass.🤖 Generated with Claude Code