conformance: add runnable AKN4OLF conformance suite - #1
Open
Sipioteo wants to merge 1 commit into
Open
Conversation
Implement the six conformance criteria from the spec README as a
dependency-free Python library and CLI under conformance/:
1. schema-valid Akoma Ntoso in a recognized profile (structural;
optional offline XSD via AKN4OLF_XSD)
2. required AKN4OLF lifecycle events present and well-formed
3. every <ref> resolves to an OLF id or is explicitly unresolved
4. temporal validity monotonic (envelope vs non-overlapping version slices)
5. as-enacted text reconstructible from a multi-version document
(NOT-APPLICABLE for single-version/monovigente inputs)
6. OLF identifiers stable across two regenerations (stability check)
Each criterion reports PASS/FAIL/NOT-APPLICABLE with a human-readable
reason; NOT-APPLICABLE never gates. CLI prints a per-criterion table and a
final CONFORMANT/NON-CONFORMANT verdict, exiting non-zero on failure.
Ship a conformant real Normattiva sample, a synthetic multi-version
conformant sample, a deliberately non-conformant sample, and a self-test.
Resolve the README ./conformance link (previously 404) and add a short
pointer on how to run the suite.
Signed-off-by: Sipioteo <matteo@sipio.it>
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.
Summary
The spec README points to
./conformanceand calls the conformance suite "the heart of the project … the only gate", but that directory did not exist (the link 404'd). This PR adds the real, runnable suite.A new
conformance/package implements the six criteria from the README as a dependency-free Python library + CLI (standard library only —xml.etree.ElementTree), so any adapter author can run it.What's included
conformance/akn4olf_conformance.py— library + CLI implementing criteria 1–6.conformance/__init__.py— public API:check(),stability(), report types.conformance/README.md— per-criterion definitions, what is mechanically enforced vs advisory, how to run.conformance/samples/— a real Normattiva conformant sample (single-version), a synthetic multi-version conformant sample, and a deliberately non-conformant sample.conformance/selftest.py— self-test over the bundled samples.README.md— the./conformancelink now resolves; added a short pointer with run commands.The six criteria
{akn}akomaNtosoroot; one recognized document element (act/bill/doc/…) with{akn}meta; the OLFproprietary source="#openlawsfoundation"agent IDREF resolves to a declaredTLCOrganization. Structural by default and labelled as such; validates against an offline AKN XSD if one is provided viaAKN4OLF_XSD(with lxml). No official XSD is bundled.<olf:lifecycle>with a valid ISOinForceFrom; events drawn from the fixed vocabulary {enacted, published, commenced, amended, repealed} with valid dates. The README does not enumerate the mandatory set in prose, so the suite adopts a minimal, stated interpretation (requireinForceFrom+ a matchingcommenced) documented in code and the README.<ref>resolved-or-unresolved — each{akn}refcarries either a well-formed{olf}targetOLF id or{olf}resolution="unresolved"; reports counts.<temporalGroup>version slices (which must be pairwise non-overlapping and contained in the envelope).monovigenteinputs.--compareorstability().NOT-APPLICABLEcriteria are surfaced but never make a document non-conformant.How to run
The CLI exits 0 on CONFORMANT (and stability PASS) and 1 otherwise, for direct CI use.
Validation
python -m conformance.selftest→ all assertions hold.Honest limitations (documented in
conformance/README.md)--compare).