Skip to content

rosetta[markdown]: cross-language consistency — 29 red / 1 amber metrics, 3 ledgered shapes #2587

Closed

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)

  • 🔴 args: 0 vs median 13 (-100%)
  • 🔴 dependency_links: 0 vs median 3 (-100%)
  • 🔴 func_start: 0 vs median 13 (-100%)
  • 🔴 functions_found: 0 vs median 13 (-100%)
  • 🔴 import: 0 vs median 3 (-100%)

2. Signal / keyword deviations

  • 🔴 branch: 0 vs median 5 (-100%)
  • 🔴 cleanup: 0 vs median 2 (-100%)
  • 🔴 comment_lines: 59 vs median 30 (+97%)
  • 🔴 doc: 0 vs median 1 (-100%)
  • 🔴 fragile_debt: 0 vs median 1 (-100%)
  • 🔴 globals: 0 vs median 2 (-100%)
  • 🔴 high_risk_execution: 0 vs median 2 (-100%)
  • 🔴 io: 0 vs median 3 (-100%)
  • 🔴 ownership: 0 vs median 1 (-100%)
  • 🔴 planned_debt: 0 vs median 1 (-100%)
  • 🔴 safety: 0 vs median 2 (-100%)
  • 🔴 safety_bypasses: 0 vs median 2 (-100%)
  • 🔴 state_mutation: 0 vs median 6 (-100%)
  • 🔴 telemetry: 0 vs median 2 (-100%)
  • 🔴 test: 0 vs median 2 (-100%)
  • 🟡 keyword_hits: 134 vs median 247.5 (-46%)

3. Risk-exposure consequences (downstream)

  • 🔴 risk_api_exposure: 0 vs median 5.31104 (-100%)
  • 🔴 risk_cognitive_load: 0 vs median 15.1444 (-100%)
  • 🔴 risk_documentation: 3.7698 vs median 57.1208 (-93%)
  • 🔴 risk_safety_score: 0 vs median 37.297 (-100%)
  • 🔴 risk_spec_match: 20 vs median 96 (-79%)
  • 🔴 risk_stability: 10 vs median 50 (-80%)
  • 🔴 risk_state_flux: 0 vs median 19.9999 (-100%)
  • 🔴 risk_tech_debt: 0 vs median 39.9576 (-100%)
  • 🔴 risk_verification: 0.45954 vs median 2.3628 (-81%)

Ledgered shapes touching markdown

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
batch5-tier2-morphology-shapes keyword-overlap — — Collective entry for Tier-2 finditer/report-confirmed shapes, detailed per-manifest: css at-rules triple-count (func+branch, @supports also safety; args tracks @import u…
no-dependency-capture-languages upstream-question — — m4 and scheme have _dependency_capture = None: include()/(import ...) count the import signal but can never produce a DAG edge, so popularity stays 0 and orphans never c…

Reproduce / evidence

Activity

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

    @squid-protocol
    OwnerAuthor

    Sweep complete — engine PR #2639 + corpus PR squid-protocol/keyword-rosetta#22 (ENGINE_REF: pull/2639/head).

    Before → after: the issue's 29🔴/1🟡 → live pre-sweep 12🔴/1🟡 + 18 unreviewed n/a ⚠ → 11🔴/1🟡 across 19 comparable metrics, zero unreviewed cells.

    The five-bucket decomposition:

    1. Real engine gap, fixed (markdown: capture relative links as dependency edges (rosetta #2587, dependency_links 0 vs median 3) #2638 → PR feat(markdown): capture relative links as dependency edges (closes #2638) #2639): dependency_links 0 vs median 3. The corpus plants a real main→a→b→c link chain; relative links ARE dependencies. Root cause was two-fold — markdown, being is_inert, skipped Phase-6 import extraction entirely, AND detector.py's four early-return paths clobbered worker-extracted imports with a placeholder "raw_imports": []. With both fixed the chain resolves exactly to the median: dependency_links consistency 78%→83%, red dots 7→5, and repo-wide 17→18 metrics hold ≥80% green band. Bonus: the inert opt-in wakes yaml's deliberately-authored but silently dead uses:/image: capture — rosetta[yaml]: cross-language consistency — 9 red / 8 amber metrics, 2 ledgered shapes #2606 improves for free (9🔴/8🟡 → 6🔴/6🟡 current).
    2. Missing rules with genuine morphology: none — every absent rule fails the "name the language's own idiom" test.
    3. Corpus authoring gaps: none — shells plant the lit plane and link chain correctly.
    4. Intended morphology, ledgered (markdown-lit-plane-morphology, validated): all 18 n/a cells with per-signal reasoning, plus functions_found 0 (lit_headers are the probe analogue), keyword_hits −45% (only 4 lit rules can hit), comment_lines +183% (already ledgered: a documentation format measuring high on a documentation-mass metric is correct), and the nine §3 risk floors (a no-code language's risk formulas bottom out at constant terms — structurally incomparable, not biased).
    5. Median inflation: none affecting markdown.

    Remaining out-of-band: the 11🔴/1🟡 above, all bucket-4 ledgered. Nothing is blocked on cross-cutting issues. Capstone: docs/language_status/markdown.md §8 (new doc, ships in #2639).

    Close criterion: met via the "every remaining deviation ledgered as intended morphology" clause — closing after the PR pair lands is your call.

  3. squid-protocol commented on Sep 3, 2026

    @squid-protocol
    OwnerAuthor

    Status: 4🔴 / 3🟡 unexplained, 11 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
    🔴 keyword_hits 30 148 -80% structure
    🔴 coding_loc 0 17.12 -100% signals
    🟡 dependency_density 0.75 0.5312 +41% signals
    🟡 encapsulation_ratio 1 0.75 +33% signals
    🟡 total_loc 14.5 24.75 -41% signals
    🔴 risk_stability 0 50 -100% risk
    🔴 risk_tech_debt 0 46.57 -100% 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

    • cog_raw — inherits total_loc, coding_loc
    • structural_mass — inherits total_loc, coding_loc

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

    • comment_lines — markdown-prose-is-doc-morphology
    • control_flow_ratio — control-flow-ratio-denominator-is-a-vocabulary-tally
    • functions_found — markdown-lit-plane-morphology

    undefined — a per-function descriptor for a language with no functions: the quotient has no value, so this is not a deviation

    • avg_func_args — language records no functions
    • avg_func_complexity — language records no functions
    • avg_func_loc — language records no functions
    • func_complexity_gini — language records no functions
    • func_internal_density — language records no functions
    • max_func_complexity — language records no functions

    Unreviewed n/a cells

    The registry defines no rule here, and no validated ledger entry records why — each is either real morphology to ledger or a missing-rule engine gap of the kind gitgalaxy#2610 turned out to be: risk_api_exposure, risk_cognitive_load, risk_concurrency, risk_dead_code, risk_documentation, risk_spec_match, risk_state_flux.

    Close criterion (gitgalaxy#2669 Batch E.4)

    python tools/language_deviations.py markdown exits 1: 7 unexplained cell(s) and 7 unreviewed n/a 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 5, 2026

    @squid-protocol
    OwnerAuthor

    Status: clean — every out-of-band metric is 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.

    Out of band, but accounted for

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

    • cog_raw — inherits total_loc, coding_loc, func_complexity_gini
    • dependency_density — inherits coding_loc, control_flow_ratio
    • risk_tech_debt — inherits raw_state_slop_orphans

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

    • encapsulation_ratio — encapsulation-ratio-tracks-unplanted-local-declarations
    • functions_found — markdown-lit-plane-morphology
    • raw_arch_api — api-no-rule-defined
    • raw_state_slop_orphans — orphan-detection-is-name-recurrence

    undefined — a per-function descriptor for a language with no functions: the quotient has no value, so this is not a deviation

    • avg_func_args — language records no functions
    • avg_func_complexity — language records no functions
    • func_complexity_gini — language records no functions
    • func_internal_density — language records no functions
    • max_func_complexity — language records no functions

    Reported, not gated (program length, unplanted risk inputs, commit age -- gitgalaxy#2669 F.1/F.3): avg_func_loc 0 vs median 5.104 (-100%), coding_loc 0 vs median 17.5 (-100%), comment_lines 34 vs median 12 (+183%), control_flow_ratio 0 vs median 0.09375 (-100%), keyword_hits 30 vs median 146.5 (-80%), risk_stability 0 vs median 50 (-100%), structural_mass 1 vs median 12.43 (-92%), total_loc 14.5 vs median 25 (-42%). None of these is a planted signal; a derived risk cell above may inherit from one.

    Close criterion (gitgalaxy#2669 Batch E.4)

    python tools/language_deviations.py markdown exits 0: nothing is unexplained and no n/a cell is unreviewed. That is not the same as "no metric deviates" — deviations remain, and each is named above with the reason it is not a defect. This issue has nothing language-specific left to do.

  5. squid-protocol commented on Sep 5, 2026

    @squid-protocol
    OwnerAuthor

    Closing per the F.6 criterion (gitgalaxy#2669): language_deviations.py markdown exits 0 — every out-of-band metric carries a recorded reason (validated ledger entry, derivation edge, or reported-not-gated group). This was the last language family blocked on unreviewed n/a cells; the n/a review landed in keyword-rosetta#54 (all 26 cells dispositioned; engine gaps filed as gitgalaxy#2732/#2733).

    To be explicit about what closed does NOT mean: not all-green — out-of-band metrics remain, each with its reason recorded above; the nightly regen + F.6 loop reopens this issue automatically if the language drifts back out of compliance. §10 capstone owed per the E.3/#2696 standing rule (F.6 owns it).

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