Skip to content

immutability_locks contract (#2772, rule half): the ordinary binding keyword is not a lock - #2891

Merged
squid-protocol merged 2 commits into
mainfrom
fix/2772-immutability-locks-contract
Sep 8, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/2772-immutability-locks-contract

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

Phase 3 family (#2812). Sheet row immutability_locks draft → stated (15/68):

One hit is an added marker or lock call that prevents a binding or value from being changed after initialisation, where the language's default would permit it — a modifier or qualifier on an otherwise-mutable declaration, a restricted constant-declaration form distinct from the general-purpose binding, a runtime lock call, or an immutable reference pin; the language's ordinary binding keyword is a binding choice, not a lock, and a language whose bindings are immutable by default records the stated absence (docs/immutability_locks_rule_contract.md).

The signal is unplanted and ungated but is the half-weight subtrahend in _calc_state_flux — the corpus's worst gated metric — and its low tail was entirely this rule: swift −62%, kotlin/scala/typescript −46% against the median, on identical planted mutations, because the shell was written with let/val/const instead of var. The rule was inverted between the two languages making the same guarantee: rust's immutable-by-default let was invisible while swift's let scored 11. This contract takes the issue's drop-side resolution: a hit must be a deliberate act distinguishable from simply declaring a variable.

16 rules edited

  • C1 ordinary bindings out, added forms stay: js const 2002 → 0 (freeze/seal stay), ts 6041 → 2617 (readonly/as const/freeze stay), scala val 1151 → 2 (final val/immutable.* stay), dart final 1768 → 235 (const/@immutable stay), kotlin val 39 → 0 (const val stays).
  • C2 non-data locks out: solidity view/pure (purity, 63 → 8), html disabled/inert/aria-disabled (interactivity, 76 → 8; readonly stays), abap FINAL (hierarchy).
  • C3 names out: shell's echo'd-HTML readonly='readonly' (88 → 65, command position now), cobol hyphenated AN-CONSTANT (guards, 15 → 10), powershell pattern strings (6 → 0, the -Option Constant/ReadOnly act stays), rust &'static lifetimes and *const pointers (153 → 40; const/static items stay).
  • C4 immutable-by-default → None + stated absence: haskell (its rule counted monadic return — 84 hits, all noise), swift, zig (whose const is the binding form for everything, 16468 crucible hits) — the io/solidity precedent; _calc_state_flux already treats a missing signal as 0, exactly how rust always read.
  • C5: scheme's 987 datum quotes are literal syntax (string->immutable-string stays).

Corpus idiomatic residue after: js 17→0, ts 14→0, swift 11→n/a, kotlin 6→0, scala 3→0, zig 3→n/a, dart 2→0, abap 1→0 — the mitigation term is now ~uniform, so the state-flux low tail collapses toward the median with no formula change. The formula half of #2772 (raw-count subtraction vs a ratio) stays open for Phase 4; this PR does not close the issue.

Verified

  • rule_probe before/after per language is the doc's audit table.
  • Golden masters re-blessed; bless_scope: Immutable Data Declarations + State Flux Exposure/state_flux (the one consumer) only; newly parsed/excluded none — the single queue diff is a 0.1-point identity-confidence drift on an already-excluded extensionless sconstruct.
  • rosetta_audit vs the corpus branch (which includes kr#106's base): 46/46, 0 regressions. Full gauntlet green at baseline; ruff/mypy/dead-key/audit_check clean; signal_contract_audit --ci green, baseline 54.
  • Contract pins: tests/extraction/languages/test_immutability_locks_contract_2772.py (24 tests incl. the three stated absences and a ReDoS sweep).

Cross-repo

Corpus PR: squid-protocol/keyword-rosetta#107 (ledger record only — the input is unplanted, no manifest moves; branch includes kr#106's base, so merge kr#106 → this engine PR → the corpus PR). bias-history.yml re-runs after.

Part of #2812 (does not close #2772 — the formula half is Phase 4's).

🤖 Generated with Claude Code

https://claude.ai/code/session_012zPD39y58Bfrr2Q45Z6djL

…keyword is not a lock

One hit is an added marker or lock call that prevents a binding or value
from being changed after initialisation, where the language's default would
permit it -- a modifier or qualifier, a restricted constant form distinct
from the general-purpose binding, a runtime lock call, or a reference pin;
a language whose bindings are immutable by default records the stated
absence (docs/immutability_locks_rule_contract.md).

The rule was inverted between the two languages making the same guarantee:
rust's let invisible, swift's let scoring 11 -- and the signal is the
subtrahend in _calc_state_flux, whose low tail (swift -62%, kotlin/scala/
ts -46% on identical planted mutations) was entirely this. 16 rules edited:
C1 ordinary bindings dropped (js const 2002->0, ts 6041->2617, scala val
1151->2, dart final 1768->235, kotlin val 39->0), C2 non-data locks dropped
(solidity view/pure 63->8, html disabled/inert 76->8, abap FINAL), C3 names
dropped (shell echo-string readonly 88->65, cobol hyphenated CONSTANT,
powershell pattern strings, rust 'static lifetimes and *const 153->40),
C4 haskell (counted monadic return, 84)/swift/zig -> None + stated absence,
C5 scheme datum quotes (987->0). Corpus residue: every edited language's
idiomatic count -> 0/n-a; the state-flux mitigation term is now ~uniform.

The formula half of #2772 (raw-count subtraction vs a ratio) stays open for
Phase 4; this PR does not close the issue.

Golden masters re-blessed; bless_scope: Immutable Data Declarations +
State Flux Exposure/state_flux only; newly parsed/excluded none (one 0.1pt
identity-confidence drift on an already-excluded extensionless sconstruct).

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012zPD39y58Bfrr2Q45Z6djL
@squid-protocol squid-protocol added the rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

The label turns audit regressions into warnings but na_check --ci stayed a
hard gate, so a label-declared rule absence (#2772's haskell/swift/zig None,
ledgered in the cross-linked corpus PR) sat red: the workflow checks the
corpus out at MAIN, where the reviewing ledger entry cannot exist yet by
construction. Under the label a new absence is now a warning; the corpus
PR's own na_check (verify.yml) still gates the entry's merge, so nothing
can be nulled quietly.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_012zPD39y58Bfrr2Q45Z6djL
@squid-protocol
squid-protocol merged commit 7a34e7d into main Sep 8, 2026
32 checks passed
@squid-protocol
squid-protocol deleted the fix/2772-immutability-locks-contract branch September 8, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rosetta:rebless-owed Intentionally moves keyword-rosetta counts; audit warns, corpus re-blesses after merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

immutability_locks has no contract: rust's let is invisible while swift's let scores 11 — and it is subtracted from the corpus's worst gated metric

1 participant