fix(rules): widen globals residue forms + swift branch .default — closes #2859 - #2958
Merged
Merged
Conversation
…closes #2859 Residue of the globals contract (#2858, roadmap Phase 3, epic #2812). #2858 recorded a set of program-scope forms its per-language rules could not yet see as "conforming-by-absence-of-evidence" and deferred them; this widens them, each gated on a rule_probe crucible measurement, plus the one concrete misfire the issue filed against another signal. swift branch (C3, #2822): a switch `default:` is a decision but the dotted singleton accessor (`FileManager.default`, `.default`) is not -- it is io/events' hit. The `(?<!\.)` guard is the mirror of the fix #2858 made on globals' side. Crucible 781 -> 759. globals wideners (contract C1 unless noted): - go: `var (`/`const (` group members are indented, invisible to the column-0 anchor. The middle arm over-matches indented declaration-shaped identifier lines and a new `go_declaration_group` scope filter (detector.py, the scheme `_scope_filters` shape) keeps only members directly inside a column-0 group, dropping struct-literal fields and body statements. `\b(?![\w.(])` stops the over-match shadowing a same-line os.* handle. 105 -> 237. - java/csharp: any class-static FIELD, not just `public ... SCREAMING_CASE =`; the `[=;]` terminator excludes methods and `static {}`/auto-property blocks. 8 -> 22, 0 -> 5. - dart: `static var` and column-0 `late final`. - assembly (C4 continuation): the label-on-its-own-line two-line form (`msg:` then `.asciz` on the next line). 226 -> 478. - tcl (C3): `(?<!\$)` drops the `$global` variable read, keeps `global NAME...`. - agc_assembly: the dead `ERASABLE MEMORY`/`FIXED MEMORY`/`WORKING-STORAGE` prose and the routine-label `COMMON` out; `NAME ERASE` (erasable allocation) in. The `EQUALS`/`=` equate is a constant binding (C2) and a rosetta decoy, so it stays out. 25 -> 23. - lua: unchanged -- the SCREAMING_CASE arm is a deliberate state_mutation dual. Golden masters regenerated (both legs); contract docs' audit tables and deferred-residue sections updated; cross-language contract-test pins and the go scope-filter tests added. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9vXSpVqnMQfdxPREA2Z2Z
Contributor
ruff-audit (pinned 0.16.0): reflow two contract-test lists/quotes to ruff format, and collapse the go filter's closer branch to a single `elif c in ")}]" and stack:` (SIM102). No behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N9vXSpVqnMQfdxPREA2Z2Z
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.
Residue of the
globalscontract (#2858, roadmap Phase 3, epic #2812). #2858 recorded a set of program-scope forms its rules could not yet see as conforming-by-absence-of-evidence and deferred them; this widens them — each gated on arule_probecrucible measurement — plus the one concrete misfire the issue filed against another signal.swift
branch.default(C3, #2822)A switch
default:is a decision, but the dotted singleton accessor (FileManager.default,.default) is not — it is io/events' hit. The(?<!\.)guard is the mirror of the fix #2858 made on globals' side. Crucible 781 → 759.globals wideners (contract C1 unless noted)
var (/const (group members via a newgo_declaration_groupscope filter (over-match indented lines, keep only members directly inside a column-0 group; struct fields & body statements drop).\b(?![\w.(])stops the over-match shadowing a same-lineos.*handlepublic … SCREAMING_CASE =;[=;]excludes methods andstatic {}/auto-property blocksstatic varand column-0late finalmsg:⏎.asciz)(?<!\$)drops the$globalread, keepsglobal NAME…ERASABLE MEMORY/FIXED MEMORY/WORKING-STORAGEprose and routine-labelCOMMONout;NAME ERASEinstate_mutationdualNarrowed from the original plan: agc
EQUALS/=equates are not counted — a constant binding (C2) and a rosetta decoy; counting them would be the "widen blind" mistake #2858 warned against.Verification
rule_probebefore/after on the crucible for each language; new hits inspected — all genuine program-scope bindings, no false-positive floods.test_globals_contract_2858,test_branch_contract_2822, touched_strictsuites, fulltests/extraction+tests/core_engine).control_flow_ratiocells moved.Paired corpus re-bless
The only rosetta cell this moves vs engine main is agc
a.agc(its planted 2 wereCOMMONlabels). Re-planted onFLAGWRDreads in squid-protocol/keyword-rosetta#fix/2859-agc-globals-replant (verify_language.py agc_assembly: PASS). Labelledrosetta:rebless-owed.🤖 Generated with Claude Code
https://claude.ai/code/session_01N9vXSpVqnMQfdxPREA2Z2Z