Skip to content

Epic: keyword-family validity -- do the per-function signals measure what their names say? #8863

Open

Description

@squid-protocol

Goal

Find out, with a repeatable test, whether each keyword family in function_data measures what its contract says, show the answer as a graph on the README beside the function-finding and call-graph charts, and close the gaps. GitGalaxy's per-function signals (I/O, regex, time, decorators, bitwise, ...) are keyword families: regex rules per language in standards/language_standards/languages/. They feed the archetypes, the risk gauges and every study built on them, so a family that misses half of what it names, or fires on characters inside strings, quietly bends all of those.

The system (three parts)

  1. The contracts are the definitions. gitgalaxy/standards/signal_contracts.py holds a written contract for 71 families (43 declared, 16 stated, 12 draft), in nine phases. A family is scored against its contract, not against a guess; a draft contract is a question for the maintainer (Keyword families: five definition questions for the owner (json, generators, closures, cleanup, telemetry) #8862).
  2. The oracle harness (PR tests/tools: family_oracle scores each keyword family against an ast oracle (Part of #8863) #8864, tests/tools/family_oracle.py and family_oracle_ts.py): a real parser says what each function does (Python ast; tree-sitter for Go, Rust, JavaScript, TypeScript, Java, C so far); each family is scored per language on recall, precision and rank correlation, with the tokens it missed. --update-baseline merges a result into tests/family_validity_baseline.json.
  3. The grid (PR tests/tools: family_validity_chart draws the keyword-family accuracy grid (Part of #8863) #8876, tests/tools/family_validity_chart.py -> docs/self_scan/family_validity_chart.svg, embedded in the README): one column per language, one row per contracted family; N/A (the language has no rule) black, untested gray, scored cells a rainbow for the weaker of recall and precision; faded under 10 functions, hatched when the corpus is not a pinned crucible. A pure function of the baseline and the engine registry, like graph_coverage_chart.py, with --check and --history.

How much can be checked, and how thoroughly

  • The grid: 79 language definitions (73 code languages) x 71 contracted families = 5,183 cells; 2,894 are defined (the language has a rule), 2,289 are N/A. 181 are measured against a parser today (6%), in 15 languages and 23 families; 677 more by the decoy test only; 2,036 not tested.
  • Which languages: 53 of the 79 definitions have a tree-sitter grammar and can get an oracle with one Spec each (about 100 lines). The other 26 (COBOL, JCL, HLASM, PL/I, REXX, ABAP, the SQL dialects, ...) need another oracle (for COBOL, the deterministic translator's parser) and stay gray until one exists.
  • Which families (my reading of the contracts, to be confirmed): roughly a third are syntactic (branch, args, closures, comprehensions, decorators, bitwise, casts, imports, globals, cleanup, doc, lazy, panics): a parser answers them exactly. Roughly half are callee or library lists (io, regex, time, serialization, sleeps, prints, telemetry, danger, concurrency, locks, events, llm/ml/dl, ...): the oracle needs its own per-language list, so it is a second reading of the contract, checkable but not independent proof. The rest (hardcoded secrets, rce funnel, exfiltration, memory scraping, dead code, the literate families) have no parser oracle: they need planted positives and negatives (what keyword-rosetta already does for presence) and a reviewed sample of real hits.
  • Depth, in levels: L1 one real repository per language (today, exploratory, marked \u2020); L2 a pinned corpus with enough functions per cell that the number can be quoted (>= 10 now, a confidence interval later) and a written contract reading; L3 every disagreement checked against the real source with a verdict, kept in a ledger the way tri_comparison_ledger.json does it; L4 a second independent oracle (a compiler, an IDE index) on the families that matter most. Today is L1 for 181 cells. A reasonable target for the README is L2 on the syntactic and library families in the 10-15 largest tree-sitter languages.

What it has found so far (oracles aligned to the contracts, 2026-11-21; exploratory, one repository per language)

The test (what this epic builds)

  1. Oracle test (above, tests/tools: family_oracle scores each keyword family against an ast oracle (Part of #8863) #8864) per language, with a written contract reading per family.
  2. Cross-language consistency on keyword-rosetta. The same task is written in many languages there, so a family that fires for a task in 40 languages and not in the other 10 has a gap in those 10 without needing any oracle.
  3. Missing-keyword mining. Rank the tokens that are common in functions where the oracle sees the construct and the family is 0, per family and language. Those are the candidate additions, each to be timed before it is merged.
  4. Re-measure. After a fix, rerun: recall and precision up, CPU seconds on keyword-rosetta and language-crucible not up beyond the agreed budget.

Child issues

Rules

  • Every keyword change is timed (CPU seconds, not wall) on keyword-rosetta and language-crucible, before and after, in the PR.
  • If keyword-rosetta counts move, rosetta:rebless-owed and rebless as usual.
  • A family is scored against its contract; where the contract is draft or silent the question goes to Keyword families: five definition questions for the owner (json, generators, closures, cleanup, telemetry) #8862 before a gap is called a bug.
  • The pilot is discovery, not confirmation: predictions for each language are stated before its first run, and the pilot numbers are not reused as the confirmatory result.

Not in scope

Retraining the archetype models (a later step, once the families settle; see the train-archetypes skill), new families, and the speed study itself.

Red cells by language (one focus issue each)

Each language is its own issue so several can run at once (the gate holds one in-flight item per issue, so a single epic issue starves the focus whenever its one slice waits on a PR). Each issue carries the red cells from tests/family_validity_baseline.json on main and follows .claude/skills/family-validity-fix/SKILL.md; the nightly re-measure (tests/tools/family_sweep_nightly.py) refreshes the numbers.

SOP-002 decoy leaks by language (one focus issue each)

The SOP-002 gap-cell decoy suites (PRs #9427, #9428, #9463, #9464, #9465, #9466) found about forty real engine leaks. Each leak is its own issue and is locked as a strict xfail in tests/decoys/test_decoy_<lang>.py; each language below is one focus issue, one PR, that fixes its leaks and removes the markers. Start a language only once its suite is on main.

Activity

  1. added
    enhancement
    epic
    metrics
    core-engine
    on Nov 21, 2026
  2. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Now tracked in milestone Eagle Eye 🦅 — Structure Accuracy (https://github.com/squid-protocol/gitgalaxy/milestone/40).

    Prior work in the same class, found one at a time under Friendly Fire: #8012 (~38 function_data signal columns structurally zero) and #8009 (11 signal column names that misdescribe what their rules count). This epic is the measured counterpart: a parser's reading of the same functions (#8864), scored per family. The pilot's count that 54 of 110 function columns ever fire on GitGalaxy's own Python code, and the families it calls dead or misnamed, should be reconciled with those two issues before either is closed. Whether #8009/#8012 move into the new milestone is the maintainer's call; I have not moved them.

  3. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Decoy matrix (parserless precision test), first version, 2026-11-21. For 45 keyword-rosetta languages and every token family in each language's generated menu, one keyword was inserted in the language's own syntax as bare code (a positive control), as a comment, and inside a string literal, and all 1,581 variants were scanned together.

  4. 228 remaining items

  5. squid-protocol commented on Nov 27, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-27T01:01Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

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

    claim:melekcore-engineenhancementepicmetricspriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions