fix(validation): match feature files to the longest API name in scope#366
Merged
hdamker merged 1 commit intoJul 7, 2026
Conversation
_stem_matches_api accepted a bare {api-name}-{suffix} stem, so a prefix-sibling
API (dedicated-network) over-claimed a longer sibling's feature file
(dedicated-network-areas.feature) and version-checked it against the wrong
info.version — a false P-025/P-007 FAIL on the DedicatedNetworks r2.2 release
review. The three feature-file checks now consult the full release-scope
API-name set (ValidationContext.all_api_names) so the longest matching name wins.
Fixes camaraproject#365
This was referenced Jul 7, 2026
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.
What type of PR is this?
bug
What this PR does / why we need it:
_stem_matches_apimatched a feature-file stem{api-name}-{suffix}to{api-name}, so when one API name is a prefix of a sibling's (e.g.dedicated-networkvsdedicated-network-areas), the shorter API claimed the sibling's.featurefile and validated it against the wronginfo.version. On DedicatedNetworks r2.2 (camaraproject/DedicatedNetworks#128) this surfaced as 11 false P-025 errors + 1 false P-007 hint ondedicated-network-areas.feature.Root cause ran deeper than the matcher: the per-API dispatch in
python_adapter.pynarrowscontext.apisto a single element, so the three feature-file checks never saw sibling API names to disambiguate with.Fix:
ValidationContext.all_api_names— the full release-scope API-name set. It survives the per-APIdataclasses.replacenarrowing, so API-scoped checks can see their siblings.{api-name}-{suffix}stem yields to a longer API name in scope that is also anchored on it. Per-operation split files (whose suffix is not itself an API name) still match their base API.check-test-file-version(P-007),check-feature-file-url-version(P-025), andcheck-test-files-exist.Which issue(s) this PR fixes:
Fixes #365
Special notes for reviewers:
Regression tests use the real DedicatedNetworks constellation (
dedicated-network+dedicated-network-areasat different versions), covering all three callers plus the per-operation-split case (no over-correction). Regression and existingtest_python_checks_*/test_context_builderunit tests pass locally.Changelog input
Additional documentation
This section can be blank.