Repository navigation
Description
Part of #2560 — per-language tracking for the keyword-rosetta control corpus (built for #1096). Planted intent is identical in every language, so every deviation below is measured bias vs. the 46-language median, validated in the corpus's deviation ledger. 🔴 = beyond ±50% of the cross-language median, 🟡 = ±25–50%.
Triage order (per the epic): structure detection first, then signal/keyword rules, then risk-score consequences — §3's numbers are downstream of §1–§2 and re-baseline as those fix. Cross-cutting engine issues (e.g. #2535/#2546) fix many languages at once; this issue tracks this language's residual after each cross-cutting fix lands, and closes when the language sits inside the ±25% band on every comparable metric (or every remaining deviation is ledgered as intended morphology).
1. Structure detection (fix first)
In band — no structure-level deviations.
2. Signal / keyword deviations
- 🔴
comment_lines: 52 vs median 30 (+73%) - 🔴
doc: 2 vs median 1 (+100%) - 🔴
io: 6 vs median 3 (+100%) - 🔴
state_mutation: 2 vs median 6 (-67%) - 🟡
safety: 3 vs median 2 (+50%) - 🟡
test: 3 vs median 2 (+50%)
3. Risk-exposure consequences (downstream)
- 🔴
risk_cognitive_load: 4.821 vs median 15.1444 (-68%) - 🟡
risk_api_exposure: 7.35003 vs median 5.31104 (+38%)
Ledgered shapes touching python
| defect | type | issue | evidence | summary |
|---|---|---|---|---|
api-contextual-baseline-fix |
engine-semantic | #2536 | — | galaxyscope.py ~2145 ('THE CONTEXTUAL BASELINE FIX'): a file imported by others (popularity > 0) has orphaned_logic converted into api before recording |
census-requires-git-tracked |
engine-semantic | — | — | GalaxyScope's census enumerates git-tracked files only; an untracked folder scans as '0 files mapped' with no per-file warning |
assert-overlaps-safety-and-test |
keyword-overlap | — | — | python's test rule includes \bassert\b and the safety rule includes assert: one planted assert counts both |
os-sys-prefix-overlaps-io |
keyword-overlap | — | — | python-family io rule matches the os./sys |
string-literal-selective-shielding |
upstream-question | #2535 | — | Keywords inside one string literal ('if eval fails, try open') count toward branch (+2), safety (+1), io (+1) but eval does NOT count toward high_risk_execution (routes … |
Decoy outcomes (file-level evidence)
- main.py ·
never calls eval and no while loop(comment): stripped: contributed 0 (prism comment stripping works) - a.py ·
could open a socket in prose only(comment): stripped: contributed 0 - a.py ·
MESSAGE = "if eval fails, try open"(string): PARTIAL: if/try/open COUNT from inside the literal (branch +2, safety +1, io +1, baked into a.py expectations) but eval does NOT (feeds sec_tainted_injection instead) — literal shielding is selective by signal family; candidate upstream issue - b.py ·
the try keyword stays in prose(comment): stripped: contributed 0 - c.py ·
HACK_LEVEL = level(code): reverse decoy works: identifier did not count, the # HACK comment did (fragile_debt = 1 exactly)
Reproduce / evidence
- Corpus folder:
data/python/—expected_signals.jsoncarries the shape-by-shape accounting - Gate:
GALAXYSCOPE_BIN=<venv>/bin/galaxyscope python tools/verify_language.py pythonin the corpus repo - Full context: findings_by_language.md#python · bias_report.md · bias chart
Activity
fix(python): stop io/test rules double-counting globals/safety keywor…
squid-protocol commentedon Sep 1, 2026
Sweep update (2026-08-31)
Worked via the
rosetta-language-sweepskill's five-cause taxonomy. Live numbers before starting(
tools/language_deviations.py python) didn't quite match this issue's original body —comment_lineswas red live but not listed in §1 above; treated the live numbers as authoritative per the skill's
guidance.
Before → after: 5🔴 / 3🟡 → 4🔴 / 3🟡 (37 comparable metrics).
Fixed (bucket 1: real engine bug)
io: 6 → 4 (median 3).os\./sys\.matched ANY attribute access, overlappingglobals'own
os.environ/sys.argv/sys.path— a planted globals read was double-counted asiotoo.Negative lookaheads now carve out exactly those three tokens.
test: 3 → 2 (median 2, now in-band).\bassert\bwas double-counted by bothsafetyandtest— a bareassertis a validation signal, not a testing-framework signal. Removed fromtest.review). Corpus re-baseline: keyword-rosetta#13.
Ledger:
os-sys-prefix-overlaps-io(resolved for python),assert-overlaps-safety-and-test(python removed from
languages_seen, still reproduces for c/perl).Not fixed — bucket 5 (median inflation elsewhere, python is honest)
safety: 3 vs median 2 (+50%) — matches planted intent (3) exactly.state_mutation: 2 vs median 6 (-67%) — matches planted intent (2) exactly; the median isinflated by the ×3 flux weighting in other languages (#2546).
No python action; re-baselines when state-flux ×3 branch-context weighting: undocumented, and phantom-triggered by branch keywords inside string literals #2546 lands.
Not fixed — out of scope for this pass, filed separately
doc: 2 vs median 1 (+100%) — the"""/'''docstring pattern counts both the opening andclosing delimiter as separate matches. Related to the string-literal-shielding upstream question
(#2535); not re-investigated here.
comment_lines: 52 vs median 30 (+73%), new finding, not python-specific: filed as#2625 —
comment_lines=total_loc − coding_loc,but
total_locincludes blank lines whilecoding_locdoesn't, so blank lines get folded into"documentation" engine-wide. Python's corpus shells just have a higher blank-line ratio than most
language shells, so it surfaces loudest here (jcl's own §10 capstone independently noted the same
root cause for its
comment_linesresidual).risk_api_exposure/risk_cognitive_load(§3): downstream shadows of the above; not chasedindividually per the epic's rule.
Remaining blocked on
safety/state_mutation: cross-cutting state-flux ×3 branch-context weighting: undocumented, and phantom-triggered by branch keywords inside string literals #2546.doc: string-literal shielding question prism/detector: string-literal shielding is selective by signal family (if/try/open count inside a literal, eval does not) #2535 (if that lands, re-measure before assumingdocis still a real bug).
comment_lines: new cross-cutting comment_lines conflates blank lines with real documentation (engine-wide, found via #2593) #2625 (engine-widetotal_loc/coding_locblank-line fix).Closing criterion: not met yet —
iois now amber (not green),safety/doc/comment_linesremain out of band, all blocked on cross-cutting issues rather than anything left to do in python's
own rule file. Leaving this issue open pending #2546/#2535/#2625; re-run
tools/language_deviations.py pythonafter any of those land to see if python re-baselines intoband on its own.
docs(language-status): python §11 rosetta consistency capstone (#2593 …
squid-protocol commentedon Sep 1, 2026
Choreography completed (2026-09-01)
Follow-up to the sweep update above — the cross-repo loose ends are now closed:
rewritten branch; its only remaining delta vs main would have reverted rosetta#11's skill
update.
ENGINE_REFstill atpull/2626/head(therestore-to-main step was skipped). chore(deps): bump actions/checkout from 4 to 6 #14 restores it — and fixes the CI gap it exposed:
verify.yml's path filter didn't includeENGINE_REF, so a pin-only PR ran zero gates.It now triggers the full 46-gate sweep (which chore(deps): bump actions/checkout from 4 to 6 #14 then passed against engine main).
KEYWORD_ROSETTA_REFbumped to657ed07(rosetta main post-chore(deps): bump actions/checkout from 4 to 6 #14); rosetta-auditdispatched on main against the new pin as the end-to-end proof.
docs/language_status/python.md§11).Issue state unchanged per the close-criterion note above: stays open, blocked on the
cross-cutting fixes (#2546 safety/state_mutation medians, #2535 doc, #2625 comment_lines) —
re-run
tools/language_deviations.py pythonafter any of those land.squid-protocol commentedon Sep 3, 2026
Status: 1🔴 / 2🟡 unexplained, 5 further out-of-band cell(s) accounted for
Generated from
docs/bias_data.json+deviation_ledger.jsonbytools/issue_status.py, using the same verdict machinerybias_report.py --gateruns on (gitgalaxy#2669 E.1), so this comment and the gate cannot disagree about what is left.Still unexplained — the work this issue tracks
keyword_hitsbetweenness_scorerisk_api_exposureOut of band, but accounted for
ledgered — a validated ledger entry names this language and this metric
cog_raw— composite-nonlinearity-amplifies-in-band-inputscontrol_flow_ratio— control-flow-ratio-denominator-is-a-vocabulary-tallyrisk_cognitive_load— path-and-extension-modifiersrisk_documentation— path-and-extension-modifiersstructural_mass— composite-nonlinearity-amplifies-in-band-inputsClose criterion (gitgalaxy#2669 Batch E.4)
python tools/language_deviations.py pythonexits 1: 3 unexplained cell(s) remain. Each needs a fix, or a validated ledger entry saying why it is correct, before this issue can close.squid-protocol commentedon Sep 6, 2026
Closed 2026-09-06 as superseded by #2812 (
docs/contract_roadmap.md, decision D2). Every out-of-band cell for python is accounted for (the gate reads 0 unexplained) and is now tracked by cause family, not by language: the ledger entry that explains it, its cause category in keyword-rosetta'sdocs/bias_data.json["cell_categories"](echo / inherency / extraction / correlation / scoring), and the family issue #2812 lists for that cause. Live standing at any time:python tools/language_deviations.py pythonin keyword-rosetta, ordocs/findings_by_language.md#python.This is a change of axis, not a claim that python is green. The §10 capstone in
docs/language_status/python.mdis written when the language reads clean bylanguage_deviations.py, by whichever family PR gets it there — no longer tied to this issue.