rebless: state_mutation contract — writes, not declarations (gitgalaxy#2765, Phase 3) - #79
Merged
Merged
Conversation
…xy#2765, roadmap Phase 3) gitgalaxy#2765 gave state_mutation a stated contract: one hit is a statement that writes a new value into state that already exists. A declaration is not a write (even `var`/`let mut`/`int x = 5`), a type naming mutable state is not a write, a read/bind/cast is not a write, and a token another rule owns is not a second signal. 30 engine rules were rewritten to it (gitgalaxy PR #2818). Cells that moved because the rule was wrong: haskell a.hs 2->0 (IORef type signatures), dockerfile a 2->0 (ENV is globals), c a 2->0 / b 3->2, go b 5->2, objective-c b 3->2, perl b 3->2 / c 1->0, m4 c 2->0 (popdef is cleanup), apex c 1->0 (.clear( is cleanup), matlab c 1->0 and b cleanup 2->0 (clear is cleanup). Plants authored to the old rules, re-planted as real writes: cpp, java, javascript, kotlin, rust, scala, swift, typescript, zig (mutable declarations -> `first = 1; first = 2`), solidity (payable() cast -> `items = 1`), sqlite (UPDATE...SET counted twice -> ALTER TABLE as the second statement), abap (the `=` statement joined the rule; APPEND dropped), livecode/scheme/tcl (the decoy line was a third write; one plant removed). probe_debt bodies in abap/fortran/ matlab/powershell assigned into languages with no declaration syntax and carried a state_mutation into a file planted at 0; they now declare or return instead. Ledger: new `state-mutation-contract-2765` (upstream-bug, resolved, verifying scan 46/46 against gitgalaxy fix/2765-state-mutation-contract); `batch4-dual-keyword-overlaps` loses matlab and m4 (their only duals retired). tools/screen_plant.py honours $GITGALAXY_PATH so a branch worktree can be screened. Cross-repo: gitgalaxy#2818 merges first; this goes green once engine main carries it. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…2765-state-mutation-contract state_mutation reads 2 in all 43 comparable languages (was 16 of 43 open defects); risk_state_flux open-defect share 0/45; corpus open-defect share 79 -> 62 of 2303 (3.4% -> 2.7%); average consistency 88% -> 90%. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
Re-bless for gitgalaxy#2765 (the
state_mutationcontract, roadmap #2812 Phase 3). Engine PR: squid-protocol/gitgalaxy#2818.What the contract says
One hit is a statement that writes a new value into state that already exists. A declaration is not a write (even
var/let mut/int x = 5/go:=); a type or modifier naming mutable state is not a write; a read, bind or cast is not a write; one statement is one hit and a token another rule owns is not a second signal.docs/state_mutation_rule_contract.mdin gitgalaxy has the corollaries and the 46-language audit.What moved here, and why (every cell is in the ledger entry
state-mutation-contract-2765)Cells that moved because the rule was wrong (no plant change): haskell a.hs 2->0 (
IOReftype signatures), dockerfile a 2->0 (ENVisglobals), c a 2->0 / b 3->2 (declarations), go b 5->2 (:=,_ = x), objective-c b 3->2, perl b 3->2 / c 1->0 (my, bareshift), m4 c 2->0 (popdefiscleanup), apex c 1->0 (.clear(iscleanup), matlab c 1->0 and b cleanup 2->0 (clear/clearvarsarecleanuponly -- matlab's corpus cleanup now sits on the median).Plants authored to the old rules, re-planted as real writes: cpp, java, javascript, kotlin, rust, scala, swift, typescript, zig (
var first = itemsx2 -> one declaration +first = 1/first = 2), solidity (payable(items)is a cast ->items = 1), sqlite (UPDATE ... SEThad counted twice ->ALTER TABLE corpus RENAME TO corpus_stateis the second statement;iostays 3), abap (the=statement joined the rule,APPENDdropped), livecode/scheme/tcl (the decoy line was already a third write; one plant removed). Theprobe_debtbodies in abap/fortran/matlab/powershell assigned into languages with no declaration syntax and carried astate_mutationinto a c file planted at 0; they declare or return now. Every replacement was screened as a pair against the branch rules; the only unplanted side effect is java'sAtomicIntegerno longer carrying aconcurrency1.Ledger: new
state-mutation-contract-2765(upstream-bug, resolved, verifying scan 46/46 againstfix/2765-state-mutation-contract);batch4-dual-keyword-overlapsloses matlab and m4 (their only itemised duals were retired) and records jclSETas the one state_mutation dual that stays.tools/screen_plant.pynow honours$GITGALAXY_PATH.Still narrower than the contract, by design for now: python/embedded_python/ruby never count a plain local re-assignment -- gitgalaxy#2817, not a red cell.
Effect (regenerated at full precision against the branch)
state_mutationreads 2 in all 43 comparable languages -- 0 out-of-band cells, down from 16 open defects (37%);risk_state_fluxopen-defect share 0 of 45. Corpus open-defect share 79 -> 62 of 2303 cells (3.4% -> 2.7%); average consistency across 49 metrics 88% -> 90%.decoy_check.py --gateandna_check.pyclean.Cross-repo
gitgalaxy#2818 merges first;
verify.ymlhere checks out engine main, so this PR is red until then and green by construction after.bias-history.ymlregenerates the report and chart on merge (the locally regenerated artifacts are included so the effect is visible in the diff).