-
Notifications
You must be signed in to change notification settings - Fork 24
feat: traceability metrics #484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 33 commits
15743fc
58ae80d
4e9c60e
0ec5217
764da8d
ec2e994
a364257
ecd1caf
313ff9b
6287c69
5876e16
b4ec35b
7ce6835
a6029b7
a93233b
6e1e0aa
0d8d75c
c8e4058
4437580
243aa21
cf19ba8
2b8aace
f137f03
e927339
a81e4ff
ef1f5ca
7745cce
0a1a885
15d8e91
5e49964
56779d3
5403782
fcde178
0d9195c
44dcc74
cba4fa8
ec150c8
85a9d26
be08bfc
69254cf
89d2ff0
18d2c0d
fb202b4
2b4e5c4
2f65d26
74ddf9b
fa04eda
389675d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
| # | ||
| # See the NOTICE file(s) distributed with this work for additional | ||
| # information regarding copyright ownership. | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| Build Dashboards and Quality Gates | ||
| ================================== | ||
|
|
||
| Use this guide in repositories that consume docs-as-code as a Bazel | ||
| dependency. | ||
|
|
||
| Goals: | ||
|
|
||
| 1. Publish traceability dashboards from repository needs. | ||
| 2. Export machine-readable metrics. | ||
| 3. Enforce CI thresholds with ``traceability_gate``. | ||
|
|
||
| What You Get | ||
| ------------ | ||
|
|
||
| With the ``docs(...)`` macro and ``score_metamodel`` extension enabled, your | ||
| repository can: | ||
|
|
||
| - build an HTML dashboard from its own Sphinx needs, | ||
| - include external needs from other repositories when desired, | ||
| - export ``needs.json`` and ``metrics.json`` for machine-readable reporting, | ||
| - gate CI on traceability thresholds via ``traceability_gate``. | ||
|
|
||
| Typical Setup | ||
|
FScholPer marked this conversation as resolved.
|
||
| ------------- | ||
|
|
||
| For details, see :ref:`setup`. | ||
|
|
||
| Minimal Configuration Example | ||
| ----------------------------- | ||
|
|
||
| In ``docs/conf.py``: | ||
|
|
||
| .. code-block:: python | ||
|
|
||
| score_metamodel_requirement_types = "feat_req,comp_req,aou_req" | ||
|
FScholPer marked this conversation as resolved.
|
||
| score_metamodel_include_external_needs = False | ||
|
FScholPer marked this conversation as resolved.
|
||
|
|
||
| Use ``score_metamodel_include_external_needs = True`` (aggregate_traceability_across_dependencies) | ||
| only in repositories that intentionally aggregate requirements across module dependencies, such as | ||
| integration repositories. Use ``False`` for module repositories to gate only on local traceability. | ||
|
|
||
| Building the Dashboard | ||
| ---------------------- | ||
|
|
||
| After building/running any docs command (i.e. ``bazel build //:needs_json`` or ``bazel run //:docs_verify`` are the fastest): | ||
|
|
||
| The documentation build writes ``metrics.json`` via ``score_metamodel``, and the ``needs_json`` artifact contains: | ||
|
|
||
| - ``bazel-bin/needs_json/_build/needs/needs.json`` | ||
| - ``bazel-bin/needs_json/_build/needs/metrics.json`` | ||
|
FScholPer marked this conversation as resolved.
|
||
|
|
||
| The dashboard charts and the CI gate both use the same computed metrics. | ||
|
|
||
| Inputs for Linkage Metrics | ||
| -------------------------- | ||
|
|
||
| To get meaningful dashboard and gate values, consumer repositories typically | ||
| need three inputs: | ||
|
|
||
| 1. Requirement and architecture needs in the documentation itself. | ||
| 2. Source code references via :doc:`source_to_doc_links`. | ||
| 3. Test metadata via :doc:`test_to_doc_links`. | ||
|
|
||
| If one of those inputs is missing, the related chart or gate metric will remain | ||
| empty or low. | ||
|
|
||
| Choosing Local vs Aggregated Views | ||
| ---------------------------------- | ||
|
|
||
| There are two common modes: | ||
|
|
||
| **Module repository** | ||
|
|
||
| - Set ``score_metamodel_include_external_needs = False``. | ||
| - Gate only on the needs owned by the repository itself. | ||
| - Use this for per-module implementation progress and traceability. | ||
|
|
||
| **Integration repository** | ||
|
|
||
| - Set ``score_metamodel_include_external_needs = True``. | ||
| - Aggregate requirements across module dependencies when that is the intended | ||
| repository purpose. | ||
| - Use this for system or integration-level dashboards. | ||
|
|
||
| CI Quality Gate | ||
| --------------- | ||
|
|
||
| After building ``//:needs_json``, run the gate on the exported metrics: | ||
|
FScholPer marked this conversation as resolved.
Outdated
|
||
|
|
||
| .. code-block:: bash | ||
|
|
||
| bazel run //:docs && \ | ||
| bazel run //:traceability_gate -- \ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AI-assisted review (Claude): Same issue: Consider wiring the gate as a Bazel test target that depends on
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix-commit created by AI (Claude) Fixed in |
||
| --metrics-json bazel-bin/needs_json/_build/needs/metrics.json \ | ||
|
FScholPer marked this conversation as resolved.
|
||
| --min-req-code 70 \ | ||
| --min-req-test 70 \ | ||
| --min-req-fully-linked 60 \ | ||
| --min-tests-linked 70 | ||
|
|
||
| In CI, wire targets through Bazel dependencies so test execution and | ||
| ``needs_json`` generation happen before the gate target. | ||
|
|
||
| In larger repositories, define a dedicated wrapper target for your standard | ||
| gate thresholds so CI calls a single Bazel target. | ||
|
|
||
| Useful flags: | ||
|
|
||
| - ``--require-all-links`` for strict 100 percent gating | ||
|
|
||
| Recommended Rollout | ||
| ------------------- | ||
|
|
||
| For a new consumer repository: | ||
|
|
||
| 1. Start with local-only metrics. | ||
| 2. Enable ``scan_code`` and verify ``source_code_link`` coverage first. | ||
| 3. Add test metadata and verify ``testlink`` coverage. | ||
| 4. Introduce modest thresholds in CI. | ||
| 5. Raise thresholds over time as the repository matures. | ||
|
|
||
| Related Guides | ||
| -------------- | ||
|
|
||
| - :ref:`setup` | ||
| - :doc:`other_modules` | ||
| - :doc:`source_to_doc_links` | ||
| - :doc:`test_to_doc_links` | ||
Uh oh!
There was an error while loading. Please reload this page.