Skip to content

docs: generate additional docs#1166

Draft
Ron (rjaegers) wants to merge 6 commits intomainfrom
docs/generate-test-spec-and-traceability
Draft

docs: generate additional docs#1166
Ron (rjaegers) wants to merge 6 commits intomainfrom
docs/generate-test-spec-and-traceability

Conversation

@rjaegers
Copy link
Member

@rjaegers Ron (rjaegers) commented Feb 26, 2026

🚀 Hey, I have created a Pull Request

Description of changes

This pull request introduces a unified and extensible approach for generating SBDL (System Behavior Description Language) documents from both Gherkin feature files and BATS integration test files, enabling comprehensive requirements, test specification, and traceability document generation for both C++ and Rust codebases. The changes add new converters, configuration options, and workflow steps for automated document generation and artifact upload.

The most important changes are:

1. Unified SBDL Generation for Requirements and Test Specifications

  • Added a new script, generate-sbdl.py, which combines Gherkin and BATS parsing to generate SBDL files for both requirements and test specifications, supporting traceability between tests and requirements. This enables the generation of both requirements and test documents with traceability matrices for multiple flavors (C++ and Rust).

2. BATS Test File Support and Traceability

  • Introduced bats_sbdl_converter.py to extract BATS test cases, parse custom tags, and map them to requirements/aspects using a tag-based mapping. This facilitates linking BATS tests to requirements for traceability in generated documents.

3. New Test Specification Configuration

  • Added a TEST_SPECIFICATION_CONFIG in gherkin_mapping_config.py to map Gherkin Features to aspects, Rules to requirements, and Scenarios to tests, supporting the new test specification and traceability workflows.

4. Improvements to Gherkin SBDL Conversion

  • Enhanced gherkin_sbdl_converter.py to use consistent slug-based identifiers, add custom:title attributes for display, and support cross-type SBDL relations (e.g., test→requirement, requirement→aspect) for improved traceability. [1] [2] [3] [4]

5. Expanded Document Generation Workflow

  • Updated .github/workflows/wc-document-generation.yml to include new steps for generating C++ and Rust test specification and traceability documents (both Markdown and PDF), using the new scripts and configurations. Artifacts for all generated documents are uploaded for later use.

Other Notable Changes

  • Added test-specification as a valid config in both gherkin-to-sbdl.py and the new generate-sbdl.py script to support the new workflows.

These changes provide a robust and extensible foundation for requirements management, test specification, and traceability across multiple languages and test frameworks.

✔️ Checklist

  • I have followed the contribution guidelines for this repository
  • I have added tests for new behavior, and have not broken any existing tests
  • I have added or updated relevant documentation
  • I have verified that all added components are accounted for in the SBOM

Copilot AI review requested due to automatic review settings February 26, 2026 20:37
@rjaegers Ron (rjaegers) requested a review from a team as a code owner February 26, 2026 20:37
@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

MegaLinter analysis: Error

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 23 0 0 0.67s
✅ DOCKERFILE hadolint 3 0 0 0.8s
❌ GHERKIN gherkin-lint 6 6 0 3.27s
✅ JSON npm-package-json-lint yes no no 0.43s
✅ JSON prettier 21 4 0 0 0.53s
✅ JSON v8r 21 0 0 7.64s
✅ MARKDOWN markdownlint 12 0 0 0 1.01s
✅ MARKDOWN markdown-table-formatter 12 0 0 0 0.28s
✅ REPOSITORY checkov yes no no 18.04s
✅ REPOSITORY gitleaks yes no no 0.67s
✅ REPOSITORY git_diff yes no no 0.01s
✅ REPOSITORY grype yes no no 31.24s
✅ REPOSITORY secretlint yes no no 0.96s
✅ REPOSITORY syft yes no no 1.9s
✅ REPOSITORY trivy yes no no 5.45s
✅ REPOSITORY trivy-sbom yes no no 0.24s
✅ REPOSITORY trufflehog yes no no 2.2s
⚠️ SPELL lychee 83 1 0 21.76s
✅ YAML prettier 31 0 0 0 1.24s
✅ YAML v8r 31 0 0 8.23s
✅ YAML yamllint 31 0 0 0.93s

Detailed Issues

❌ GHERKIN / gherkin-lint - 6 errors
Results of gherkin-lint linter (version 0.0.0)
See documentation on https://megalinter.io/9.3.0/descriptors/gherkin_gherkin_lint/
-----------------------------------------------

❌ [ERROR] test/cpp/features/compatibility.feature
    test/cpp/features/compatibility.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'To guarantee compatibility with container runtimes and container- and image tooling; amp-devcontainer should be compatible with the OCI image specification.'    unexpected-error
      14    (14:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Host architecture'                                                                                                                                         unexpected-error
      15    (15:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHALL* be compatible with both the x86-64 (AMD64) *and* AArch64 (ARM64) host architectures.'                                                   unexpected-error
      17    (17:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Supporting both x86-64 and AArch64 has several advantages:'                                                                                                      unexpected-error
      19    (19:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got '- Increasing useability on a wide range of host machines, from PC hardware using the x86-64 architecture to Apple Silicon using the AArch64 architecture'        unexpected-error
      20    (20:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got '- Unlocking the power efficiency of the AArch64 architecture, potentially reducing energy consumption and cost for metered ci-systems'                           unexpected-error
      23    (23:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Integrated Development Environment (IDE)'                                                                                                                  unexpected-error
      24    (24:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHOULD* be compatible with [VS Code](https://code.visualstudio.com/) *and* [GitHub Codespaces](https://github.com/features/codespaces).'       unexpected-error
      26    (26:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It should be possible to use amp-devcontainer and all of its features in both VS Code and GitHub Codespaces with minimal effort.'                                unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Open Container Initiative (OCI) Image Specification'                                                                                                        unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer images *SHALL* be compatible with the [OCI image specification](https://github.com/opencontainers/image-spec/blob/main/spec.md)'                 unexpected-error

❌ [ERROR] test/cpp/features/compilation.feature
    test/cpp/features/compilation.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Compiling valid source code into working software, able to run on the container host architecture and operating system,'                                   unexpected-error
      12    (12:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'can be necessary in several scenarios; for example when:'                                                                                                  unexpected-error
      14    (14:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got '- the container host is the deployment target'                                                                                                             unexpected-error
      15    (15:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got '- running tests on the container host'                                                                                                                     unexpected-error
      16    (16:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got '- building plug-ins, extensions, code generators, or other additional tools that need to run on the container host'                                        unexpected-error
      26    (26:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Compile for ARM Cortex target architecture'                                                                                                          unexpected-error
      27    (27:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHOULD* be able to compile valid source-code into a working ELF executable targeting the ARM Cortex architecture.'                       unexpected-error
      29    (29:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Compiling valid source-code into working ELF executables, able to run on the ARM Cortex architecture,'                                                     unexpected-error
      30    (30:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'is a primary function for amp-devcontainer. It enables building firmware for micro-controllers based'                                                      unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Compile for container host architecture and operating system'                                                                                         unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHALL* be able to compile valid source code into a working executable targeting the container host architecture and operating system.'    unexpected-error

❌ [ERROR] test/cpp/features/debugging.feature
    test/cpp/features/debugging.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Providing debugging support within the development environment enhances the developer experience and productivity.'                                                   unexpected-error
      12    (12:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It allows developers to efficiently identify and resolve issues in their code by setting breakpoints, inspecting variables, and stepping through code execution.'     unexpected-error
      13    (13:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'This capability is essential for diagnosing complex problems, understanding code flow, and ensuring the correctness of software.'                                     unexpected-error
      14    (14:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'By having integrated debugging tools, developers can streamline their workflow and reduce the time spent on troubleshooting and fixing bugs.'                         unexpected-error
      17    (17:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Upload firmware to micro-controller'                                                                                                                            unexpected-error
      18    (18:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *MAY* provide tools to upload compiled firmware to a connected micro-controller.'                                                                    unexpected-error
      20    (20:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Providing tools to upload compiled firmware to a connected micro-controller enhances the development workflow for embedded systems.'                                  unexpected-error
      21    (21:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It allows developers to quickly and easily transfer their compiled code to the target hardware for testing and debugging.'                                            unexpected-error
      22    (22:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'This capability is essential for validating the functionality of the firmware on the actual device, ensuring that it behaves as expected in real-world scenarios.'    unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Debugging support'                                                                                                                                               unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHALL* provide debugging support for the primary programming language(s) used within the container.'                                                 unexpected-error

❌ [ERROR] test/cpp/features/maintainability.feature
    test/cpp/features/maintainability.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Keeping tools and dependencies up-to-date helps ensure that the development environment remains secure, stable, and compatible with the latest technologies.'                                     unexpected-error
      12    (12:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It also helps prevent issues related to deprecated or unsupported software versions, reducing maintenance overhead and improving overall developer productivity.'                                 unexpected-error
      13    (13:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Regular updates can also introduce new features and improvements that enhance the development experience.'                                                                                        unexpected-error
      16    (16:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Automatic updates'                                                                                                                                                                          unexpected-error
      17    (17:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHOULD* provide support for automatic updates when consumed as a dependency.'                                                                                                   unexpected-error
      19    (19:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Providing support for automatic updates when amp-devcontainer is consumed as a dependency helps ensure that users always have access to the latest features, bug fixes, and security patches.'    unexpected-error
      20    (20:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'This reduces the maintenance burden on users, as they do not need to manually track and apply updates.'                                                                                           unexpected-error
      21    (21:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Automatic updates can also help ensure compatibility with other dependencies and tools, improving the overall stability and reliability of the development environment.'                          unexpected-error
      24    (24:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Re-usable build system'                                                                                                                                                                     unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Tool and dependency updates'                                                                                                                                                                 unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHOULD* contain up-to-date tools and dependencies.'                                                                                                                              unexpected-error

❌ [ERROR] test/cpp/features/security.feature
    test/cpp/features/security.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Including provenance gives confidence that the container images haven't been tampered with and can be securely traced back to its source code.'                                                   unexpected-error
      12    (12:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'The primary purpose is to enable [verification](https://slsa.dev/spec/v1.0/verifying-artifacts) that the container image was built as expected.'                                                  unexpected-error
      13    (13:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Consumers have some way of knowing what the expected provenance should look like for a given container image and then compare each container image's actual provenance to those expectations.'    unexpected-error
      14    (14:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Doing so prevents several classes of [supply chain threats](https://slsa.dev/spec/v1.0/threats).'                                                                                                 unexpected-error
      17    (17:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Signing'                                                                                                                                                                                    unexpected-error
      18    (18:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHALL* cryptographically sign its released container images.'                                                                                                                   unexpected-error
      20    (20:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Cryptographically signing released container images provides integrity and authenticity guarantees.'                                                                                              unexpected-error
      21    (21:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It enables consumers to verify that the container image hasn't been tampered with and that it indeed originates from the expected publisher.'                                                     unexpected-error
      22    (22:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'This helps mitigate several classes of [supply chain threats](https://slsa.dev/spec/v1.0/threats).'                                                                                               unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Build provenance'                                                                                                                                                                            unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *SHALL* include build provenance as specified in [SLSA v1.0 Build L3](https://slsa.dev/spec/v1.0/levels).'                                                                        unexpected-error

❌ [ERROR] test/cpp/features/static-dynamic-analysis.feature
    test/cpp/features/static-dynamic-analysis.feature
      11    (11:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Providing code formatting tools helps maintain a consistent coding style across the codebase, improving readability and reducing friction during code reviews.'                                                                unexpected-error
      12    (12:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'It also helps catch potential issues early by enforcing coding standards and best practices.'                                                                                                                                  unexpected-error
      13    (13:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'By integrating code formatting tools into the development environment, developers can easily format their code according to predefined rules, ensuring that the code adheres to the project's style guidelines.'               unexpected-error
      23    (23:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Static analysis'                                                                                                                                                                                                         unexpected-error
      24    (24:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *MAY* provide static analysis tools for the primary programming language(s) used within the container.'                                                                                                       unexpected-error
      26    (26:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Providing static analysis tools helps identify potential issues in the code before it is executed, improving code quality and reducing the likelihood of runtime errors.'                                                      unexpected-error
      27    (27:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'These tools can analyze the code for common pitfalls, coding standards violations, and potential bugs, providing developers with valuable feedback early in the development process.'                                          unexpected-error
      28    (28:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'By integrating static analysis tools into the development environment, developers can catch issues before they become more significant problems, streamlining the development workflow and improving overall code quality.'    unexpected-error
      31    (31:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Coverage analysis'                                                                                                                                                                                                       unexpected-error
      8     (8:3): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'Rule: Code formatting'                                                                                                                                                                                                          unexpected-error
      9     (9:5): expected: #TagLine, #ScenarioLine, #Comment, #Empty, got 'amp-devcontainer *MAY* provide code formatting tools for the primary programming language(s) used within the container.'                                                                                                        unexpected-error
⚠️ SPELL / lychee - 1 error
[IGNORED] docker://pandoc/extra:3.7.0@sha256:a703d335fa237f8fc3303329d87e2555dca5187930da38bfa9010fa4e690933a | Unsupported: Error creating request client: builder error for url (docker://pandoc/extra:3.7.0@sha256:a703d335fa237f8fc3303329d87e2555dca5187930da38bfa9010fa4e690933a)
[403] https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads | Network error: Forbidden
[IGNORED] https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/philips-software/amp-devcontainer | Unsupported: Error creating request client: builder error for url (vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/philips-software/amp-devcontainer)
📝 Summary
---------------------
🔍 Total..........126
✅ Successful.....123
⏳ Timeouts.........0
🔀 Redirected.......0
👻 Excluded.........0
❓ Unknown..........0
🚫 Errors...........1

Errors in .github/TOOL_VERSION_ISSUE_TEMPLATE.md
[403] https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads | Network error: Forbidden

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@9.3.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,DOCKERFILE_HADOLINT,GHERKIN_GHERKIN_LINT,JSON_V8R,JSON_PRETTIER,JSON_NPM_PACKAGE_JSON_LINT,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_GITLEAKS,REPOSITORY_GRYPE,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT,YAML_V8R

MegaLinter is graciously provided by OX Security

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

📦 Container Size Analysis

Note

Comparing ghcr.io/philips-software/amp-devcontainer-base:edgeghcr.io/philips-software/amp-devcontainer-base:pr-1166

📈 Size Comparison Table

OS/Platform Previous Current Change Trend
linux/amd64 175.16 MB 175.16 MB +1 B (+0%) 🔼
linux/arm64 167.63 MB 167.63 MB 310 B (0%) 🔽

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR expands the documentation generation system to produce additional SBDL-driven documents (software test specification and requirements traceability matrix) by unifying SBDL extraction from both Gherkin feature files and BATS integration tests, enabling traceability across requirements and tests.

Changes:

  • Add a unified SBDL generator that combines Gherkin + BATS extraction for test-spec and traceability outputs.
  • Introduce a BATS-to-SBDL converter and annotate existing BATS tests with # bats test_tags=... for mapping.
  • Add new Pandoc-template documents (STS + RTM) and update the reusable workflow to generate/upload the new artifacts.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
docs/support/generate-sbdl.py New unified Gherkin+BATS SBDL generation entrypoint used by workflows.
docs/support/bats_sbdl_converter.py New converter to extract BATS @test cases and tag metadata for traceability.
docs/support/gherkin_mapping_config.py Adds TEST_SPECIFICATION_CONFIG mapping for aspect→requirement→test hierarchy.
docs/support/gherkin-to-sbdl.py Adds test-specification as a selectable conversion config.
docs/support/gherkin_sbdl_converter.py Switches to slug IDs + emits custom:title and supports cross-type relations.
docs/templates/software-test-specification.md.j2 New STS template rendering aspects/requirements/tests and untraced tests.
docs/templates/requirements-traceability-matrix.md.j2 New RTM template mapping requirements to tests + coverage summary.
docs/templates/software-requirements-specification.md.j2 Updates display logic to use hyphen IDs and custom:title.
.github/workflows/wc-document-generation.yml Extends reusable workflow to generate STS/RTM (MD+PDF) for C++ and Rust and upload artifacts.
test/cpp/integration-tests.bats Adds bats test_tags annotations for traceability mapping.
test/rust/integration-tests.bats Adds bats test_tags annotations for traceability mapping.
test/base/integration-tests.bats Adds bats test_tags annotation for traceability mapping.

Comment on lines 2 to 3
title: "Software test specification for amp-devcontainer
{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}"
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The YAML front-matter title is written as a multi-line double-quoted string (opening quote on the first line, closing quote on a later line). That’s not valid YAML for Pandoc front matter and will likely break PDF/MD generation. Use a YAML folded/block scalar (>-) or keep the title on a single line with the Jinja expression embedded without introducing a newline inside quoted text.

Suggested change
title: "Software test specification for amp-devcontainer
{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}"
title: >-
Software test specification for amp-devcontainer{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +3
title: "Requirements traceability matrix for amp-devcontainer
{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}"
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

The YAML front-matter title is split across lines inside double quotes, which is invalid YAML and can cause Pandoc to fail parsing the metadata. Switch to a YAML block scalar (e.g. title: >-) or ensure the entire title (including the optional flavor suffix) is on one line without a multi-line quoted string.

Suggested change
title: "Requirements traceability matrix for amp-devcontainer
{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}"
title: >-
Requirements traceability matrix for amp-devcontainer{%- if 'document-flavor' in sbdl %} ({{ sbdl['document-flavor']['custom:title'] }}){%- endif %}

Copilot uses AI. Check for mistakes.
Comment on lines +76 to +84
# Process Gherkin feature files
for feature_path in args.gherkin:
if os.path.isfile(feature_path):
print(f"Processing Gherkin: {feature_path}")
elements = gherkin_converter.extract_from_feature_file(feature_path)
gherkin_elements.extend(elements)
else:
print(f"File not found: {feature_path}", file=sys.stderr)

Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

When a provided --gherkin / --bats path doesn’t exist (common when a glob doesn’t match), the script only prints an error and continues, ultimately exiting 0 and generating an incomplete SBDL/doc set. This will make CI appear green while silently dropping inputs. Consider tracking missing paths and exiting non-zero (or raising) if any inputs are missing.

Copilot uses AI. Check for mistakes.
Comment on lines 117 to 123
_write_combined_sbdl(gherkin_converter, gherkin_elements, bats_converter, bats_tests, args.output, args.flavor)

total = len(gherkin_elements) + len(bats_tests)
print(f"Extracted {total} elements ({len(gherkin_elements)} from Gherkin, {len(bats_tests)} from BATS) to {args.output}")


def _write_combined_sbdl(gherkin_converter, gherkin_elements, bats_converter, bats_tests, output_file, flavor=""):
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

_write_combined_sbdl() takes gherkin_converter and bats_converter parameters but does not use gherkin_converter at all (and only uses bats_converter for a single helper call). This unused parameter makes the API harder to understand and suggests dead code; either remove the unused parameter(s) or use them for writing/escaping consistently.

Suggested change
_write_combined_sbdl(gherkin_converter, gherkin_elements, bats_converter, bats_tests, args.output, args.flavor)
total = len(gherkin_elements) + len(bats_tests)
print(f"Extracted {total} elements ({len(gherkin_elements)} from Gherkin, {len(bats_tests)} from BATS) to {args.output}")
def _write_combined_sbdl(gherkin_converter, gherkin_elements, bats_converter, bats_tests, output_file, flavor=""):
_write_combined_sbdl(gherkin_elements, bats_converter, bats_tests, args.output, args.flavor)
total = len(gherkin_elements) + len(bats_tests)
print(f"Extracted {total} elements ({len(gherkin_elements)} from Gherkin, {len(bats_tests)} from BATS) to {args.output}")
def _write_combined_sbdl(gherkin_elements, bats_converter, bats_tests, output_file, flavor=""):

Copilot uses AI. Check for mistakes.
Comment on lines +56 to +64
def __init__(self, requirement_tag_map: Optional[Dict[str, str]] = None):
"""Initialize the converter.

Args:
requirement_tag_map: Optional mapping from tag names to requirement
identifiers (SBDL element IDs). When provided, tests with
matching tags will get a `requirement` relation in SBDL output.
"""
self.requirement_tag_map = requirement_tag_map or {}
Copy link

Copilot AI Feb 26, 2026

Choose a reason for hiding this comment

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

requirement_tag_map is annotated as Optional[Dict[str, str]], but the converter actually supports tuple entries (identifier, type) (see _resolve_requirement_relations / _resolve_typed_relations). The current type hint and docstring are inconsistent with runtime behavior; update the annotation (e.g. to a Union[str, tuple[str, str]] value type) and adjust the docstring accordingly.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

📦 Container Size Analysis

Note

Comparing ghcr.io/philips-software/amp-devcontainer-rust:edgeghcr.io/philips-software/amp-devcontainer-rust:pr-1166

📈 Size Comparison Table

OS/Platform Previous Current Change Trend
linux/amd64 555.57 MB 555.57 MB 130 B (0%) 🔽
linux/arm64 509.75 MB 509.75 MB 225 B (0%) 🔽

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

📦 Container Size Analysis

Note

Comparing ghcr.io/philips-software/amp-devcontainer-cpp:edgeghcr.io/philips-software/amp-devcontainer-cpp:pr-1166

📈 Size Comparison Table

OS/Platform Previous Current Change Trend
linux/amd64 696.86 MB 696.86 MB 65 B (0%) 🔽
linux/arm64 677.67 MB 677.67 MB 161 B (0%) 🔽

@github-actions
Copy link
Contributor

github-actions bot commented Feb 26, 2026

Test Results

 13 files  + 6   13 suites  +6   22m 22s ⏱️ + 18m 22s
 33 tests ± 0   33 ✅ ± 0  0 💤 ±0  0 ❌ ±0 
137 runs  +68  137 ✅ +68  0 💤 ±0  0 ❌ ±0 

Results for commit 768089e. ± Comparison against base commit 094efc5.

♻️ This comment has been updated with latest results.

@rjaegers Ron (rjaegers) marked this pull request as draft February 26, 2026 21:29
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@rjaegers
Copy link
Member Author

Copilot

Context

This PR (branch docs/generate-test-spec-and-traceability) currently uses ~580+ lines of custom Python scripts to convert Gherkin .feature files and BATS .bats test files into SBDL. This involves:

  • docs/support/gherkin_mapping_config.py (80 lines) — mapping configs
  • docs/support/gherkin_sbdl_converter.py (204 lines) — Gherkin parser/converter
  • docs/support/bats_sbdl_converter.py (144 lines) — BATS parser/converter
  • docs/support/generate-sbdl.py (160 lines) — unified orchestrator
  • docs/support/gherkin-to-sbdl.py (39 lines) — standalone Gherkin converter

SBDL's strength is keeping definitions close to the code (see https://sbdl.dev). The goal is to embed SBDL declarations inline in the source files (.feature and .bats) and replace the Python conversion scripts with a simple extraction mechanism.

Requirements

1. Add inline SBDL to Gherkin .feature files

For each Feature, Rule, and Scenario that currently gets converted to SBDL, add an inline SBDL (see specification on https://sbdl.dev) comment directly in the .feature file, right next to the element it describes.

Pattern for Features (mapped to aspect or requirement depending on config):
For the test-specification config: Features → aspects, Rules → requirements, Scenarios → tests.
For the requirements config: Features → requirements, Rules → requirements.

Since both configs need to be supported, use the test-specification mapping (aspect/requirement/test) as the canonical inline form, since it's the superset. The requirements config can be handled by the SBDL toolchain at document generation time.

Files to annotate (all in test/cpp/features/):

  • compatibility.feature — Feature: Compatibility + its Rules
  • compilation.feature — Feature: Compilation + its Rules + Scenario
  • debugging.feature — Feature: Debugging + its Rules
  • maintainability.feature — Feature: Maintainability + its Rules
  • security.feature — Feature: Security + its Rules
  • static-dynamic-analysis.feature — Feature: Static and dynamic analysis + its Rules + Scenario

Inline SBDL format — add as a comment line directly below the Feature/Rule/Scenario keyword line. Use unique identifiers. Do NOT duplicate the title in both the identifier and a custom:title attribute — the identifier should be a short, meaningful slug, and the Gherkin name itself serves as the human-readable title. Example:

Feature: Compatibility
  <sbdl marker> compatibility is aspect { description is "As a software craftsperson, to ensure that my development environment works well with a variety of tools and systems, I want my development environment to be compatible with commonly used tools and systems." <sbdl-end>

  Rule: Host architecture
    <sbdl-marker> host-architecture is requirement { aspect is compatibility description is "amp-devcontainer SHALL be compatible with both the x86-64 (AMD64) and AArch64 (ARM64) host architectures." } <sbdl end>

For Scenarios:

    Scenario: Compile valid source code into working software targeting the container host architecture
      <sbdl marker> compile-host-cpp is test { requirement is compile-for-container-host-architecture-and-operating-system } <sbdl end>

2. Add inline SBDL to BATS .bats test files

Replace the current # bats test_tags=... traceability approach with inline declarations. Keep the # bats test_tags=... lines as they are (they serve BATS's own filtering), but add SBDL lines that directly express the traceability.

Files to annotate:

  • test/cpp/integration-tests.bats
  • test/rust/integration-tests.bats
  • test/base/integration-tests.bats

Pattern: Add SBDL comment directly above or below the # bats test_tags= line, before the @test line. Use a short unique identifier the flavor can be a custom type (see https://sbdl.dev for definition of custom types). Express the requirement relation directly.

Use the tag values that correspond to Rule identifiers from the .feature files as the requirement references. Where a test maps to multiple tags, choose the most specific Rule identifier for the requirement is relation.

3. Use the SBDL command line see https://sbdl.dev to gather the input, validate it and render the documents

Replace generate-sbdl.py, gherkin-to-sbdl.py, gherkin_sbdl_converter.py, gherkin_mapping_config.py, and bats_sbdl_converter.py with a workflow implementation that:

  1. Gathers all input material and creates a single SBDL model
  2. Validates the SBDL model
  3. Renders the documents

Copy link
Contributor

Copilot AI commented Feb 27, 2026

Ron (@rjaegers) I've opened a new pull request, #1172, to work on those changes. Once the pull request is ready, I'll request review from you.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants