Repository navigation
Description
Summary
An entire "ecosystem context violation" subsystem in SignalProcessor is fully implemented but never wired into the active risk calculation path — dead code, not merely unused config.
Details
Dead method: _get_context_multipliers(self, file_lang, folder_lang) (lines 169-211 in gitgalaxy/metrics/signal_processor.py)
This method:
- Classifies a file's language ecosystem vs. its surrounding folder's ecosystem (via
self.ECOSYSTEMS) - Detects architectural mismatches (e.g.,
"systems_in_web"or"web_in_systems") - Looks up
self.ECOSYSTEM_MISMATCH_WEIGHTSto apply penalty multipliers keyed by"memory","state_mutation","injection"- Example:
ECOSYSTEM_MISMATCH_WEIGHTS["web_in_systems"]["state_mutation"] = 3.0(described in comment as "JS embedded in C firmware = Bizarre architecture", line 131)
- Example:
- Logs a
🚨 CONTEXTUAL MISMATCH DETECTEDwarning (lines 206-209) that can never fire - Is never called anywhere in the codebase (verified via
grep -r "_get_context_multipliers")
Dead assignments:
self.CONTEXT_VIOLATION_MATRIXis assigned in__init__at line 136 viasecurity_profiles.get("CONTEXT_VIOLATION_MATRIX", {})but is never read anywhere after that assignment (verified viagrep -r "CONTEXT_VIOLATION_MATRIX")- Both
CONTEXT_VIOLATION_MATRIXandECOSYSTEM_MISMATCH_WEIGHTSare defined ingitgalaxy/standards/analysis_lens.py(lines 912 and 920) with accompanying docstrings, implying they should be active
Why this is likely incomplete integration, not scaffolding:
The return dict from _get_context_multipliers shares key overlap with the mp_map dict that _calc_state_flux actually consumes:
- Line ~465:
mp_map = self._get_locational_multipliers(rel_path)(path-regex-based multipliers) - Line ~720:
mp_map.get("state_mutation", 1.0)passed as themparg to_calc_state_flux - Both dicts have compatible shapes (
{"memory": float, "state_mutation": float, "injection": float}etc.)
The architectural intent appears to be: merge ecosystem-mismatch multipliers into mp_map before downstream consumption, but that wiring was dropped or never completed.
Net effect: The class docstring promises "Context vs. Entity Matrix" risk amplification (e.g., a native systems-language file with memory-unsafe patterns embedded inside a web-ecosystem directory should get its "memory" risk boosted), but it never happens in production — every file is treated identically regardless of cross-ecosystem context.
Proposed Resolution
Choose one of:
(Option A) Wire the subsystem in:
- Call
_get_context_multipliers(file_lang, folder_lang)incalculate_risk_vector - Merge its output into
mp_map(or replace relevant keys) before passing to_calc_state_flux,_calc_safety, and any injection-relevant risk equation - Add a regression test proving ecosystem-mismatch files get different scores than native ones
(Option B) Remove dead code:
- Delete
_get_context_multipliersmethod (lines 169-211) - Remove
self.CONTEXT_VIOLATION_MATRIXassignment (line 136) - Remove
self.ECOSYSTEM_MISMATCH_WEIGHTSassignment (lines 125-133) OR keep it only if it's referenced elsewhere - Confirm whether
ECOSYSTEM_MISMATCH_WEIGHTSandCONTEXT_VIOLATION_MATRIXingitgalaxy/standards/analysis_lens.pyshould also be pruned (they shouldn't exist if the behavior is never implemented)
Golden-Master Impact Note
Per the Differential Scan protocol in CLAUDE.md: if Option A is chosen and _get_context_multipliers output changes calculate_risk_vector's return values for any file in the golden-master corpus, the change requires:
- Local verification via
python tests/tools/crucible_check.py --update - Re-blessing via
python tests/tools/update_golden_master.py - Explanation of the change in the PR description
References
- File:
/home/joe/nyx_projects/gitgalaxy/gitgalaxy/metrics/signal_processor.py(lines 169-211, 125-133, 136) - Config file:
gitgalaxy/standards/analysis_lens.py(lines 912, 920) - Related issue: guidestar_lens.py: orphaned README execution-trigger scanner (_extract_execution_triggers) never wired in #513 (orphaned scaffolding in
guidestar_lens.py)
Activity
fix(core): scope duplicate-logic detection to name + body content (#1498