Repository navigation
Description
Problem description
A requirement usually exists because of something outside the project: a law, a standard, a contract clause, a decision, a product capability or a use case. reqstool has two ways to record that today, and both stop short.
references.requirement_idslinks a requirement to another requirement by URN. A law can be written as its own requirements file (variant: external, withmetadata.urlpointing at the official text), one requirement per clause, imported like any other file. That works, but every source must be transcribed into reqstool YAML first, and the link has no kind. The schema describes it as "requirements related to this requirement", so "derived from GDPR Art. 17" and "see also REQ_042" look the same.rationaleis free text, so no command can find what it names.
As a result, reqstool cannot answer "which requirements exist because of GDPR Art. 17, and are they all verified?", which is the question an auditor asks first.
The schema once had references.sources, an array of free strings ("Requirement source. E.g. FSB, SAF, SWAL"). It was removed in #50, after #42 and #47: report crashed when a reference had sources but no requirement_ids, and no command used the field. A new field should avoid both problems: give it structure, and handle it everywhere references are read.
Desired solution
- A kind on each reference, for example
derived-from,refines,related. Open question: a fixed enum, or free text with recommended values. - Targets outside reqstool: an external ID with an optional URL and title. reqstool stores and validates the shape, and never resolves the target. Targets inside reqstool (
requirement_id) keep being checked. - The same on SVCs, so an SVC can name the scenario or use case it was derived from.
exportandstatus --format json: each requirement carries its references, plus a roll-up per reference target listing its requirements and how many are met. "Met" must come from the same per-requirement computation asstatus, not a second one.report, the MCP tools and the LSP show the references (hover, go to definition for targets inside reqstool).- Backward compatible: today's
references: {requirement_ids: [...]}keeps working unchanged.
A possible shape (names are a starting point):
requirements:
- id: REQ_PRIV_001
title: Personal data is erased on request
significance: shall
description: When a data subject asks for erasure, the system deletes their personal data within 30 days.
categories: [security]
revision: 1.0.0
references:
requirement_ids: ["REQ_PRIV_000"] # unchanged: related requirements
links:
- kind: derived-from
requirement_id: "gdpr:ART_17_1" # a clause in an imported external file; checked
- kind: derived-from
external_id: "GDPR Art. 17(1)" # not in reqstool; stored, never resolved
url: https://eur-lex.europa.eu/eli/reg/2016/679/ojRoll-up in the export:
"reference_summary": {
"GDPR Art. 17(1)": {
"requirements": ["ms-001:REQ_PRIV_001", "ms-001:REQ_PRIV_002"],
"met": 1,
"total": 2
}
}Alternatives considered
- Only external requirement files. Works today for sources worth transcribing clause by clause, but the link stays untyped, and a source that lives elsewhere (a decision record, a ticket, a capability map) must be copied into reqstool to be referenced.
- Free text in
rationale, or bring backsourcesas strings. Cheap, but nothing can query or roll it up, which is whysourceswas dropped. - Leave the links to another tool. Then reqstool, which holds the verdicts, cannot answer the question itself.
Additional context
- History: Requirement references throws error if requirement_ids are not defined #42, Rework the references key from requirements.yml #47, feat: Updates to schema and logic for removal of sources #50 (removal of
references.sources). - feat: investigate removing variant (system/microservice/external) #324: external files are now parsed like any other, so an external file can carry SVCs.
- A reference to a requirement that does not exist is currently accepted without a warning: bug: validate accepts a reference to a requirement that does not exist #490.
Activity