Validate ADL 2.4 at-coded archetypes#799
Open
MattijsK wants to merge 3 commits into
Open
Conversation
Add support for validating at-coded ADL 2.4 archetypes, where structural
node identifiers use the 'at' prefix (e.g. at0000) instead of 'id'.
- Add NodeIdCodeSystemValidation setting {ID_CODED, AT_CODED, AUTO_DETECT},
defaulting to ID_CODED for backwards compatibility. AUTO_DETECT picks the
code system from the root node id.
- Add CodeSystemValidation enforcing a single, consistent node-id code system
that matches the configured/detected one, reported via the new
INVALID_NODE_ID_CODE_SYSTEM error type.
- Make BasicChecks root-node pattern and CodeValidation terminology lookup
code-system aware.
- Accept zero-padded at-coded codes (retained from ADL 1.4) in the structural
conformance/path helpers codesConformant and pathAtSpecializationLevel, so
flattening and specialization validation work for at-coded archetypes.
- Add Dutch translations for the new messages.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## adl_2.4_support #799 +/- ##
=====================================================
+ Coverage 72.28% 72.33% +0.04%
- Complexity 7233 7260 +27
=====================================================
Files 680 682 +2
Lines 23419 23467 +48
Branches 3795 3804 +9
=====================================================
+ Hits 16928 16974 +46
Misses 4753 4753
- Partials 1738 1740 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Fixes #791
Validate ADL 2.4 at-coded archetypes
Summary
Teaches the archetype validator to validate ADL 2.4 at-coded archetypes —
those whose structural node identifiers use the
atprefix (e.g.at0000,at0000.1) instead ofid(id1,id1.1). Builds on the existing ADL 2.4grammar (#659) and ADL 1.4 → ADL 2.4 at-coded converter (#658); this PR makes the
converter's output (and hand-written at-coded archetypes) pass validation,
including flattening and specialization.
Behaviour / configuration
A new
ArchetypeValidationSettings.nodeIdCodeSystemValidationoption controls whichnode-id code system is accepted:
ID_CODED(default)AT_CODEDAUTO_DETECTNew rule: an archetype must use a single, consistent node-id code system, and
it must match the configured/detected one. Violations (mixed systems, or wrong
system for the configuration) are reported via a new error type
INVALID_NODE_ID_CODE_SYSTEM.Changes
NodeIdCodeSystemValidationenum + setting (defaultID_CODED).ArchetypeValidationBase:expectsAtCodedNodeIds()resolver (auto-detect fromroot prefix) and a code-system-aware code-format check.
CodeSystemValidation(new, phase 0): enforces the single/consistent code-system rule.BasicChecks: root-node pattern is code-system-aware (at0000(.1)*vsid1(.1)*).CodeValidation/BasicTerminologyValidation: terminology lookups andcode-format/term-binding checks no longer assume the
idprefix.AOMUtils(codesConformant,pathAtSpecializationLevel): accept thezero-padded codes at-coded ADL 2.4 retains from ADL 1.4 (uses
isValidADL14Code,a strict superset of
isValidCode, so id-coded behaviour is unchanged). This iswhat makes at-coded flattening and specialization validation work.
ErrorType.INVALID_NODE_ID_CODE_SYSTEMadded.Tests
AtCodedArchetypeValidationTest(13 tests): at-coded passes underAT_CODED/AUTO_DETECTand is rejected under the defaultID_CODED(incl. via the no-settingsdefault validator); id-coded vice-versa; mixed systems rejected (both
AUTO_DETECTand explicit modes); malformed at-coded root; and a specialized at-coded archetype
that validates and flattens end-to-end (OBSERVATION + CLUSTER fixtures).
AOMUtilsTest.codesConformant: direct unit test of the core conformance change(id-coded, zero-padded at-coded, and prefix-collision non-conformance).
Compatibility & scope notes
ID_CODED, so existing behaviour is unchanged; full:aom/:toolssuites pass.
VARCNis retained for the root-node-form check (with an at-coded message variant);the new code-system-consistency rule uses the dedicated
INVALID_NODE_ID_CODE_SYSTEM.ArchetypeTerminology.idCodes(),hasIdCodeInAllLanguages()) still assume id-coded forms but aren't on the validationpath; can be revisited if at-coded OPT generation needs them later.