Skip to content

feat: typed references from requirements and SVCs to their sources, with verdicts per source #491

Open

Description

@jimisola

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_ids links a requirement to another requirement by URN. A law can be written as its own requirements file (variant: external, with metadata.url pointing 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.
  • rationale is 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

  1. A kind on each reference, for example derived-from, refines, related. Open question: a fixed enum, or free text with recommended values.
  2. 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.
  3. The same on SVCs, so an SVC can name the scenario or use case it was derived from.
  4. export and status --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 as status, not a second one.
  5. report, the MCP tools and the LSP show the references (hover, go to definition for targets inside reqstool).
  6. 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/oj

Roll-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 back sources as strings. Cheap, but nothing can query or roll it up, which is why sources was dropped.
  • Leave the links to another tool. Then reqstool, which holds the verdicts, cannot answer the question itself.

Additional context

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions