Skip to content

test: cover reference scopes at non-property locations - #127

Merged
Artifizer merged 1 commit into
mainfrom
test/ref-scope-non-property-locations
Oct 24, 2026
Merged

Artifizer merged 1 commit into
mainfrom
test/ref-scope-non-property-locations

Conversation

@Artifizer

@Artifizer Artifizer commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

OP#8 (evolution) and OP#12 (derivation) reference-scope comparison was only exercised with reference keywords on top-level properties. README §9.6.3 requires the same dialect-aware traversal at every schema location — explicitly "array-item schemas" and composition branches — so a conformant implementation must apply the kind/coverage-aware subset comparison there too.

This adds conformance cases for the two locations that traversal is most likely to miss:

  • OP#12 (test_op12_type_derivation_validation.py)
    • test_pattern_ref_derivation_compares_array_items — x-gts-pattern-ref under array items (narrowing/equal/widening).
    • test_entity_ref_derivation_compares_array_items — x-gts-type-ref/x-gts-instance-ref under items.
    • test_pattern_ref_derivation_conjoins_allof_within_a_property — a reference nested in a property's own allOf, conjoined with a sibling branch, must not be dropped.
  • OP#8 (test_op8_compatibility_checking.py)
    • test_pattern_ref_evolution_compares_array_items and test_entity_ref_evolution_compares_array_items — the same operands under items, in both compatibility directions.

All cases reuse the existing §9.6.2 RESOURCE ⊊ FAMILY and entity T ⊋ D operand pairs and are parametrized across the three dialects. Docstrings and per-row comments state the expected verdict and the failure mode of a properties-only implementation.

Test plan

  • Pass against a reference implementation that compares items/allOf scopes (57 new cases).
  • Fail against one that compares only top-level properties (the widening/allOf cases) — confirming the tests exercise the gap rather than passing vacuously.
  • Existing OP#8 + OP#12 suites unaffected (470 passed = 413 existing + 57 new).

Summary by CodeRabbit

  • Tests
    • Expanded coverage for schema validation and compatibility checks involving references in array items and nested constraints.

OP#8 and OP#12 reference-scope comparison was only exercised on top-level
properties, but README §9.6.3 requires the same dialect-aware traversal at
every schema location, including array-item schemas and allOf branches.

Add OP#12 derivation and OP#8 evolution cases that place the same pattern-
and entity-reference operands under array items (narrowing/equal/widening),
plus an OP#12 case where a reference nested in a property's own allOf is
conjoined with a sibling branch. Each uses the §9.6.2 RESOURCE ⊊ FAMILY and
entity T ⊋ D operand pairs; docstrings state the expected verdict and the
failure mode of a properties-only implementation.

Signed-off-by: Artifizer <artifizer@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f488a455-05ad-48f2-91aa-579264496b4d
Commits

Reviewing files that changed from the base of the PR and between 0085d13 and 67716df.

Files selected for processing: 2
  • tests/test_op12_type_derivation_validation.py
  • tests/test_op8_compatibility_checking.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Walkthrough

Added tests for type derivation and compatibility behavior when reference keywords appear in array item schemas. Derivation tests also cover a pattern reference nested within a property’s allOf.

Changes: Nested Reference Scope Tests

Layer / File(s) Summary
Derivation scope checks
tests/test_op12_type_derivation_validation.py
Tests check whether pattern, type, and instance reference scopes in array items are equal to or narrower than base scopes. They also check that widening is rejected and that a pattern-reference constraint in a property’s allOf is preserved.
Compatibility scope checks
tests/test_op8_compatibility_checking.py
Tests check compatibility results for widening, narrowing, and equal pattern, type, and instance reference scopes in array items.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: aviator5

Merge Risk: Minimal · up to 67716

No merge-blocking concern is established for the added reference-scope tests; merge after normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 77.78% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: adding tests for reference scopes at non-property schema locations.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Artifizer
Artifizer merged commit 063e24a into main Oct 24, 2026
7 checks passed
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.

2 participants