Skip to main content

capture_intensities

Function capture_intensities 

pub fn capture_intensities(db: &FactsDb) -> Result<HashMap<String, [f64; 8]>>
Expand description

Capture the per-file, per-smell biomarker intensities tune_weights needs to re-score candidate weight sets, without re-running the whole code-health SQL pass for every candidate — see this module’s design- decision doc comment above.

Callers MUST call this immediately after a HEAD run_code_health_scoped (or crate::analyses::code_health::run_code_health) call on the SAME db connection: code_health_biomarkers_v1 is a CREATE OR REPLACE TEMPORARY TABLE refreshed by every code-health scan, so an intervening scoped/historical scan (e.g. band_history) would silently replace it with a different revision’s intensities.

Rows naming a smell absent from [SMELL_WEIGHTS] are defensively skipped — this should never happen since both sides share the same SMELL_WEIGHTS source of truth, but a stray row must never panic or silently corrupt a different smell’s slot.

§Errors

Returns crate::CodeLoreError::Analysis on a FactsDb query failure.