Skip to content

[P1-2][kratos] Corpus calibration baseline - #104

Draft
JeremyDev87 wants to merge 1 commit into
masterfrom
feat/corpus-calibration-baseline
Draft

[P1-2][kratos] Corpus calibration baseline#104
JeremyDev87 wants to merge 1 commit into
masterfrom
feat/corpus-calibration-baseline

Conversation

@JeremyDev87

Copy link
Copy Markdown
Owner

What

  • identityVersion=1의 단일 canonical corpus manifest와 4개 case를 추가했습니다.
  • 실제 analyze_project → 같은 root의 빈 report → diff_reports_with_identity 경로로 6개 finding group의 TP/FP/FN을 평가합니다.
  • ordered ID vector·중복 multiplicity·root 독립성·반복 결정성·well-formed wrong-ID failure를 검증합니다.
  • dynamic import, route substring, mixed-positive, empty/no-op에 독립 semantic witness를 추가했습니다.
  • case ID를 안전한 lowercase slug로 제한하고 corpus root containment를 검증해 temp-copy path escape를 차단합니다.

Why

introduced-only gate를 차단 정책으로 승격하기 전에 false positive/false negative와 stable identity drift를 작고 검토 가능한 corpus로 고정하기 위함입니다. expected ID는 manifest의 literal 값만 authority로 사용하며 자동 생성·갱신하지 않습니다.

Validation

  • cargo test -p kratos-core --test corpus_calibration -- --nocapture — 9/9, TP=10 / FP=0 / FN=0
  • cargo test -p kratos-core --test report_diff — 13/13
  • cargo test -p kratos-cli --test diff_cli — 3/3
  • cargo test --workspace — exit 0
  • cargo clippy --workspace --all-targets --locked — exit 0
  • npm run verify — 9 pass / 1 environment-gated native skip; pack dry-run PASS
  • changed test rustfmt --check, git diff --check — PASS
  • real scan --no-write --json — schema 3, counts 1,1,2,1,1,1, .kratos/ 미생성

Evidence

  • committed corpus: mixed-positive, dynamic-usage-negative, route-substring-negative, empty-noop
  • six finding groups 모두 literal expected stable ID coverage
  • 반복 실행과 다른 temporary root에서 ordered vectors 및 TP/FP/FN 동일
  • wrong replacement ID probe: 동일 group에서 FP=1/FN=1로 명시적 실패
  • fixture bytes 불변 및 .kratos/ 부재

Risk / Boundaries

  • calibration/test-only 변경이며 production scanner·public CLI·workflow/required check를 변경하지 않습니다.
  • schema v4, source span/SARIF, consumer shadow/enforcement, workspace/cache, version/tag/publish/release/deploy는 범위 밖입니다.
  • cargo fmt --all -- --check는 변경 밖 기존 discover.rs, ignore.rs, report_v2.rs drift로 실패하며, 이번 변경 Rust 파일은 rustfmt --check를 통과합니다.
  • merge/auto-merge는 수행하지 않습니다.

Closes #103

stable finding ID를 consumer 정책에 사용하기 전에 네 개의 고정 corpus로 TP/FP/FN을 재현합니다.
실제 analyzer/diff 경로, 순서·중복·root 독립성, semantic witness와 no-write 계약을 검증합니다.

Co-authored-by: Hermes
@JeremyDev87 JeremyDev87 self-assigned this Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[P1-2][kratos] Corpus calibration baseline

1 participant