Skip to content

Add GR&R reference tests, CI, and TestEvidence export - #1

Merged
LSaiko merged 1 commit into
masterfrom
tests-ci-test-evidence
Sep 23, 2026
Merged

LSaiko merged 1 commit into
masterfrom
tests-ci-test-evidence

Conversation

@LSaiko

@LSaiko LSaiko commented Sep 23, 2026

Copy link
Copy Markdown
Owner

What changed

Phase 1 — Tests + CI

  • tests/test_grr_calc.py checks compute_grr against numbers from outside the tool:
    • AIAG MSA 4th Ed. reference study (10 parts × 3 appraisers × 3 trials). Per-appraiser R̄ (0.184 / 0.513 / 0.328), R̄̄ = 0.3417, X-diff, Rp = 3.511, UCL_R, and the out-of-control range the manual itself flags (appraiser B, part 4) all match the published data sheet. %EV / %AV / %GRR / %PV match within 0.1 pp: the tool gives 26.74% GR&R and the manual gives 26.68%. The gap comes from the rounded 5.15σ K constants (K1 = 3.05 vs 3.042). ndc (5) and the MARGINAL verdict are the same.
    • A hand-calculated 2×2×2 study, with the arithmetic in the test comments.
    • K1/K2/K3 tables recomputed as 5.15/d2* from AIAG Appendix C.
    • AV clamping, USL/LSL → tolerance, and results unchanged when rows are shuffled.
  • .github/workflows/ci.yml: pytest with coverage on Python 3.9 / 3.11 / 3.12.

Phase 2 — --test-evidence / --requirement-ids

  • Writes a traceability-matrix-dhf TestEvidence record: type="GRR", source_repo="grr-analysis-tool", evidence_uri = file:// URI of the generated PDF, linked_requirement_ids from --requirement-ids, plus a summary and the key metrics.
  • Additive only. The PDF is byte-identical with or without the flag, checked with reportlab invariant mode. I compared it against the pre-change grr_tool.py for all three sample datasets, and a test checks it on every CI run.
  • Contract: schemas/test-evidence.schema.json. The emitted evidence validates against it for all three sample studies.

Phase 3 — Docs

  • README: CI badge, the new options, a "TestEvidence export" section and a "Verification" section. CHANGELOG entry.

Reviewer notes

  • The TestEvidence schema doesn't exist in traceability-matrix-dhf yet. That repo only has ValidationEvidence and VerificationRecord; TestEvidence is only in its design spec. The JSON Schema here follows the spec fields and is the contract until the real model lands. Check the two still match when it does.

  • How result is set (please review):

    • pass needs ACCEPTABLE and ndc ≥ 5.
    • UNACCEPTABLE gives fail.
    • MARGINAL, or ACCEPTABLE with ndc < 5, gives conditional.

    conditional isn't in VerificationRecord's pass/fail/blocked values.

  • Known bug, not fixed (the change is additive only): the out-of-control part labels are wrong when the CSV isn't sorted by part within each operator. The metrics are unaffected, and all bundled samples are sorted. It's pinned as a strict xfail and noted in the README. The fix is to key the ranges by part name.

  • grr_tool.py line coverage is 29%. Most of the file is chart and PDF code, and coverage doesn't count the command-line tests, which run in a separate process. compute_grr itself is fully exercised.

🤖 Generated with Claude Code

- tests/test_grr_calc.py: compute_grr checked against the AIAG MSA 4th Ed.
  reference study, a hand-calculated 2x2x2 study, and K constants re-derived
  from d2*; strict xfail pins the out-of-control part-label row-order issue
- --test-evidence / --requirement-ids: traceability-matrix-dhf TestEvidence
  (type=GRR) pointing at the PDF; PDF output byte-identical
- GitHub Actions CI on Python 3.9/3.11/3.12; README badges and docs

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@LSaiko
LSaiko merged commit 71c5e08 into master Sep 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant