Skip to content

rosetta[fortran]: cross-language consistency — 5 red / 4 amber metrics, 5 ledgered shapes #2574

Closed as not planned

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

  • 🔴 doc: 2 vs median 1 (+100%)
  • 🟡 high_risk_execution: 3 vs median 2 (+50%)
  • 🟡 io: 4 vs median 3 (+33%)
  • 🟡 safety_bypasses: 3 vs median 2 (+50%)

3. Risk-exposure consequences (downstream)

  • 🔴 risk_api_exposure: 9.73064 vs median 5.31104 (+83%)
  • 🔴 risk_cognitive_load: 6.37874 vs median 15.1444 (-58%)
  • 🔴 risk_safety_score: 70.1726 vs median 37.297 (+88%)
  • 🔴 risk_state_flux: 37.3978 vs median 19.9999 (+87%)
  • 🟡 risk_documentation: 75.9927 vs median 57.1208 (+33%)

Ledgered shapes touching fortran

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
state-flux-branch-weighting engine-semantic #2546 b.f90 state_mutation is recorded x3 when branch context exists in the file ('flux' semantics, matching the state_flux column name)
fortran-goto-dual-branch-highrisk keyword-overlap — (notes) GOTO is in both fortran's branch rule and its high_risk_execution rule — one planted GOTO counts both
fortran-use-case-insensitive-dag upstream-bug #2540 (notes) 'USE A' does not resolve to a.f90 in the dependency DAG (popularity stays 0, orphan->api conversion never fires); 'USE a' resolves
string-literal-selective-shielding upstream-question #2535 b.f90 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.f90 · never uses GOTO and no DO loop (comment): stripped: contributed 0
  • b.f90 · NOTE = 'IF GOTO FAILS TRY OPEN AGAIN' (string): COUNTED like cobol: IF+GOTO (branch +2), GOTO (high_risk +1), OPEN (io +1); TRY inert (not a fortran keyword). Also triggers the flux weighting on this file's 2 assignments (state 2 -> 6). Ledger: string-literal-selective-shielding, state-flux-branch-weighting
  • c.f90 · HACK_LEVEL = LEV (code): inert (underscore tokenization, as python) — but the assignment itself counts state_mutation +1 (fortran counts every NAME = value)

Reproduce / evidence

Activity

  1. added
    metrics
    core-engine
    on Aug 31, 2026
  2. squid-protocol commented on Sep 1, 2026

    @squid-protocol
    OwnerAuthor

    Triaged this against the current engine state (tools/verify_language.py fortran in keyword-rosetta passes 73/73 assertions vs. expected_signals.json — numbers above are current, not stale). No self-contained gitgalaxy fix is actionable right now; every §2 deviation traces to one of three buckets:

    Blocked on open cross-cutting issues

    Not a bug — already reviewed and blessed as intentional

    • safety_bypasses (+50%, 3 vs 2): I initially proposed dropping COMMON from this rule (it's a plain shared-memory declaration, already captured by globals; matches how C/Ada scope this signal to genuine unsafe-reinterpretation constructs like strcpy/Unchecked_Conversion, not plain globals). That's wrong for this codebase specifically — tests/extraction/languages/test_fortran_strict.py::test_fortran_globals_vs_safety_bypasses_common_intentional_double_classification explicitly locks in COMMON firing both globals and safety_bypasses as an intentional double-classification, reviewed in Fix #581: Strict parsing tests for fortran structural signatures #764 (closing Strict parsing tests: fortran structural signatures #581). Fortran's COMMON blocks are a real legacy unchecked-memory-sharing hazard (mismatched types/sizes across files is classic UB), not just a plain global var — the prior review's call stands. Reverted my change; no fix here.

    Corpus-content question, not a gitgalaxy defect

    • doc (+100%, 2 vs 1): main.f90 plants two doc-comment lines (Author: + Description:); the doc regex correctly matches both. Other languages' corpus files apparently plant only one. This is a keyword-rosetta content question (sibling repo), not an engine bug.

    Already ledgered, no active impact

    • fortran-goto-dual-branch-highrisk: GOTO's dual role doesn't currently push branch out of band (stays in-band at 4), and matches the corpus's own hand-verified expectations (main.f90's PROBE_RISK plants GOTO+ASSIGN as the two intended high-risk hits). Removing the overlap would swing high_risk_execution further from median, not closer — leaving as-is.
    • census-requires-git-tracked: generic engine-semantic note, not fortran-specific.

    Leaving this open pending #2535 (and #2540/#2546 for the downstream §3 risk numbers) — re-run the gate once those land to see where fortran actually sits.

  3. squid-protocol commented on Sep 3, 2026

    @squid-protocol
    OwnerAuthor

    Status: 4🔴 / 0🟡 unexplained, 6 further out-of-band cell(s) accounted for

    Generated from docs/bias_data.json + deviation_ledger.json by tools/issue_status.py, using the same verdict machinery bias_report.py --gate runs on (gitgalaxy#2669 E.1), so this comment and the gate cannot disagree about what is left.

    Still unexplained — the work this issue tracks

    metric value median dev group
    🔴 risk_api_exposure 9.47 5.289 +79% risk
    🔴 risk_documentation 91.07 55.81 +63% risk
    🔴 risk_safety_score 74.52 42.05 +77% risk
    🔴 risk_state_flux 14.79 9.439 +57% risk

    Out of band, but accounted for

    derived — the deviation entered through an input that is itself out of band -- the same finding counted twice

    • avg_func_complexity — inherits branch
    • func_internal_density — inherits branch
    • structural_mass — inherits branch

    ledgered — a validated ledger entry names this language and this metric

    • branch — string-literal-selective-shielding, fortran-goto-dual-branch-highrisk
    • safety_bypasses — string-literal-selective-shielding, fortran-common-globals-safety-dual-classification
    • state_mutation — string-literal-selective-shielding, state-flux-branch-weighting

    Close criterion (gitgalaxy#2669 Batch E.4)

    python tools/language_deviations.py fortran exits 1: 4 unexplained cell(s) remain. Each needs a fix, or a validated ledger entry saying why it is correct, before this issue can close.

  4. squid-protocol commented on Sep 6, 2026

    @squid-protocol
    OwnerAuthor

    Closed 2026-09-06 as superseded by #2812 (docs/contract_roadmap.md, decision D2). Every out-of-band cell for fortran 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's docs/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 fortran in keyword-rosetta, or docs/findings_by_language.md#fortran.

    This is a change of axis, not a claim that fortran is green. The §10 capstone in docs/language_status/fortran.md is written when the language reads clean by language_deviations.py, by whichever family PR gets it there — no longer tied to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-enginemetrics

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions