Skip to content

The risk_* vectors measure activity, not risk — rename, reframe, or split (evidence: the full #2982 validation record) #2991

Closed

Description

@squid-protocol

The claim in the name

The engine persists 13 per-file vectors named risk_* (risk_cognitive_load, risk_concurrency, risk_api_exposure, risk_tech_debt, risk_safety_score, …). The prefix asserts these measure risk — i.e., that higher values indicate elevated probability of defects/vulnerabilities. The temporal-crucible validation program (epic #2982; ~3,550 scanned snapshots, two repositories, three label families, every test pre-registered) has now tested that assertion to exhaustion. The evidence says the vectors measure activity and content, not risk. The naming now contradicts the program's own published record.

The evidence, by claim

1. "Risk" doesn't fall when risk is removed. H1 (the founding hypothesis): median structural delta after a security fix = +0.000 (p=0.77 curl; equivalence-confirmed near-zero on nDPI, CI ⊂ ±0.10). Fixes raise the scores slightly more often than they lower them (48% vs 42%) — because repair adds guard code, and guard code reads as structure. The instrument watches vulnerabilities being eliminated and reports "no change."

2. "Risk" doesn't predict where risk materializes. Summed structural exposure ranks last of six features for predicting fix-touched files (AUC 0.724 vs churn 0.859, LOC 0.859); within churn bands it loses to a plain line count in 3/4 bands (−0.16 in the band holding 82% of positives); density- and length-matched variants collapse to chance (0.503); a 26-signal multivariate vector under a temporal split scores 0.479 vs LOC's 0.531 — both chance out-of-time; trajectory (slope/drift) features sit at ≈0.50. Independently corroborated: repowise-bench's size-confound wall (their pooled 0.737 → 0.525/0.572 within small/medium NLOC bands, different labels, different instrument).

3. The vectors don't even mark risk type. The specificity battery (S-H0): the family→matched-vector confusion matrix is not diagonal — memory-danger signals ranked highest even for info-leak bugs. The vectors are not mechanism-diagnostic.

4. What a vector actually measures — the specimen. CURL-CVE-2026-11586's +47.1 "risk spike": risk_concurrency 0→87.26 because a test file added a threading harness. The meter worked perfectly — threading appeared, the concurrency meter moved. It measured "threading happens here." Only the word "risk" was wrong. Likewise risk_tech_debt's H3 "signal" was its own density denominator (#2984), and risk_secrets_risk ρ=−0.91 vs LOC (#2979).

5. What actually predicts is not in these vectors. The two validated predictors are recidivism (prior-fix count; replicated both repos, p<1e-4) and change entropy / Hassan HCM (validated out-of-selection on fresh labels, lift over LOC +0.038) — both history metrics, both currently zeroed in every scan by GITGALAXY_DISABLE_GIT_HISTORY (see #29).

What the vectors ARE good at (validated)

Describing activity: the fix-grammar gradient (fix-shaped composite 66% security-fix → 53/48/46% ordinary-fix classes → 38% control → 13% revert) shows the deltas reliably characterize what kind of change happened; keyword pools recover coherent activity groupings (the alloc/cleanup discipline pair, ρ=0.85, size-independent); extraction ties tree-sitter at zero dependencies across 59 languages. This is a real, differentiated capability — an x-ray of what code does — mislabeled as a prognosis.

Proposed resolution (design decision, not prescribed here)

Options, roughly in order of invasiveness:

  1. Docs/semantics reframe: keep column names for compatibility; re-document the 13 vectors as activity/content vectors ("concurrency surface", "API surface", …), with an explicit statement that they are descriptive, not predictive, citing this record.
  2. Schema alias: introduce activity_* (or surface_*) names with risk_* as deprecated aliases; migrate reports/LLM briefs to the new vocabulary.
  3. Split the product claim: descriptive vectors (these) + a separate, honestly-named predictive layer built from what validates — recidivism + HCM + churn (requires Update README with improved mapping description #29's history-enabled mode) — gated per Calibration contracts: a signal earns entry to a gated formula by demonstrated defect-lift beyond size (score-contract track) #2987's promotion contract.

Whatever the choice, the current situation — shipping risk_* columns that the project's own pre-registered validation shows do not measure risk — is the kind of finding an external auditor or reviewer would surface; better that the record shows we surfaced it ourselves and acted deliberately.

Related: #2982 (the validation record), #2987 (promotion contract), #2984/#2979 (density artifacts), #2988 (determinism), #29-temporal-crucible (history-enabled mode), #2990 (vocabulary assessment).

Activity

  1. squid-protocol commented on Sep 13, 2026

    @squid-protocol
    OwnerAuthor

    Disposition table for the 13 vectors (follow-up: the concrete "what to do per equation")

    Evidence-based triage of each risk_* calculator against the #2982 record. Three buckets: KEEP-DESCRIPTIVE (honest presence/surface meter — rename per this issue), REWORK (known formula artifact), PROMOTE (belongs in a separate, honestly-named predictive layer).

    vector what it actually measures evidence disposition
    concurrency concurrency surface (threading present) the +47.1 specimen: test file adds threading → 0→87 KEEP-DESCRIPTIVE ("concurrency surface")
    api_exposure connectivity/centrality (popularity, pagerank inputs) the only vector with a live predictive candidate (mid-band inverted-U, registered for repo #3) KEEP-DESCRIPTIVE; conditional PROMOTE if repo-3 validates
    cognitive_load complexity/size-adjacent structure tracks size everywhere tested KEEP-DESCRIPTIVE ("complexity surface"), size caveat in docs
    safety_score guard-vs-danger balance (credit/debit net) moved correctly on curl (p=0.0072), failed nDPI — descriptive of composition, not predictive KEEP-DESCRIPTIVE ("guard balance")
    dead_code, spec_match, documentation presence meters untested-or-null as predictors; no artifacts found KEEP-DESCRIPTIVE
    state_flux largely commit-size shadow member of the size-proxy co-movement cluster (ρ=+0.66 with net-LOC) KEEP with explicit size caveat, or demote
    tech_debt its own denominator #2984: fixes "reduce debt" by adding lines REWORK (count-based, not density) or delete
    secrets_risk density artifact + wrong surface #2979 (ρ=−0.91 vs LOC); fires on test keys/CA tooling, orthogonal to CVE surface (6/392 implicated files) REWORK: count-based "credential material present" flag
    verification test-adjacent surface the near-universal micro-leak term in spillover (≤0.0013 noise) KEEP-DESCRIPTIVE; investigate the shared term
    stability, churn process/history (currently ablated to zero in validation scans) the family that actually predicts — churn AUC 0.86, recidivism, HCM PROMOTE to the predictive layer (with change_entropy/HCM, ownership_entropy, recidivism count) under #29's history-enabled mode, gated per #2987

    Net shape: raw per-function markers (unchanged — they are the validated x-ray) → descriptive surface vectors (renamed, artifacts fixed) → a separate small predictive layer built from what validates (history family), promoted only through #2987's defect-lift gate.

  2. squid-protocol commented on Sep 13, 2026

    @squid-protocol
    OwnerAuthor

    Formula-facts extraction (mechanical audit of all 13 calculators) — and a structural finding

    Full per-calculator table (inputs, arithmetic, constants, line refs) extracted from signal_processor.py; summary of the structurally important columns:

    calculator DENSITY (÷ LOC/mass)? scaling
    _calc_cog_load YES sigmoid, 0–100
    _calc_safety YES (net numerator ÷ (mass+20)) sigmoid + breach floor
    _calc_tech_debt YES sigmoid (convicted: #2984)
    _calc_documentation no (unit-ratio) 0–100
    _calc_verification YES sigmoid + breach cap
    _calc_graveyard YES sigmoid
    _calc_api_exposure YES (log-volume ÷ log LOC) ×100
    _calc_concurrency YES (÷ (mass+150)) sigmoid
    _calc_state_flux YES sigmoid
    _calc_spec_alignment no (entity ratio) 0–100
    _calc_secrets_risk YES sigmoid (convicted: #2979)
    stability / churn no (age/commit-based) 0–100 / unbounded

    The structural finding: 11 of 13 vectors are density formulas. The validation record convicted the density shape specifically — the ledger's reflection #2 ("every density either stayed flat or produced an artifact; the one vector that moved its assumed direction is a credit/debit net") and the two ticketed artifacts (#2984, #2979) are instances of a pattern that turns out to be the layer's default architecture, not exceptions. Every density formula has the same failure mode available to it: the denominator moves when code is added/removed, so the score can change with no change in the phenomenon it names.

    Consequence for the disposition plan: the REWORK bucket is larger than the two ticketed vectors. For the descriptive reframe, each density vector should either (a) publish its raw numerator alongside (the count IS the presence meter — the validated x-ray layer is the raw signals), or (b) be re-derived count-based. The sigmoid+cap+multiplier stacks (9 tuned constants in cog_load alone, breach floors, path multipliers) assert calibration that was never validated against outcomes — appropriate for a display normalization if documented as such, inappropriate as measurement claims.

    Also noteworthy: stability/churn — the family the evidence PROMOTES — are the two calculators with the simplest, most honest arithmetic in the file (age ratio; commits/√weeks, unbounded).

    Full table: extraction artifact vector_formulas.md (session scratchpad; will be committed with the docs reform PR).

  3. squid-protocol commented on Sep 13, 2026

    @squid-protocol
    OwnerAuthor

    Option A approved and implemented: PR #2993 (draft). Dual-emission verified — every risk_* column/key byte-identical (full suite 8563/0 incl. golden-crucible byte-comparisons); new vocabulary at display surfaces + VECTOR_NAMES canonical mapping; README claim section restated per the #2982 record; docs/vectors.md + docs/vector_formulas.md landed. Follow-ups noted in the PR: docs/validation.md staleness (same class as the README's old section — needs its own pass) and the scheduled brief regeneration.

  4. added
    metrics
    refactor
    on Sep 13, 2026
  5. squid-protocol commented on Sep 13, 2026

    @squid-protocol
    OwnerAuthor

    Resolved via Option A — the vector rename shipped in #2993 (merged) and released in v2.7.0: VECTOR_NAMES maps the descriptive names over the frozen risk_* schema, with the full name table and validation record in docs/vectors.md. The engine, site/, and metrics READMEs adopt the vocabulary; a wiki/docs reframe sweep is tracked as follow-up (PR #2999). Closing as completed.

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

    metricsrefactor

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions