Skip to content

Map snippets to IfVersion contexts - #1312

Draft
danielporterda wants to merge 1 commit into
snippet-validate-basic-attributesfrom
snippet-map-condition-context
Draft

Map snippets to IfVersion contexts#1312
danielporterda wants to merge 1 commit into
snippet-validate-basic-attributesfrom
snippet-map-condition-context

Conversation

@danielporterda

@danielporterda danielporterda commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

What changed

Associates each parsed <Snippet> tag with its innermost enclosing validated <IfVersion> condition.

Unconditional snippets map to no condition; snippets in either the primary or fallback branch map to the same enclosing condition; nested snippets map to the innermost condition. This layer assumes structural and condition-attribute validation have already succeeded and does not compare source identity.

Why

Determining context is separate from deciding whether a candidate PR source matches that context.

Validation

  • python -m pytest tests/test_snippet_condition_context.py tests/test_if_version_structure_validation.py tests/test_if_version_attribute_validation.py (18 passed)
  • python -m ruff check scripts/snippets/model.py scripts/snippets/semantics.py tests/test_snippet_condition_context.py
  • python -m mypy scripts/snippets/model.py scripts/snippets/semantics.py
  • git diff --check

Signed-off-by: danielporterda <daniel.porter@digitalasset.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant