Skip to content

rosetta[zig]: cross-language consistency — 4 red / 2 amber metrics, 5 ledgered shapes #2607

Description

@squid-protocol

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

  • 🔴 branch: 19 vs median 5 (+280%)
  • 🔴 globals: 5 vs median 2 (+150%)
  • 🟡 keyword_hits: 322 vs median 247.5 (+30%)
  • 🟡 safety: 3 vs median 2 (+50%)

3. Risk-exposure consequences (downstream)

  • 🔴 risk_api_exposure: 2.0981 vs median 5.31104 (-60%)
  • 🔴 risk_cognitive_load: 28.9992 vs median 15.1444 (+91%)

Ledgered shapes touching zig

defect type issue evidence summary
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
batch4-dual-keyword-overlaps keyword-overlap Collective entry for batch 4's finditer-confirmed dual-rule keywords, each detailed in its language's manifest notes: agc RESUME (cleanup+branch), livecode global (globa…
indented-declaration-globals upstream-question dart's and zig's globals rules match final/const/var initializations at ANY indentation — function-local declarations count as globals (dart b/c +1 each from local final…
kotlin-return-in-branch upstream-question #2545 kotlin's branch rule counts return: every file's branch = returns + real branch keywords (main.kt 8 = 5 returns + if/else/when; files with only returns record branch 3)
string-literal-selective-shielding upstream-question #2535 b.zig 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)
  • b.zig · var note = "if eval fails, try open" (string): if + try count branch (zig branch includes try AND return — pattern-confirmed: main 8 = 5 returns + if/else/switch); the var itself is a state hit and a globals hit (zig globals matches any indented var/const-with-=). var x2 raw state tripled to 6. Ledger: string-literal-selective-shielding, state-flux-branch-weighting

Reproduce / evidence

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineModifications to the central physics and parsing enginemetricsHeuristics, risk exposures, and topological math updates

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions