Repository navigation
[P1-2][kratos] Corpus calibration baseline #103
Copy link
Copy link
Open
Labels
Description
Corpus calibration baseline for introduced-only readiness
Goal
stable finding identity(kratos:v1:*)를 consumer CI 정책에 사용하기 전에, 실제 analyze_project 결과를 canonical expected-ID corpus와 비교해 false positive/false negative를 재현 가능하게 관찰하는 P1-2 baseline을 구축합니다.
Source of Truth
- P1-1 identity contract: [P1-1][kratos] Stable finding identity and introduced-only diff contract #101 / merged PR feat: stabilize finding identity for diff #102
- Current default branch:
master@f336541d729fc52c60a8f389723378ede662386f crates/kratos-core/src/report_diff.rs:FINDING_IDENTITY_VERSION=1,diff_reports_with_identitydocs/plans/v1-cli-report-contract.md: report schema v3 and additive identity evidence contract
Scope
fixtures/corpus/manifest.json을 expected identity set의 단일 canonical manifest로 둡니다.- 최소 4개 case를 고정합니다: mixed-positive, dynamic-usage negative, route-substring negative, empty/no-op.
- 전체 corpus에서 6개 finding group을 모두 expected positive로 최소 1회 포함합니다: broken imports, orphan files, dead exports, unused imports, route entrypoints, deletion candidates.
- evaluator는 각 fixture를
analyze_project로 분석하고, 같은 root의 빈 baseline과diff_reports_with_identity를 비교해 observed stable ID를 얻습니다. - case/kind별 multiplicity-aware TP/FP/FN과 ordered stable ID vector를 결정적으로 출력합니다.
- baseline은 FP=0/FN=0 및 manifest와 ordered-vector exact match여야 하며, well-formed wrong replacement ID가 FP=1/FN=1로 명시적 실패하는 테스트를 둡니다.
- 서로 다른 temporary root와 반복 실행에서 결과가 동일함을 검증합니다.
- 평가 중 fixture/report/
.kratos/파일을 생성하거나 수정하지 않습니다.
Owned files
fixtures/corpus/**crates/kratos-core/tests/corpus_calibration.rsdocs/plans/v1-cli-report-contract.md
Inspect-only
crates/kratos-core/src/analyze.rscrates/kratos-core/src/model.rscrates/kratos-core/src/report_diff.rscrates/kratos-core/tests/dynamic_usage.rscrates/kratos-core/tests/report_diff.rscrates/kratos-cli/tests/diff_cli.rs.github/workflows/ci.ymlpackage.json
Must not touch
- Runtime scanner semantics or production finding classification
- Consumer introduced-only blocking/shadow/enforcement gate or required check
- Public CLI command/flag additions
- Report schema v4, source span, SARIF, annotation
- Workspace/cache/watch/HTML/sweep work
.github/workflows/**, package/version metadata, tag/publish/release/deploy/merge/auto-merge
Acceptance criteria
- Canonical manifest has unique case IDs/roots, corpus-contained existing paths,
identityVersion=1, six explicit finding groups, and sorted full IDs matching lowercasekratos:v1:<64-hex>; repeated IDs preserve duplicate finding multiplicity. - Corpus contains the four required case classes and all six finding groups have at least one expected positive across the corpus.
- Real
analyze_project+ same-root empty-baselinediff_reports_with_identityevaluation reports baseline FP=0/FN=0 and ordered introduced IDs exactly equal the manifest. - A well-formed wrong replacement ID exposes exactly FP=1/FN=1 with case/group/IDs; duplicate multiplicity and reordering cannot be hidden by set conversion.
- Repeated evaluation and byte-identical copies under different temporary roots preserve the ordered ID vectors and TP/FP/FN.
- Independent semantic witnesses prove mixed locators for all groups, dynamic target discovery/inbound default usage/no dead export, route substring
OrphanKind::Module, and empty/no-op zero files/modules/findings/diff. - No
.kratos/or report write occurs and report schema v3 / identity version 1 / existingReportDiffand CLI compatibility remain intact. - Focused corpus tests, report/CLI compatibility tests,
cargo test --workspace, workspace all-target clippy,npm run verify, andgit diff --checkall exit 0. - Draft PR current-head CI reaches 10/10 success; no merge/release/publish/deploy action is performed.
Validation
cargo test -p kratos-core --test corpus_calibration -- --nocapture
cargo test -p kratos-core --test report_diff
cargo test -p kratos-cli --test diff_cli
cargo test --workspace
cargo clippy --workspace --all-targets --locked
npm run verify
git diff --checkParallelization
Single serial implementation lane: fixtures, manifest, evaluator, and expected IDs are tightly coupled. Independent reviewers may inspect the final diff read-only.
Wiki Context Manifest
- Queries:
kratos corpus calibration stable finding identity introduced-only,SSoT consistency no silent fallback evidence - Authority:
[wiki: domains/principles/alex-core-invariants.md] - Applied: one canonical manifest, deterministic derived results, explicit mismatch evidence, no silent fallback
- Gap: no repo-specific Kratos corpus wiki page; live repo/GitHub contracts remain authoritative
Reactions are currently unavailable
Activity