feat: module verification report / complex templates - #763
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 |
|
Documentation preview for this pull request is available at: |
There was a problem hiding this comment.
Pull request overview
This PR adds infrastructure for complex Sphinx-Needs .need templates (including graph traversal and a post-merge re-render pass) and introduces an initial “tiny” module verification report template that generates real Sphinx sections for navigation/ToC.
Changes:
- Added a new
score_sphinx_needs_templatesSphinx extension that (a) registers the shared templates folder, (b) exposes alinked_needs()helper, and (c) re-reads pages with markedpost_templates after parallel Needs collection is merged. - Added a complex
mod_ver_report_tiny.needtemplate that builds feature/component sections and summary tables/pies from the Need graph. - Wired the new extension into the Sphinx bundle and added a new
auto_mod_ver_reportneed type.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/needs_templates/mod_ver_report_tiny.need | New complex post-template for module verification reports with feature/component sections and statistics. |
| src/extensions/score_sphinx_needs_templates/README.md | Documents the new extension behavior and the linked_needs helper. |
| src/extensions/score_sphinx_needs_templates/BUILD | Bazel target for the new extension, including templates as runtime data. |
| src/extensions/score_sphinx_needs_templates/init.py | Implements template folder discovery, linked_needs, and the marked-page second read. |
| src/extensions/score_sphinx_bundle/BUILD | Drops direct template data dependency and depends on the new templates extension instead. |
| src/extensions/score_sphinx_bundle/init.py | Loads score_sphinx_needs_templates and removes bundle-local template folder config. |
| src/extensions/score_metamodel/metamodel.yaml | Adds auto_mod_ver_report need type. |
| src/BUILD | Exposes the new extension’s sources at the top-level filegroup. |
Suppressed comments (1)
src/needs_templates/mod_ver_report_tiny.need:259
- Same as above: these
needpiefilters depend onlocals()/len(), which may not be available in Sphinx-Needs filter expressions. Using direct boolean checks on the backlink fields is simpler and avoids evaluation errors.
type == "comp_req" and "{{ component_id }}" in satisfied_by and ("fully_verifies_back" in locals() and len(fully_verifies_back) > 0)
type == "comp_req" and "{{ component_id }}" in satisfied_by and ("partially_verifies_back" in locals() and len(partially_verifies_back) > 0) and not ("fully_verifies_back" in locals() and len(fully_verifies_back) > 0)
type == "comp_req" and "{{ component_id }}" in satisfied_by and not ("fully_verifies_back" in locals() and len(fully_verifies_back) > 0) and not ("partially_verifies_back" in locals() and len(partially_verifies_back) > 0)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Downstream SCORE repositories currently have no independent, at-a-glance view of whether their module verification report builds pass. This adds a standalone tool that checks out each configured repository, runs its docs build, and aggregates the results into a single gallery whose index page is designed for non-developers: a plain-language summary count, status badges, and collapsed failure details instead of a raw technical table.
…n reports The generated report page used a bespoke auto_mod_ver_report need type that only supported belongs_to, so it could not participate in the document/workproduct realization model the rest of the metamodel uses. Switching it to the generic document type and linking realizes: wp__verification_module_ver_report brings it in line with that model. document has no belongs_to link, so mod_ver_report_tiny now recovers the module id from the report's own id (doc__<module>_verification_report) instead.
Drop the locals()/len() guards around the fully_verifies_back / partially_verifies_back needpie filters - those backlink fields always exist on comp_req/feat_req needs, so a plain truthy check suffices and avoids a possible NameError in the filter eval context. Also swap the internal app.events.emit() call for the public app.emit() wrapper.
MaximilianSoerenPollak
left a comment
There was a problem hiding this comment.
The consumer tests for module_verification_report are in here as a first pass.
That code will reworked & refactored in the future and is currently not fully working but a good starting point.
TAlked about in a call, seems okay-ish.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 5 comments.
Suppressed comments (1)
src/extensions/score_sphinx_needs_templates/init.py:167
- The
env-updatedpurge/reread is the compatibility-sensitive core of this extension, but the added smoke test only checks thatreport.htmlexists; it would pass if the second read never populated any graph-derived sections. Add file-based Sphinx assertions for rendered feature/component sections, including parallel and incremental rebuilds and an externally resolved Need, as required by the linked design decision.
app.connect("builder-inited", _capture_template_environment)
app.connect("env-updated", _rerender_pages_with_complex_post_templates)
| {% set component_slug_norm = component_title|replace("_", "")|replace(" ", "")|lower %} | ||
| {% set component_anchor = component_title|replace("_", "-")|replace(" ", "-")|lower %} |
- tools/BUILD: the data glob only matched a nonexistent module_verification_profiles/ directory, so the real module_verification_reports.toml next to the script was missing from runfiles. List it explicitly. - module_verification_reports.py: default golden root pointed at scripts_bazel/, but tools/BUILD packages goldens under tools/ - align the two so --check-goldens/--update-goldens find the right path. - score_sphinx_needs_templates: resolve linked needs by the link's full qualified string (id[condition]) instead of the bare id, so a version-qualified link resolves the matching NeedItem instead of an arbitrary same-id candidate.
The rename in 6064471 mechanically turned an old regression guard (":post_template: mod_ver_report_tiny" must not collapse to bare "mod_ver_report") into a self-contradiction once the template's name became "module_verification_report" itself - the assertion now directly contradicted the line above it, failing bazel test //... Remove the now-meaningless guard. Also add .cache to .bazelignore: module_verification_reports.py's downstream checkout cache (introduced in 32c69fb) includes a self-referencing overlay of this repo, which sends Bazel's package discovery into an infinite symlink loop for anyone with a populated cache.
Uh oh!
There was an error while loading. Please reload this page.