Repository navigation
Description
🛑 Problem Statement
repo_data.ecosystem_baseline (repo_macro_species, the repo-wide K-Means clustering computed
by signal_processor.py:1116-1158) clusters each repo by the ratio of its files across each
file archetype. Its features list (GENERAL_REPO_INFERENCE_MODEL, analysis_lens.py:8096)
must exactly string-match the archetype names actually produced by file-level classification --
feature_counts = {feat: archetype_counts.get(feat, 0) for feat in repo_model["features"]}
(signal_processor.py:1126) silently drops any archetype whose name isn't in that list.
The model's feature list includes 4 "static" (non-ML, bypass-path) slots meant to correspond to
STATIC_ARCHETYPES (gitgalaxy_config.py:672-677, the single source of truth for files that
skip active ML classification -- build/vendor/doc/data files). Comparing the two:
GENERAL_REPO_INFERENCE_MODEL["features"] (trained on) |
Current STATIC_ARCHETYPES value |
Match? |
|---|---|---|
"File Macro-Species 10: Universal Mixed Logic" |
(nothing produces this string anymore) | dead |
"Static: Literature & Documentation" |
"Static: Literature & Documentation" |
matches |
"Static: Minified & Vendor Opaque Mass" |
"Static: Minified & Vendor Opaque Footprint" |
mismatch ("Mass" vs "Footprint") |
"Unknown" |
"Static: Unmapped / Unsupported Format" |
mismatch |
| (missing entirely) | "Static: Declarative Data & Configurations" |
not represented at all |
Net effect: any file classified as data/minified/unknown under today's STATIC_ARCHETYPES
contributes zero to the repo's feature vector -- archetype_counts.get(feat, 0) misses on
every one of those 3 slots every time, regardless of how many such files the repo actually has.
Repos dominated by config/data files, vendor/minified bundles, or unparsable/unknown files get
systematically misclassified, because up to 4 of the 22 trained feature dimensions are
permanently zero no matter the real repo composition. "File Macro-Species 10: Universal Mixed Logic" also confirms this model predates the file-level model's current naming scheme (see the
sibling file-level issue -- the "Claim 5" doc it references described a 10-cluster file model;
this repo model's dead string is a leftover from that generation).
Separately (lower severity, not the main bug): GENERAL_REPO_INFERENCE_MODEL never sets a
cluster_names key, so signal_processor.py:1141-1144's fallback ([f"Cluster {i}" for i in range(k_clusters)]) is always taken -- repo_data.ecosystem_baseline is permanently a bare
"Cluster 0".."Cluster 5" label, never a human-readable name (unlike the function-level model,
which does ship real cluster_names like "Utility/Helper"). This is what produced the
"Cluster 3"-style values referenced in #1149.
🎯 Objective
Make the repo-level feature vocabulary match what the file-level classifier (and its static
bypass path) actually produce today, so repo clustering counts every file instead of silently
dropping the static ones.
🛠️ Proposed Implementation
- Update
GENERAL_REPO_INFERENCE_MODEL["features"](and its centroid/z-score-param vectors,
which are keyed positionally tofeatures) to use the 4 currentSTATIC_ARCHETYPESstring
values instead of the 3 stale ones + 1 dead legacy string. This changes the model's
dimensionality (22 -> 23, gaining thedataslot) and requires the centroids to be
re-derived, not just relabeled -- flag as needing real retraining data, not a pure string swap. - If retraining isn't feasible right now, at minimum fix the 2 renamed-string mismatches
("Static: Minified & Vendor Opaque Mass"->"...Footprint","Unknown"->
"Static: Unmapped / Unsupported Format") so those two slots stop being permanently zero --
a smaller fix that restores 2 of the 3 broken slots without touching centroid dimensionality. - Decide what to do with the dead
"File Macro-Species 10: Universal Mixed Logic"slot -- it
doesn't correspond to anything current code produces, so it's permanently zero and can likely
just be dropped (reduces dims by 1) once whoever owns the training data confirms it's safe to. - Optional: populate
cluster_nameswith descriptive labels the same way
GENERAL_FUNCTION_INFERENCE_MODELdoes, soecosystem_baselinestops being a bare cluster
index.
✅ Acceptance Criteria
- Every
STATIC_ARCHETYPESvalue has an exact-matching slot in
GENERAL_REPO_INFERENCE_MODEL["features"]. - No dead/unproducible strings remain in
GENERAL_REPO_INFERENCE_MODEL["features"]. - A repo whose files are dominated by config/data/vendor/unknown files is proven (via a real
test) to actually shiftrepo_data.ecosystem_baseline's cluster assignment, not silently
contribute zero.
Activity
squid-protocol commentedon Aug 9, 2026
Part of epic #1160 (K-Means archetype clustering drift, all 3 tiers). Sibling issue: #1158 (file-level, referenced above for the file-archetype naming scheme this repo model's features are keyed off of).
squid-protocol commentedon Sep 16, 2026
Checked this against current
main(23d7b8a) — none of this issue's reported bug has been touched.GENERAL_REPO_INFERENCE_MODEL["features"]inanalysis_lens.pystill lists, verbatim:"File Macro-Species 10: Universal Mixed Logic"— still dead, nothing produces this string"Static: Minified & Vendor Opaque Mass"— still mismatched againstSTATIC_ARCHETYPES["minified"] = "Static: Minified & Vendor Opaque Footprint""Unknown"— still mismatched againstSTATIC_ARCHETYPES["unknown"] = "Static: Unmapped / Unsupported Format""Static: Declarative Data & Configurations"(currentSTATIC_ARCHETYPES["data"]) — still absent from the feature list entirelyAnd the model still has no
cluster_nameskey, soecosystem_baselineis still a bare"Cluster 0".."Cluster 5"label (thesignal_processor.py:1141fallback is unconditionally taken).The recent archetype work (#3016/#3021 function-level, #3023/#3026/#3061 file-level + the new composition lenses) is all real progress on the epic, but it's additive/parallel —
repo_composition_archetype(#3023) is a brand-new population-relative feature living alongsideecosystem_baseline, not a fix to it. The originalecosystem_baseline/repo_macro_speciesK-Means path this issue describes (signal_processor.py:1240→GENERAL_REPO_INFERENCE_MODEL) is untouched by any merged PR.Leaving open — none of the acceptance criteria here are met yet.
fix(#1159): retire the legacy repo K-Means model; baseline = composit…
docs(security): stop describing the ML malware classifier as working;…