validation: scan early lines for Feature: in .feature test files#249
Merged
hdamker merged 1 commit intocamaraproject:validation-frameworkfrom Apr 30, 2026
Merged
Conversation
P-007 / P-024 read only line 1 and fired P-024 as error when the Feature line was preceded by a comment or feature-level tag (valid Gherkin in 9 of 49 upstream API repos). Pure validation false positive — release-time transformation is unaffected by Feature-line position. Scan the first 50 lines for `Feature:`, skip preceding comment, tag, and blank lines, and report findings at the actual Feature-line number. Split P-024 into two sub-cases with distinct messages: no `Feature:` line in the scan window, vs. Feature line present without a version token. Drop the implementation-coupling "T1b" phrasing from user-facing messages; revise the P-024 rule comment. Fixes camaraproject#248
This was referenced Apr 30, 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:
P-007/P-024(validation/engines/python_checks/test_checks.py,_extract_feature_version) read only the first physical line of each.featurefile. When line 1 is a Gherkin comment or a feature-level tag, the version regex finds no match andP-024fires as a hard error.Both styles are valid Gherkin and consistent with
documentation/API-Testing-Guidelines.mdincamaraproject/Commonalities. A sweep across the 49 upstream API repositories with acode/Test_definitions/directory shows 25 files in 9 repositories with this layout (DeviceIdentifier,DeviceStatus,DeviceReachabilityStatus,DeviceRoamingStatus,ConnectedNetworkType,ApplicationEndpointDiscovery,ApplicationEndpointRegistration,ApplicationProfiles,OptimalEdgeDiscovery).The release-time mechanical transformer is unaffected —
_apply_regexrunsre.subnon full file content, so it correctly transforms these files regardless of Feature-line position. The validation rule was the only thing flagging them.This PR:
_extract_feature_version()to scan the first 50 lines for a line beginning withFeature:(skipping preceding comment, tag, and blank lines) and to return the actual Feature-line number alongside the version.P-007/P-024findings at the actual Feature-line number rather than a hardcodedline=1.P-024into two sub-cases with distinct messages: (1) noFeature:line in the scan window, (2) Feature line present but carrying nowip/vwip/v{version}token.P-024rule comment block invalidation/rules/python-rules.yaml.No release-automation changes. No regression-fixture recapture (the
regression/r4.2-broken-spec-test-filesregression-expected.yamlhas no P-007/P-024 entries).Which issue(s) this PR fixes:
Fixes #248
Special notes for reviewers:
Verified locally:
python3 -m pytest validation/tests/test_python_checks_test.py -v), including 8 new cases covering comment/tag/blank-line preambles, the actual line number reported in findings, the two distinct P-024 sub-cases, and the 50-line scan cap.DeviceIdentifierfeature files now resolves('vwip', 2)for each — the original false positive is gone.Tag-move scope: rule-metadata tier (
validation/engines/python_checks/**,validation/rules/python-rules.yaml,validation/tests/**). Validation Regression canary green is sufficient — no full ReleaseTest E2E required.Changelog input
Additional documentation
This section can be blank.