Fix: Fix rst based tests#537
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
AlexanderLanin
left a comment
There was a problem hiding this comment.
AI-assisted review (Claude):
Critical: 0 | Important: 2 | Suggestions: 2
The core fix — switching filter_warnings_by_position from substring-matching to startswith-with-stripping — is correct and the ANSI-code scrubbing is a good catch. Two issues need attention before merging.
Key concerns:
-
Pre-filtering
warningsto lines containing"score_metamodel"silently makes it impossible to assert on warnings from other Sphinx extensions (e.g., sphinx-needs itself). The one existing#EXPECT: unknown outgoing linktest was a casualty of this — the warning comes from sphinx-needs, not score_metamodel, so it disappears before any matching occurs. The test was removed rather than the root cause being documented or addressed. -
The
std_wp__test__abcdEXPECT-NOT intest_id_contains_feature.rstwas removed. If this EXPECT-NOT was previously a no-op (as the PR description says), and now fails after the fix, it means the "explicitly allowed" behavior is actually broken in production. Removing the test hides a real regression rather than fixing it.
| @@ -192,8 +207,13 @@ def test_rst_files( | |||
| app.build() | |||
|
|
|||
There was a problem hiding this comment.
AI-assisted review (Claude):
Important: Pre-filtering warnings to only "score_metamodel" lines is a semantic change that narrows the test scope silently. The removed #EXPECT: unknown outgoing link test (in test_metamodel_graph.rst) is a direct casualty: that warning originates from sphinx-needs, not score_metamodel, so it will never appear in this list. Any EXPECT annotation on a non-score_metamodel warning will now silently pass as a false positive.
If the intent is to restrict the test harness to score_metamodel warnings only, document that constraint clearly (e.g., a comment or docstring on the filter line), and explicitly state in the PR description that non-score_metamodel assertions are out of scope. The removed test should either be restored with a mechanism to include sphinx-needs warnings, or documented as intentionally dropped coverage.
There was a problem hiding this comment.
It doesn't narrow the scope silently, it narrows the scope to exactly what we want to test.
I will double check the documentation to make sure this is mentioned clearly in there.
| @@ -62,17 +62,6 @@ | |||
|
|
|||
There was a problem hiding this comment.
AI-assisted review (Claude):
Important: This removes a positive test (#EXPECT) for link validation against a non-existent parent. The prior EXPECT-NOT tests were no-ops — this EXPECT test is different. Removing it drops the assertion that the rule produces a warning for unknown outgoing links entirely.
The likely root cause: the warning from sphinx-needs (unknown outgoing link) doesn't contain "score_metamodel", so it gets filtered out by the new pre-filter on line 208. But the fix should be to handle that at the filter level, not to silently drop test coverage.
There was a problem hiding this comment.
This is a sphinx-needs warning / error. Not one of our own. I do not think we should start testing sphinx-needs functionality.
This did not work before either (as we filter on just errors coming from score_metamodel).
| @@ -13,13 +13,6 @@ | |||
| # ******************************************************************************* | |||
There was a problem hiding this comment.
AI-assisted review (Claude):
Important: This test verified that "feature deeper in path is explicitly allowed" behavior. If the old EXPECT-NOT was a no-op (as claimed), the rule's behavior for this case was never actually verified. Two outcomes are possible:
- The rule correctly does NOT warn → the test should be kept with a generic form like
#EXPECT-NOT: Feature 'test' not in path - The rule incorrectly DOES warn → removing the test hides the regression instead of fixing the rule
Please verify by running the test locally with the fix applied. If the rule is correct, restore this test in the new generic style.
There was a problem hiding this comment.
I could re-enable this test by renaming the need, or creating more folders.
As the current folder structure is not carried onto the error message (it's just '/' it doesn't go deeper than 1 folder).
What would be preferred here?
|
|
||
|
|
||
| #EXPECT-NOT: feat_saf_fmea__test__good_2.sufficient (yes): does not follow pattern `^(yes|no)$`. | ||
| #EXPECT-NOT: pattern |
There was a problem hiding this comment.
AI-assisted review (Claude):
Suggestion: "safety" and "pattern" are very broad substrings. For example, "safety" appears in many warning messages in this file — if the test fixture happens to generate an unrelated safety warning at the same line (e.g., from a different check), the EXPECT-NOT will silently pass regardless. A slightly more specific fragment — e.g., "does not follow pattern" or "safety level" — would remain generic enough to survive message rewording while being far less likely to match false positives.
This is a tradeoff the author can judge, but worth flagging for the safety-critical context of this codebase.
There was a problem hiding this comment.
I'm unsure if making it more specific is needed / good.
In this line we would not expect ANY warning regarding pattern or safety. So I think keeping it broad makes more sense? Thoughts?
|
|
||
|
|
||
| .. Parent requirement does not exist | ||
| #EXPECT: unknown outgoing link |
There was a problem hiding this comment.
This is a sphinx-needs warning / error. Not one of our own. I do not think we should start testing sphinx-needs functionality.
This did not work before either (as we filter on just errors coming from score_metamodel).
|
@FScholPer Just noticed a merge commit on this, was that by accident on this branch? |
a-zw
left a comment
There was a problem hiding this comment.
LGTM
(maybe undo the main-merge for cleanliness)
Expect-Not tests were not executed correctly and often were a no-op. This change fixes that and makes them actually test things and relevant. Changed behaviour of test checking too to enable more general usage.
583e959 to
351c01f
Compare
Expect-Not tests were not executed correctly and often were a no-op.
This change fixes that and makes them actually test things and relevant.
Changed behaviour of test checking too to enable more general usage.
Also changed all of the EXPECT-NOT to be generic instead of specific.
📌 Description
🚨 Impact Analysis
✅ Checklist