Skip to content

fix: credit work-product documents to the longest matching slug - #1028

Open
antonkri wants to merge 2 commits into
mainfrom
fix/workproduct-rows-longest-match
Open

antonkri wants to merge 2 commits into
mainfrom
fix/workproduct-rows-longest-match

Conversation

@antonkri

@antonkri antonkri commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Problem

The module/platform verification reports attach work-product documents (requirements/architecture/
implementation inspection, DFA, FMEA) to a component or feature by checking whether its title slug
occurs in the document ID (_WorkproductRows). A short slug that is contained in sibling slugs
therefore also collects the siblings' documents.

Seen in the time module report (eclipse-score/time#301): the component Time (slug time) listed
doc__time_req_inspection, doc__time_daemon_req_inspection and doc__time_slave_req_inspection
for every work product, because time is contained in timedaemon and timeslave.

Fix (minimal)

workproduct_rows gets an optional sibling_titles argument with the titles of all elements of the
report (all components of the module / all features of the platform report). A document that also
matches a longer sibling slug is excluded, i.e. the longest match wins. The exclusion is emitted
directly into the needtable filter (and "timedaemon" not in id...), no metamodel change.
Calls without sibling_titles behave exactly as before.

Verification

  • New unit test test_workproduct_rows_leave_documents_to_longer_sibling_slug;
    bazel test //src/extensions/score_sphinx_needs_templates/... passes (incl. the platform report
    rendering test).
  • End-to-end: built the time docs with --override_module=score_docs_as_code=<this branch>.
    The Time section now only lists doc__time_*, Time Daemon / Time Slave unchanged.

Not in scope

The slug is still derived from the component title, so a component whose title does not match its
document IDs (e.g. "Time Sync Client" vs. doc__ts_client_*) still shows no documents. That would
need a separate change (e.g. slug from the component ID or an explicit link).

The verification reports attach work-product documents to a component
(or feature) when its title slug occurs in the document ID. A short slug
that prefixes sibling slugs therefore also collected the siblings'
documents, e.g. component "Time" listed doc__time_daemon_* and
doc__time_slave_* next to its own doc__time_* documents.

workproduct_rows now takes the titles of all elements in the report and
excludes documents that match a longer sibling slug, so the longest
match wins. Callers without sibling titles keep the old behaviour.

Signed-off-by: Anton Krivoborodov <anton.krivoborodov@bmw.de>
The new {% set %} lines for the sibling titles emitted extra blank lines
into the rendered report, which changed the checked-in expected needs.json
of the reference_integration/modern_module scenario. Trim the surrounding
whitespace so the output only differs where a longer sibling slug exists.

Signed-off-by: Anton Krivoborodov <anton.krivoborodov@bmw.de>
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

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

@AlexanderLanin

Copy link
Copy Markdown
Member

lets abandon slug matching completely by finalizing #940

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.

2 participants