Repository navigation
perf: replace unscoped verification pages with a TVR summary - #1093
AlexanderLanin wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The cross-cutting change involves Sphinx-Needs callbacks, Bazel provenance, external JUnit imports, and incremental environment state that automated inspection cannot validate end to end.
No open issues 🎉
What changed in this PR
This PR scopes docs-as-code verification reports to relevant tests and requirements, adds Bazel module provenance to JUnit testcase Needs, and improves duplicate-ID handling and incremental testcase replacement.
Changes:
- Added module-aware testcase provenance, serialization, metamodel support, and generated expectations.
- Added scoped tooling verification and requirement coverage filters, including cross-module links.
- Propagated module configuration through the CLI and Bazel documentation builds.
- Added tests for duplicate test identities, incremental cleanup, serialization, and scoped metrics.
| File | Description |
|---|---|
| src/tests/docs_bzl/scenarios/reference_integration/score_platform/_expected/needs_json/needs.json | Updates expected Needs metadata to include Bazel module provenance. |
| src/tests/docs_bzl/scenarios/reference_integration/modern_module/docs/components/unlinked_component/_expected/needs_local.json | Updates expected local Needs metadata for module provenance. |
| src/tests/docs_bzl/scenarios/reference_integration/modern_module/_expected/needs_json/needs.json | Updates expected exported Needs metadata for the modern module. |
| src/tests/docs_bzl/scenarios/reference_integration/_expected/root_needs_local.json | Updates root Needs metadata expectations. |
| src/tests/docs_bzl/scenarios/reference_integration/_expected/docs/modules/modern_module/components/unlinked_component/generated_metamodel/index.html | Updated as part of this pull request. |
| src/extensions/score_source_code_linker/xml_parser.py | Records the source Bazel module for parsed JUnit testcases. |
| src/extensions/score_source_code_linker/tests/test_testlink.py | Tests testcase serialization with module provenance. |
| src/extensions/score_source_code_linker/tests/test_testcase_needs.py | Tests module-aware testcase Need construction and identifiers. |
| src/extensions/score_source_code_linker/tests/test_source_code_link_integration.py | Tests cross-module duplicate test identities and incremental testcase removal. |
| src/extensions/score_source_code_linker/testlink.py | Adds source-module data to testcase models and serialization. |
| src/extensions/score_source_code_linker/testcase_needs.py | Adds module-aware IDs and provenance while replacing stale imported testcase Needs. |
| src/extensions/score_source_code_linker/__init__.py | Integrates testcase replacement and local module configuration. |
| src/extensions/score_metrics/tests/test_sphinx_filters.py | Tests scoped tooling and requirement coverage metrics. |
| src/extensions/score_metrics/sphinx_filters.py | Implements module- and requirement-scoped report filters. |
| src/extensions/score_metamodel/metamodel.yaml | Allows optional Bazel module metadata on testcase Needs. |
| src/docs_cli/main_test.py | Tests forwarding of the local testcase module setting. |
| src/docs_cli/cli.py | Passes the local testcase module setting into Sphinx configuration. |
| docs/internals/requirements/tooling_verification.rst | Scopes tooling verification charts and tables to docs-as-code tests. |
| docs/internals/requirements/requirements.rst | Tags docs-as-code tool requirements for scoped reporting. |
| docs/internals/requirements/requirement_coverage.rst | Scopes requirement coverage charts and traceability tables. |
| docs.bzl | Supplies the owning Bazel module to documentation builds. |
Review effort: Lite
59b7788 to
00824fd
Compare
00824fd to
a325998
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The change has unresolved correctness and test-execution defects: Bazel Needs actions do not receive the module name, and a unit-test stub lacks the configuration attributes now required by the implementation.
3 open issues
Review effort: Lite
|
Documentation preview for this pull request is available at: |
a325998 to
7a6bb47
Compare
7a6bb47 to
5feb6f6
Compare
5feb6f6 to
2513d96
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A critical linkage bug causes all verification links to be skipped and the traceability table to remain empty, while a new test also lacks required metadata for the documentation build.
5 open issues
1 resolved since last review
Review effort: Lite
There was a problem hiding this comment.
🟡 Changes recommended
Three critical issues remain in the report template: summary counts can duplicate malfunctions, unassessed detection yields a contradictory HIGH classification, and requirements from unassessed malfunctions can be incorrectly excluded from qualification accounting.
5 open issues
2 resolved since last review
Review effort: Lite
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
Copilot feedback has to be read through, and addressed if still valid.
I would also change the test to a end_to_end test to increase readability and make having an easy to build example simple.
The template is really hard to read wihtout indentation but I guess we can't do much there.
| derivation | ||
| ) | ||
| # This project has no bundle ownership, so the report has no module to | ||
| # list requirements and testcases for. |
There was a problem hiding this comment.
The sentence just seems to cut off.
There was a problem hiding this comment.
Reworded in e258069: this project is not built through Bazel, so the report has no Bazel module whose other tool requirements and testcases it could count.
| "sphinx_needs", | ||
| "score_sphinx_needs_templates", | ||
| "score_metamodel", |
There was a problem hiding this comment.
Not better to use the bundle extension to catch unwanted consequences however unlikely?
There was a problem hiding this comment.
Done in e258069b9: the module case is now an end-to-end scenario that mounts the docs of a real second Bazel module, so the bundle lookup is no longer patched.
| def test_tool_qualification_report_lists_uncovered_requirements_of_its_own_module( | ||
| tmp_path: Path, | ||
| monkeypatch: pytest.MonkeyPatch, |
There was a problem hiding this comment.
This looks to me like this should be a end_to_end test. There is 100 lines of RST jsut berried in here. Wouldn't this be much easier to read and follow as an end_to_end test? That's why we restructured them .
You could still have all the pytest asserts same as before no?
There was a problem hiding this comment.
there was nu module in end to end when i started this PR 😆
There was a problem hiding this comment.
Done in e258069b9: new scenario src/tests/end_to_end/scenarios/tool_qualification_report with the same assertions in test_tool_qualification_report.py. Only the unassessed-detection cases stay unit tests, because the metamodel rejects that input in a real -W build.
| {% set report_scope = namespace(requirement_ids=[], test_ids=[]) %} | ||
| {% set verification = namespace(fully=0, partially=0, unverified=0, test_ids=[], tests=[]) %} | ||
| {% for malfunction_id in malfunction_scope.ids %} | ||
| {% for requirement in linked_needs(malfunction_id, "violates")|selectattr("type", "equalto", "tool_req")|list %} | ||
| {% if requirement["id"] not in report_scope.requirement_ids %} | ||
| {% set report_scope.requirement_ids = report_scope.requirement_ids + [requirement["id"]] %} | ||
| {% set fully_verifying_tests = linked_needs(requirement["id"], "fully_verifies_back")|list %} | ||
| {% set partially_verifying_tests = linked_needs(requirement["id"], "partially_verifies_back")|list %} | ||
| {% for test in fully_verifying_tests + partially_verifying_tests %} | ||
| {% if test["id"] not in report_scope.test_ids %} | ||
| {% set report_scope.test_ids = report_scope.test_ids + [test["id"]] %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% if requirement["id"] in qualification_requirement_scope.ids %} | ||
| {% if fully_verifying_tests %} | ||
| {% set verification.fully = verification.fully + 1 %} | ||
| {% elif partially_verifying_tests %} | ||
| {% set verification.partially = verification.partially + 1 %} | ||
| {% else %} | ||
| {% set verification.unverified = verification.unverified + 1 %} | ||
| {% endif %} | ||
| {% for test in fully_verifying_tests + partially_verifying_tests %} | ||
| {% if test["id"] not in verification.test_ids %} | ||
| {% set verification.test_ids = verification.test_ids + [test["id"]] %} | ||
| {% set verification.tests = verification.tests + [test] %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% endif %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% endfor %} | ||
| {% set requirements_without_qualification = report_scope.requirement_ids|length - qualification_requirement_scope.ids|length %} | ||
| {% set result_parts = namespace(items=[], known=0) %} | ||
| {% for result, singular, plural_wording in [("passed", "passed", "passed"), ("failed", "failed", "failed"), ("skipped", "was skipped", "were skipped"), ("disabled", "is disabled", "are disabled")] %} | ||
| {% set result_count = verification.tests|selectattr("result", "equalto", result)|list|length %} | ||
| {% set result_parts.known = result_parts.known + result_count %} | ||
| {% if result_count %} | ||
| {% set result_parts.items = result_parts.items + [result_count ~ " " ~ (singular if result_count == 1 else plural_wording)] %} | ||
| {% endif %} | ||
| {% endfor %} | ||
| {% set results_missing = verification.tests|length - result_parts.known %} | ||
| {% if results_missing %} | ||
| {% set result_parts.items = result_parts.items + [results_missing ~ (" has" if results_missing == 1 else " have") ~ " no result"] %} | ||
| {% endif %} | ||
| {% set all_passed = verification.tests and verification.tests|selectattr("result", "equalto", "passed")|list|length == verification.tests|length %} | ||
| {% if not verification.tests %} | ||
| {% set verification_results = "No testcase verifies them yet." %} | ||
| {% elif all_passed %} | ||
| {% set verification_results = ("The verifying testcase passed." if verification.tests|length == 1 else "All " ~ verification.tests|length ~ " verifying testcases passed.") %} | ||
| {% else %} | ||
| {% set verification_results = "Of " ~ plural(verification.tests|length, "verifying testcase") ~ ", " ~ result_parts.items|join(", ") ~ "." %} | ||
| {% endif %} |
There was a problem hiding this comment.
Just a comment.
Without indentation this is so bad to read. ^^
There was a problem hiding this comment.
Improved in e258069b9: the computing part of the template now uses {%- -%} on every tag, so it is indented and commented without emitting blank lines into the RST. The rendered output is unchanged. The RST part below has to stay as is, since there indentation is output.
There was a problem hiding this comment.
🔵 Needs a closer look
Human assessment is needed because a safety-relevant malfunction can be misclassified as out of scope in the report’s pie chart, conflicting with the conclusion’s indeterminate state and the derivation’s still-open semantics.
2 open issues
1 resolved since last review
Review effort: Lite
The computing part of the Tool Verification Report template now uses
`{%- -%}` on every tag, so it can be indented and commented without emitting
blank lines into the RST. Helpers are grouped first, the use case and
malfunction scopes follow. The rendered report is unchanged.
The conclusion of the Tool Verification Report used to list ratios such as "1/2 safety-relevant malfunctions have insufficient detection" and left the reader to combine them. It now opens with one sentence: the tool must be qualified, does not need to be, or cannot be classified yet because the detection of a safety-relevant malfunction is not assessed. In that last case the report no longer claims `tcl: HIGH`, and the evaluation overview marks the malfunction as "open" instead of "HIGH". A new "How the conclusion is derived" section explains the classification, the qualification scope and what "fully" and "partially" verified mean.
The qualification scope paragraph now also covers the tool requirements of the report that are not in the scope: - a requirement violated only by safety-relevant malfunctions without a detection assessment is still open, also when no malfunction needs qualification yet; - a requirement violated only by malfunctions that need no qualification is out of scope. Each malfunction is now collected once, and the classification counts are taken from that collection.
The conclusion now states how many tool requirements in the qualification scope are linked to fully verifying, only partially verifying or no testcases, and what the verifying testcases resulted in. Every testcase is counted once: an unexpected result is named, and a testcase without a result is counted as such. A new "Verifying testcases" section counts these testcases by test type and derivation technique; testcases without that metadata count as "not set".
Templates can call `document_bazel_module(docname)` to get the Bazel module of the bundle that supplied a document. A post-template cannot read `bazel_module` from its own Need, because that field is only assigned after all documents are collected, but the template is rendered while its Need is created. `score_mounts` gains `get_document_bundle()`, which looks up one document without copying the whole mapping, so it is cheap enough to call per Need.
The conclusion now counts the tool requirements and testcases of the report's own Bazel module that the report does not reach: requirements no malfunction violates, and testcases that verify none of the report's requirements. The derivation explains why they matter, and a "Not covered by this report" section lists the uncovered tool requirements. Mounted modules and imported Needs are not counted. A local Need without a module yet belongs to the module of its document; an imported one never falls back to the document that imports it.
A new scenario builds a Tool Verification Report in a real Bazel module, next to the mounted documentation of a second module and an imported inventory. Its verifying testcases cover every result once. The tests check the verdict and its evidence, a requirement without qualification need, that only the report's own module is checked for gaps, and the design summary of the verifying testcases. The scenario's lock file also picks up score_tools 0.0.5, which main already depends on.
When Reference Integration mounts docs-as-code, the "Tooling Verification" and "Requirement Coverage" pages list every passing test in the build, not only those of docs-as-code. In the build measured for eclipse-score#1076 that was 33,360 rows per table. The Tool Verification Report now summarizes the verification of its own qualification scope and the gaps of its own module instead, so both pages and the `get_metrics_with_first_value_total` filter only they used are removed. Refs eclipse-score#1076.
986e3b9 to
62a029f
Compare



Why
When Reference Integration mounts docs-as-code, the Tooling Verification and Requirement Test Coverage pages list every passing test in the build. In the build measured for #1076, that was 33,360 rows per table. The pages are slow to render, and the relevant tests are hard to find.
Refs #1076.
What
HIGH: the tool "cannot be classified yet", and the requirements only it violates stay open.Conclusion: before → after
Removed pages (before): Tooling Verification, Requirement Test Coverage
Notes for reviewers
src/tests/end_to_end/scenarios/tool_qualification_reportshows a complete example: a report next to the mounted docs of a second Bazel module, whose requirements and testcases must not be counted.tool_reqin the build, not just the module's. Left for a follow-up.