Repository navigation
Description
Batch B.4 of #2669. Four post-Batch-A residual cells on io / safety_bypasses turn out to be one shape, and all four are regex-level — B.3 material. Corpus-side residuals from the same triage go to keyword-rosetta separately.
The shape
A rule claims a token that another rule already owns, or matches a token in a form too broad to mean what the rule means. Same family as #2659 (doc claiming what ownership owns) and #2544 (a guard that does not guard).
Every one of the four lands exactly on the planted value, and in every case the token removed is still counted by its owning rule, which stays at its own planted value.
| language | signal | now | fixed | planted | token claimed | owned by |
|---|---|---|---|---|---|---|
| livecode | safety_bypasses |
4 | 2 | 2 | global\s+ |
globals |
| lua | safety_bypasses |
4 | 2 | 2 | _G, _ENV / collectgarbage |
globals / cleanup |
| fortran | safety_bypasses |
3 | 2 | 2 | COMMON |
globals |
| dockerfile | io |
5 | 3 | 3 | bare apt-get/apk/yum/dnf |
— (over-broad form) |
1. livecode safety_bypasses claims global
r"\b(disable\s+messages|unlock\s+(?:screen|messages)|global\s+)\b|\bdo\s+(?![a-zA-Z_]\w*\b)"disable messages, unlock screen and dynamic do are genuine bypasses. global is a scope declaration, and globals owns it exclusively (\b(global\s+|the\s+global|…)\b). The corpus's probe_globals plants two global declarations in a.lc, and each scores safety_bypasses as well — the entire +2.
Fix: drop the global\s+ alternative.
r"\b(disable\s+messages|unlock\s+(?:screen|messages))\b|\bdo\s+(?![a-zA-Z_]\w*\b)"2. lua safety_bypasses claims _G/_ENV and collectgarbage
r"\b(rawget|rawset|rawlen|debug\.[a-zA-Z0-9_]+|collectgarbage|_G|_ENV|getfenv|setfenv)\b"rawget/rawset/rawlen/debug.*/getfenv/setfenv are real bypasses (they defeat metatables or the environment). The other two are not:
_G/_ENV— a bare reference to the global table.globalsowns it (\b(_G|_ENV|_VERSION|arg)\b).probe_globalsina.luacontributes +1.collectgarbage— GC control, not a safety bypass.cleanupowns it (\b(ffi\.C\.free|collectgarbage|io\.close|:[ \t]*close)\b).probe_cleanupinc.luacontributes +1.
Fix: r"\b(rawget|rawset|rawlen|debug\.[a-zA-Z0-9_]+|getfenv|setfenv)\b"
3. fortran safety_bypasses claims COMMON
r"\b(COMMON|EQUIVALENCE|IMPLICIT\s+(?:REAL|INTEGER|CHARACTER|COMPLEX|LOGICAL|DOUBLE))\b"EQUIVALENCE and implicit typing are genuine type-safety bypasses. COMMON is a global storage block and globals owns it (\b(COMMON|SAVE|EXTERNAL)\b). probe_globals in a.f90 contributes the +1.
Fix: r"\b(EQUIVALENCE|IMPLICIT\s+(?:REAL|INTEGER|CHARACTER|COMPLEX|LOGICAL|DOUBLE))\b"
4. dockerfile io counts package-manager cleanup as io
r"^[ \t]*(?:COPY|ADD)[ \t]+|\b(?:wget|curl|apt-get|apk|yum|dnf|git[ \t]+clone|…)\b"The bare package-manager names are there to catch a network fetch (apt-get install). They also match RUN apt-get clean and RUN yum clean all, which touch no network and no external file — they delete a local cache. cleanup owns those exact phrases (apt-get[ \t]+clean, yum[ \t]+clean[ \t]+all, apk[ \t]+(?:cache[ \t]+)?clean). The corpus's probe_cleanup in c.dockerfile is exactly RUN apt-get clean + RUN yum clean all, the whole +2.
Fix — require a subcommand and exclude the clean forms:
r"^[ \t]*(?:COPY|ADD)[ \t]+"
r"|\b(?:wget|curl|git[ \t]+clone|tar[ \t]+-[cx]f|unzip|pip[ \t]+install|npm[ \t]+install)\b"
r"|\b(?:apt-get|apk|yum|dnf)[ \t]+(?!clean\b|cache[ \t]+clean\b)[a-z-]+"Behaviour on constructed cases, all as intended:
| line | now | fixed | want |
|---|---|---|---|
RUN apt-get update && apt-get install -y git |
2 | 2 | 2 |
RUN apk add --no-cache curl |
2 | 2 | 2 |
RUN yum install -y vim / RUN dnf install -y vim |
1 | 1 | 1 |
RUN apt-get clean |
1 | 0 | 0 |
RUN yum clean all |
1 | 0 | 0 |
RUN apk cache clean |
1 | 0 | 0 |
Real-world check on the 71 language-crucible Dockerfiles: io 94 → 93 — it removes exactly one genuine apt-get clean and nothing else. ReDoS probe (200k chars after RUN apt-get ): 0.0032s.
Verification
Run through the real prism.split_streams, both streams, over keyword-rosetta data/<lang>/ at corpus 357345f:
language.signal now fixed planted
livecode.safety_bypasses 4 2 2 ok
lua.safety_bypasses 4 2 2 ok
fortran.safety_bypasses 3 2 2 ok
dockerfile.io 5 3 3 ok
livecode.globals unchanged at 2 lua.globals unchanged at 2
lua.cleanup unchanged at 2 fortran.globals unchanged at 2
dockerfile.cleanup unchanged at 2
Four red/amber cells → green, no owning rule disturbed.
Scope
Registry-regex layer only — same layer as #2672, #2660(go) and #2673, so it can share B.3's PR. Strict tests in tests/extraction/languages/test_<lang>_strict.py: for each, a positive (the owning rule still counts the token), a negative (this rule no longer does), and for dockerfile the six install/clean rows above.
Corpus rebless: livecode/lua/fortran safety_bypasses and dockerfile io all move to their planted value; no other signal in those four languages moves.
Activity
squid-protocol commentedon Sep 2, 2026
Two corrections from implementation. fortran is dropped from this issue — I was wrong about it — and the dockerfile real-world figure was measured over the wrong file set.
fortran: withdrawn.
COMMONfiring both rules is deliberate, documented and testedI filed fortran's
COMMONas a #2659-shape over-claim on the reasoning thatglobalsowns it exclusively. It does not.tests/extraction/languages/test_fortran_strict.py:418has held the opposite position since #1059:It is one of a documented family in that file —
concurrency/sync_lockson coarray keywords,reflection_metaprogramming/serialization_parsingonNAMELIST— all from the same ambiguity sweep. And the rationale is sound on the language: a COMMON block lets distinct program units alias the same storage with no type checking, which is a genuine unchecked-memory-sharing mechanism. That is categorically different from livecode'sglobal(a scope declaration) or lua's bare_G(a table reference), which is why those two stand.The fortran change has been reverted, and its two test edits with it — the implementation had renamed that test to
..._single_classificationand inverted its assertion, which would have silently overturned a deliberate design decision to satisfy a claim in this issue.fortran
safety_bypasses3 vs planted 2 is therefore intended morphology, not a defect:probe_globalsina.f90plants a COMMON block, which correctly double-classifies. It belongs in the ledger alongside haskell'sunsafePerformIO(same shape: the probe's required idiom is legitimately also a bypass), and I have added it to keyword-rosetta#33's ledger list.This issue is now three languages: livecode, lua, dockerfile. All three still land exactly on their planted value.
dockerfile: the "94 → 93" real-world figure was wrong
I measured over every file under
language-crucible/data/dockerfile/. That directory is a moby snapshot: 55.gofiles, 7.tar, 3 json, 2 md, and only 4 actual.Dockerfilefiles. The regex was matchingcurl/wget/apt-getinside Go source that the dockerfile rule never sees in the real pipeline.So the real-world delta is zero, not −1: this corpus contains no
apt-get clean/yum clean all/apk cache cleanat all. The fix is a no-op there, closing a false-positive class the real corpus happens not to exercise — the same situation as kotlin and swift in #2677, and worth stating plainly rather than leaving a number that looks like evidence and isn't.The fix itself is unaffected: the rosetta corpus gate confirms
io5 → 3 landing on the planted 3 with no other signal moving, and all seven constructed install/clean rows behave as specified.Same error class as the one corrected on #2676 (measuring groovy over
*.groovywhile.gradleis 40% of the sample), in the opposite direction. Both are now covered by keyword-rosetta#34's hard rule 9.fix(core-engine): Rosetta batch 3 wave 2 — doc-comment pairing, rule …
squid-protocol commentedon Sep 3, 2026
Closing: verified fixed on main.
livecode'ssafety_bypassesno longer claimsglobal tCount, which theglobalsrule owns. Landed in #2681 (Batch B.3 wave 2 of #2669), together with the lua/dockerfile members of the same over-claim family. fortran was withdrawn from the set as documented intentional double-classification.