Add test harness, CI, and RiskControl evidence export for traceability-matrix-dhf - #1
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
generate --evidence writes <output>.risk.json (source=foremode) alongside the unchanged openpyxl workbook; records validate against DHF's RiskControl schema. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
1. Tests and CI (
e04402a)test_golden.pysaves a SHA-256 fingerprint of every workbook cell value for all 3 scenarios, with and without--iso14971. The fingerprints were taken before any code change, so any unintended change to the openpyxl output fails the test. After an intended output change, refresh them withpython test_golden.py --update.generate --format allfor each scenario (xlsx, docx and pdf)..github/workflows/ci.yml: pytest on Python 3.9 and 3.13, a 75% coverage minimum (measured: 77%), andcheckon all 3 scenarios.devinstall option inpyproject.toml, and pytest-cov settings.2. Risk evidence export (
3b4d929)generate --evidencewrites<output>.risk.jsonnext to the workbook. The workbook itself is unchanged; the golden test verifies this.source: "foremode"at the top level and arisk_controlslist. Each record matches traceability-matrix-dhf'sRiskControlmodel. A copy of that schema lives atschemas/risk-control.schema.json.hazardandharmcome from the iso14971 fields in the scenario, falling back to the failure mode and effect.severity= ceil(S/2) andprobability= ceil(O/2), converting the 1–10 pFMEA scale to the 1–5 DHF scale.control_measure= prevention + detection controls, plus the planned action if there is one.residual_risk_acceptableis leftnullfor a quality engineer to decide.3. README (
8624eab)Reviewer notes
RiskRecordschema that doesn't exist. traceability-matrix-dhf has nodocs/adapters.mdand noRiskRecordon any branch; Persist the DHF store in SQLite behind a TraceabilityStore interface traceability-matrix-dhf#1 didn't add one. This PR targets theRiskControlmodel that ingestion already accepts.RiskControldoesn't allow extra fields, sosourcegoes on the top level of the file rather than on each record.test_evidence.pyalso loads the records into the live DHFDhfProjectmodel when a sibling../traceability-matrix-dhfcheckout exists, and checks that the schema copy still matches that model. It is skipped in CI, where there's no sibling checkout.🤖 Generated with Claude Code