Skip to content

feat: split platform-scoped features out of module_verification_report - #839

Open
antonkri wants to merge 3 commits into
mainfrom
feat/split-platform-verification-report
Open

antonkri wants to merge 3 commits into
mainfrom
feat/split-platform-verification-report

Conversation

@antonkri

@antonkri antonkri commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Why

module_verification_report currently mixes two different scopes in one report:

  • module-scoped Components (the report's own name/purpose)
  • platform-scoped Features, reached transitively through the module's components

This makes the module report noisy for anything that cares only about its own components, and there was no way to get an aggregated, platform-wide view of all Features in one place.

What changed

  • src/needs_templates/module_verification_report.need: removed the Feature-loop section (Requirements/Architecture/Inspection Statistics per Feature reached via belongs_to). The report now starts at Components and only covers the module's own components, as its name implies.
  • src/needs_templates/platform_verification_report.need (new): the feature-scoped counterpart. Instead of resolving Features through one module's component graph, it collects every Feature in the current build via the existing needs_of_type("feat") render-context helper, and renders the same Requirements/Architecture/Inspection statistics per Feature that were removed from the module report (plus a Feature Overview table, analogous to the module report's Component Overview).

Version scoping (report_version)

Both reports can now be scoped to a release milestone instead of always showing everything:

  • src/extensions/score_metamodel/metamodel.yaml: new optional report_version attribute on the document need type, using the same vMAJOR.MINOR[.PATCH] format already enforced for valid_from/valid_until.
  • src/extensions/score_sphinx_needs_templates/__init__.py: two new render-context helpers.
    • req_in_scope(need, report_version) decides whether a single requirement Need is in scope. feat_req/stkh_req carry valid_from directly; comp_req has no valid_from of its own, so it inherits scope from the feat_req it is derived_from. A requirement with no resolvable valid_from is excluded whenever a report_version is set.
    • any_req_in_scope(reqs, report_version) decides whether a Feature/Component has any requirement in scope.
  • Both .need templates use these helpers to:
    • restrict the Requirements Statistics needpies and the requirements needtable to id in [...] the in-scope requirement IDs, and
    • drop a Feature/Component from the report entirely (Overview table and its whole detail section) when none of its requirements are in scope, instead of rendering an empty section.
  • An unset/empty report_version keeps a report fully unscoped (all Features/Components/requirements shown), which is what doc__platform_verification_report_latest and similar "latest" reports rely on — this is opt-in and backward compatible.

module_verification_report previously rendered both the module's own
components AND every Feature reachable from those components, mixing
module-scoped and platform-scoped statistics into a single report.

- module_verification_report.need: drop the feature-loop section
  (Requirements/Architecture/Inspection Statistics per Feature). The
  report now covers Components only, as its name implies.
- platform_verification_report.need (new): the feature-scoped
  counterpart, listing every Feature in the current build (via the
  existing needs_of_type("feat") helper) with the same statistics that
  were removed from the module report.
@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-839: https://eclipse-score.github.io/docs-as-code/pr-839/

Adds an optional report_version attribute on document Needs. When set,
module_verification_report and platform_verification_report only show
requirements (and the Features/Components that own them) with
valid_from <= report_version. comp_req has no valid_from of its own,
so its scope is inherited from the feat_req it is derived_from.
Features/Components with no in-scope requirement are dropped from the
report entirely instead of rendering an empty section. Unset/empty
report_version keeps reports unscoped, matching prior behavior.
- ruff-format src/extensions/score_sphinx_needs_templates/__init__.py
  (2 lines that now fit on one line each).
- Regenerate the 13 checked-in _expected/needs_json + needs_local.json
  fixtures under src/tests/docs_bzl/scenarios to include the new
  report_version extra-option schema entry, matching what
  test_docs_bzl_scenario_expected_output already wrote locally when it
  detected the diff (CI fails this test on purpose after auto-updating,
  so the updated files can be reviewed and committed).
@antonkri

Copy link
Copy Markdown
Contributor Author

@MaximilianSoerenPollak , @AlexanderLanin please review and ideally approve ;-)

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Version expiration, duplicate Feature anchors, scalability, and missing integration coverage need resolution.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Splits verification reporting by scope and adds milestone-based requirement filtering.

Changes:

  • Adds a platform-wide Feature verification report.
  • Restricts module reports to Components.
  • Adds report_version metadata, filtering helpers, and updated snapshots.
File summaries
File Description
src/needs_templates/platform_verification_report.need Adds the platform report template.
src/needs_templates/module_verification_report.need Removes Feature sections and adds version filtering.
src/extensions/score_sphinx_needs_templates/__init__.py Adds requirement-scope helpers.
src/extensions/score_metamodel/metamodel.yaml Adds report_version.
src/tests/docs_bzl/scenarios/subdirectory_bundle/producer/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/subdirectory_bundle/consumer/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/score_platform/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/modern_module/docs/components/unlinked_component/_expected/needs_local.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/modern_module/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/legacy_module/docs/components/component/_expected/needs_local.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/legacy_module/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/reference_integration/_expected/needs_local.json Updates expected schema.
src/tests/docs_bzl/scenarios/nested_bundles/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/data_files_runfiles/_expected/needs_json/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/data_files_runfiles/_expected/isolated_source_bundle_needs/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/data_files_runfiles/_expected/data_bundle_needs/needs.json Updates expected schema.
src/tests/docs_bzl/scenarios/basic_docs/_expected/needs_json/needs.json Updates expected schema.
Review details
  • Files reviewed: 17/17 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +214 to +219
valid_from = need.get("valid_from")
if valid_from:
try:
return _parse_version(valid_from) <= _parse_version(report_version)
except ValueError:
return False
Comment on lines +25 to +26
{% for feature in needs_of_type("feat")|unique(attribute="id")|sort(attribute="title")|list %}
{% set feature_reqs = linked_needs(feature["id"], "satisfied_by_back")|selectattr("type", "eq", "feat_req")|list %}
{# The feature Need supplies the work-product document selector and the
navigation anchor, the same way components do in module_verification_report. #}
{% set feature_slug_norm = feature_title|replace("_", "")|replace(" ", "")|lower %}
{% set feature_anchor = feature_title|replace("_", "-")|replace(" ", "-")|lower %}
Comment on lines +25 to +27
{% for feature in needs_of_type("feat")|unique(attribute="id")|sort(attribute="title")|list %}
{% set feature_reqs = linked_needs(feature["id"], "satisfied_by_back")|selectattr("type", "eq", "feat_req")|list %}
{% if any_req_in_scope(feature_reqs, report_version) %}
@AlexanderLanin

Copy link
Copy Markdown
Member

Thanks a lot for putting this together — this is a substantial and useful change!
One thought for reviewability: would you be open to splitting it into two PRs? The first could focus on separating the module- and platform-scoped reports, and the second could introduce the  report_version  filtering. The existing commits already seem to map quite naturally to those two pieces, so hopefully this would mostly be a matter of rearranging the work rather than redoing it.
I think that would make both changes easier to review and reduce the risk of unintentionally mixing separate concerns.


We'll then somehow split the review between .py code by docs-as-code team, and .need code by process team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants