feat(controls): enrich semantic retrieval query with finding intent + C5 live test (#222)
CI / Check (push) Skipped
CI / Detect Changes (push) Successful in 3s
CI / Deploy Dashboard (push) Skipped
CI / Deploy Docs (push) Skipped
CI / Deploy MCP (push) Skipped
CI / Deploy Agent (push) Failing after 4s

This commit was merged in pull request #222.
This commit is contained in:
2026-07-22 07:14:49 +00:00
parent 60601d8215
commit a25d41c3e5
3 changed files with 164 additions and 8 deletions
+7 -5
View File
@@ -22,18 +22,20 @@ impl<J: ControlJudge> SemanticControlChecker<J> {
Self { judge }
}
/// Map a code region to the controls it violates. `region_embedding` is the
/// region's embedding (the caller computes it via the LLM); the top-`k`
/// nearest controls in `index` are judged and grounded.
/// Map a code region to the controls it violates. `query_embedding` is the
/// caller-supplied retrieval embedding — typically the finding's intent
/// (title/description) plus the region, so retrieval keys on what the finding
/// is *about*, not just the ambient code. The top-`k` nearest controls in
/// `index` are then judged against the raw `region` and grounded.
pub async fn check(
&self,
index: &ControlIndex,
region: &CandidateRegion,
region_embedding: &[f64],
query_embedding: &[f64],
k: usize,
repo_id: &str,
) -> Vec<Finding> {
let candidates = index.nearest(region_embedding, k);
let candidates = index.nearest(query_embedding, k);
let mut findings = Vec::new();
for spec in &candidates {
let verdict = self.judge.judge(spec, region).await;