Skip to content

assess commands (iso26262/iec61508/do178/sci/sas) hardcode root-only doc paths, while template/init default to docs/safety/ #45

Description

@SoundMatt

Summary

Found while implementing go-DDS's ROADMAP.md "Architecture Initiative" Phase F (root Markdown cleanup, moving hand-authored safety docs into docs/).

cmd/gofusa's own init/template commands default their output directory to docs/safety/ (cmd/gofusa/cmd_init.go, cmd/gofusa/cmd_template.go: outDir = wd + "/docs/safety"). But the assess/report builders that later check for those same files — iso26262.Assess, iec61508.Assess, do178.Assess, sci.Build, sas.Build — all resolve them with filepath.Join(projectRoot, "SAFETY_PLAN.md") (and similarly for HARA.md, SVP.md, SCMP.md, SQAP.md, sas.md) with no docs/ fallback.

This is inconsistent with iec62443.go's handling of the same kind of file, which does check multiple candidate paths including a docs/ location:

var secPolicyFiles = []string{"SECURITY.md", "SECURITY_POLICY.md", "security-policy.md", "docs/SECURITY.md"}
var incidentRespFiles = []string{
    "INCIDENT-RESPONSE.md", "incident-response.md",
    "docs/incident-response.md", "docs/INCIDENT-RESPONSE.md",
}

and INCIDENT-RESPONSE.md's check additionally supports a configured path via .fusa-iec62443.json's incident_resp_doc field.

Impact

A project that runs gofusa init fresh gets these docs scaffolded into docs/safety/ by default — and then gofusa iso26262/iec61508/do178/sci/sas immediately report them as gaps ("SAFETY_PLAN.md not found"), because the assess side never looks there. The only way to reconcile the two is to keep the docs at repo root, which defeats the point of docs/safety/ as a scaffold default.

We hit this concretely in go-DDS: we wanted to move SAFETY_PLAN.md/HARA.md/etc. into docs/ for repo-hygiene reasons, confirmed (by reading this tool's source) that doing so would silently corrupt the ISO 26262/IEC 61508/DO-178C gap-report evidence, and had to leave those specific files at root instead — see SoundMatt/go-DDS#116 and its ROADMAP.md Phase F entry for the full writeup.

Suggested fix

Give iso26262.go/iec61508.go/do178.go/sci.go/sas.go the same multi-candidate-path (and/or .fusa.json-configurable-path) treatment iec62443.go already has for SECURITY.md/INCIDENT-RESPONSE.md, checking at minimum the bare root filename and docs/safety/<file> (matching the template/init default), ideally with a project-level override in .fusa.json for the same kind of file paths that already checks in the general check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions