Published API: 0.1.0a3¶
Historical evidence/reference from Narrative Contracts. The current project is MateProbe by Mate4B; see the migration guide. Original package names, versions and recorded results below identify that earlier work.
python -m pip install narrative-contracts==0.1.0a3 pytest-narrative-contracts==0.1.0a3
Python 3.11+; the pytest plugin is optional. Core runtime has zero third-party dependencies. You do not need to change your validator to start auditing it.
Audit an existing validator¶
Import AuditCase, Obligation, Verdict, ValidatorAuditReport, and
audit_validator from narrative_contracts.validator_audit. Import Relation
and Validity from narrative_contracts.mutations.
- Runnable audit and result semantics.
- Progressive adoption, beginning with a boolean adapter.
- Keep a survivor as a regression test, including the
narrative.audit_validator(...)pytest fixture and retained JSON artifacts. - Independent evidence flags and provenance.
- JSON Schema and Pydantic integration trials.
The adapter receives only the sample, not its expected findings. A rejection with no matching finding IDs is unattributed, not targeted detection. Errors and unknown variants remain in the denominator. The caller defines and justifies obligations, fault cases, and valid controls; the library does not infer labels.
State-conditioned checks¶
check_fields, CompareFields, and AllowedTransition are available from
narrative_contracts. See field bindings and bounded relations.
The Document/Claim constructors, contracts, evaluation states, CLI and original mutation API retain the a2 reference signatures. Install a3 when combining those APIs with the new helpers. The historical reference's a2 install commands are retained for reproducibility.
Report compatibility¶
External-validator reports use schema 2, including independent obligation flags;
assessment remains a display summary. The pytest envelope stays at schema 1 and
each nested report carries its own format. Package/report library_version is
0.1.0a3. Package versions and report schema versions describe different things.
No result certifies arbitrary prose as truthful or establishes general policy coverage. Review scope and limits before using a score.