Skip to content

Commit 7cddf58

Browse files
feat(test_context): v2.5.5 cross-language test detection + WeakPoint field (#102)
## Summary v2.5.5 `test_context` slice — first phase (foundation). Adds the data-model + cross-language classifier; downstream PRs wire detector-side suppression. ## Changes - `src/types.rs`: new `TestContext` enum (Production / TestOnly / Doc); new `WeakPoint.test_context: Option<TestContext>` field with serde-skip-if-none for backward compatibility. - `src/test_context.rs`: new module with `classify_path` (Rust / Python / Go / JS-TS / Julia / Zig / Elixir / docs-examples) + `content_indicates_test_scope` (ExUnit / unittest / pytest / Julia @testset) + `classify` (path-then-content). 11 unit tests; all green. - All 137 `WeakPoint` construction sites in `src/` get explicit `test_context: None` (zero behaviour change — Production is the default semantics). ## What this does NOT do (deliberate scope) - Replace the analyzer's legacy `is_test_file` boolean — follow-up to keep this PR reviewable. - Suppress PanicPath findings in TestOnly code — needs the emit-site wire-up; next slice. - Test-data suppressions (example.com URLs, dummy creds) — next slice. - Block-level test detection (inline pytest fixtures in production files, Zig `test "..." {}` blocks) — file-level only here. ## Verification - `cargo test --release --lib`: **311 pass / 0 fail** (300 baseline + 11 new test_context tests). - `cargo build --release`: clean. - All test_context tests cover the cross-language path patterns documented in the ROADMAP v2.5.5 `test_context` section. ## Refs - ROADMAP.adoc v2.5.5 `test_context` section (four items; this PR lands the first; three follow-ups planned) - PROOF-NEEDS.md (no impact)
1 parent 55a094c commit 7cddf58

11 files changed

Lines changed: 470 additions & 0 deletions

File tree

src/a2ml/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ mod tests {
842842
description: "unchecked result".to_string(),
843843
recommended_attack: vec![AttackAxis::Concurrency],
844844
suppressed: false,
845+
test_context: None,
845846
}],
846847
statistics: ProgramStatistics {
847848
total_lines: 42,

0 commit comments

Comments
 (0)