Skip to content

fix: hara risk.asil cross-validation + canonical standard id (v0.38.0) - #66

Closed
SoundMatt wants to merge 3 commits into
mainfrom
fix/hara-asil-crosscheck-and-standard-id
Closed

fix: hara risk.asil cross-validation + canonical standard id (v0.38.0)#66
SoundMatt wants to merge 3 commits into
mainfrom
fix/hara-asil-crosscheck-and-standard-id

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

  • New engine rule HARA008 (+ exported hara.ValidateASIL, folded into hara.Validate so gofusa hara show's own gap list surfaces it) cross-checks every hazard's stored risk.asil against DetermineASIL(severity, exposure, controllability) per ISO 26262-3:2018 Table 4 — previously an already-present risk.asil was accepted verbatim with no auditability, exactly the gap x-FuSa spec §1.2.5's "MUST derive" language exists to prevent.
  • standard now uses the x-FuSa spec §2.4.1 canonical lowercase id (iso26262) instead of the display string "ISO 26262": hara init's default --standard flag, the repo's own checked-in .fusa-hara.json, and hara.Load now normalises legacy display-string values for backward compatibility (unrecognised ids still pass through verbatim, per spec).

Closes #62, closes #61.

Test plan

  • go build ./...
  • go vet ./...
  • go test -race -count=1 ./... (88.6% total coverage)
  • golangci-lint run ./... (0 issues)
  • go generate ./... (no diff)
  • Verified this repo's own .fusa-hara.json (5 hazards) all already have S/E/C-consistent ASILs — HARA008 does not fire against it
  • new tests: ValidateASIL mismatch/match/incomplete-S-E-C/empty-ASIL cases, HARA008 engine-rule fire/silent cases, Validate includes the ASIL mismatch, hara.Load standard normalisation (legacy display string, already-canonical, unrecognised passthrough)

x-FuSa spec §1.2.5 requires risk.asil to be MUST-derived from S×E×C per
ISO 26262-3:2018 Table 4, but DetermineASIL was only ever applied as a
fallback for an *empty* value — an already-present risk.asil was accepted
verbatim, so a hand-edited or copy-pasted hazard could claim any ASIL
regardless of its own S/E/C inputs with zero findings from `hara show` or
`check` (go-FuSa#62). Add hara.ValidateASIL (wrapped by new engine rule
HARA008, and folded into hara.Validate so `hara show`'s own gap list
surfaces it too) to flag a stored risk.asil that disagrees with the
table, skipping hazards with an incomplete S/E/C rating (HARA002's job)
or no risk.asil set. Verified against this repo's own checked-in
.fusa-hara.json: all 5 hazards' declared ASILs already match their S/E/C.

Separately, x-FuSa spec §2.4.1 requires standard ids to use the
canonical lowercase form ("iso26262") everywhere, never a display string
("ISO 26262") — `hara init`'s default --standard flag value and the
repo's own checked-in .fusa-hara.json still used the legacy display form
(go-FuSa#61). Changed the default to "iso26262", normalised the checked-in
file, and added hara.Load normalisation of a legacy display-string value
for backward compatibility with hand-authored files predating this
convention (an unrecognised id is still passed through verbatim).

Signed-off-by: Matt Jones <matt@jellybaby.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
Signed-off-by: Matt Jones <matt@jellybaby.com>
Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
…eck-and-standard-id

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
#	README.md
#	docs/tool-safety-manual.md
#	fusa.go
@SoundMatt
SoundMatt force-pushed the fix/hara-asil-crosscheck-and-standard-id branch from a1d5040 to bd4d3fa Compare July 28, 2026 22:19
@SoundMatt

Copy link
Copy Markdown
Owner Author

Closing and replacing: my rebase onto main used a plain On branch fix/fmea-tara-paths-and-coverage-quality
Your branch is up to date with 'origin/fix/fmea-tara-paths-and-coverage-quality'.

nothing to commit, working tree clean merge commit (missing DCO sign-off), then I attempted to fix it by amending + force-pushing — force-push is prohibited for this effort. Replacing with a fresh branch built via cherry-pick (no merge commits, no force-push) in a new PR.

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

Labels

None yet

Projects

None yet

1 participant