Repository navigation
Conversation
Allow parser instructions to resolve a list of component names to existing system objects. Document the result shapes and validate list, scalar, and serialization behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #176 +/- ##
==========================================
+ Coverage 98.04% 98.05% +0.01%
==========================================
Files 58 58
Lines 6597 6638 +41
==========================================
+ Hits 6468 6509 +41
Misses 129 129 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the opt-in component list-resolution change.
No open issues 🎉
What changed in this PR
Adds opt-in list resolution to ComponentReference, allowing parser rules to link multiple existing components from one source field while preserving the default single-component behavior.
Changes:
- Adds
resolve_as="list"with shape validation and preservation of order, duplicates, and component identity. - Adds coverage for invalid inputs, target-model validation, CSV/table aggregation, shared references, and serialization.
- Documents configuration and failure behavior with an executable parser example.
| File | Description |
|---|---|
tests/test_table_mapping.py |
Tests aggregated name resolution and serialization round trips. |
tests/test_ingestion.py |
Tests list and scalar resolution, validation, and identity preservation. |
tests/fixtures/ingestion_models.py |
Adds bus-group models with optional and required membership. |
src/r2x_core/models.py |
Defines and documents the resolve_as configuration field. |
src/r2x_core/ingestion.py |
Validates name lists and resolves them to existing components. |
skills/r2x-core/references/INGESTION.md |
Documents list-reference configuration and behavior. |
docs/src/content/docs/how-tos/build-parsers.md |
Adds table-mapping guidance and an executable list-resolution example. |
docs/source/references/parser.md |
Links to the reference API and list-resolution guide. |
Review effort: Balanced
Handle scalar and list references in separate branches and document why the validated modes allow this structure.
This branch has not been deployed
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
Add
ComponentReference.resolve_asso parser rules can resolve a source field containing multiple names to the existing components in a system. The defaultcomponentmode resolves one name. The opt-inlistmode resolves an ordered list without requiring individual references in configuration.The parser guide now shows how to aggregate names in a table mapping and resolve them in parser rules. The public API docstring and r2x-core ingestion reference describe the result shapes and failure behavior.
Acceptance criteria
resolve_as: "component".resolve_as: "list", preserving order, duplicates, and component identity.Deviations from the original plan
Testing Strategy
uv run --locked --no-sync pytest -q --no-cov tests/test_ingestion.py tests/test_table_mapping.py -k 'list_reference or scalar_reference or component_reference_schema_describes_result_shapes or component_reference_rejects_invalid_resolve_as or empty_reference_list or grouped_names'uv run --locked --no-sync pytest -q --no-cov tests/test_docs_doctest.py -k build-parsersuv run --locked --no-sync pytest -q --no-cov tests/test_docs_tutorial.py::CsvTutorialTest::test_marked_examples_have_checked_expectations tests/test_docs_doctest.py::test_documentation_expectations_are_copyableuv run --locked --no-sync pytest -q --no-cov tests/test_docs_generate_api.pyuv run --locked --no-sync ruff format --check src/r2x_core/ingestion.py src/r2x_core/models.py tests/fixtures/ingestion_models.py tests/test_ingestion.py tests/test_table_mapping.pymise run --skip-tools lintmise run --skip-tools typeReferences
src/r2x_core/ingestion.pydocs/src/content/docs/how-tos/build-parsers.md