Skip to content

feat: attestation, FUSA-STUB001/002 detection, and coverage-gate wiring - #85

Merged
SoundMatt merged 2 commits into
mainfrom
fusaops-attestation-detection-coverage-pr2
Jul 28, 2026
Merged

SoundMatt merged 2 commits into
mainfrom
fusaops-attestation-detection-coverage-pr2

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

Follow-on to v1.140.0 (schema conformance). That PR brought FuSaOps' own hara/fmea/tara/safetycase/sas/sci into x-FuSa spec conformance; this one implements the actual enforcement mechanism the spec defines (§1.6.1 detection heuristics, §1.6.2 attestation) and wires it into the CLI.

New root-package Attestation type (attestation.go) — a DCO-style provenance record: status/implementationAuthor/independentReviewer/reviewedAt/contentHash. AttestationValid checks non-staleness (hash match) and genuine independence (reviewer ≠ author), reusing the exact independence concept already in the vv package.

New qualitybar package implementing both §1.6.1 rules:

  • DetectPlaceholder — FUSA-STUB001, deny-list scan for literal template text, always ERROR, disposition-suppressible only (no attestation can make placeholder text real).
  • DetectBlankFallback — FUSA-STUB002, distinct-value-ratio <0.1 across ≥10 entries, a WARNING by default, not gating — deliberately advisory since a similarity heuristic can misread genuinely repetitive-but-real content as templated.

Both reuse fusaops.Finding/fusaops.ComputeFingerprint — no new finding shape, no new suppression mechanism for Rule A (uses the existing disposition path).

Wired into all 5 relevant commands (fmea/tara/safety-case/sas/hara):

  • Runs both detection rules, prints findings, gates the exit code.
  • New --require-attestation/--strict flags — a valid attestation suppresses FUSA-STUB002; without the flag it stays advisory (the "DCO checkbox" pattern: nothing blocks by default, opt into a hard gate, satisfied by an honest attestation not by gaming the heuristic).
  • Attestation carry-forward: since Build always assembles a fresh document, a hand-added attestation would otherwise be silently discarded every run. Each command now loads any prior saved report, carries its Attestation forward onto the freshly-built struct, and staleness is automatic — if the regenerated content's hash no longer matches, AttestationValid correctly returns false.

Coverage metrics — fmea/tara Summary gains coveragePct against a stated, honest denominator (componentsInProject/assetsInProject + a *InventoryMethod string documenting how it was counted) and --min-coverage N. FMEA is 19.5% (8 of 41 tracked FuSaOps packages); TARA is 80% (8 of its own 10 known evidence artefacts) — reported plainly, not inflated.

FuSaOps' own artifacts never carry a fabricated "reviewed" attestation (they're 100% auto-generated) — Attestation stays nil/omitted throughout.

Test plan

  • go build ./... / go vet ./... / gofmt -l . — clean
  • go test ./... — all packages pass, zero regressions
  • New qualitybar package: 100% coverage
  • Root package coverage: 90.0% → 91.7%
  • End-to-end manual + automated test of attestation carry-forward (build → hand-add valid attestation → rebuild → confirm it survives and re-validates)
  • Manually verified --min-coverage gating and --require-attestation/--strict flag parsing
  • Regenerated fmea.json/tara.json/safety-case.json and inspected output

…e-gate wiring (x-FuSa spec §1.6.1/§1.6.2)

Closes out the enforcement mechanism from spec v1.14.0 against
FuSaOps' own artifacts, on top of the schema conformance work in
v1.140.0.

- New root-package Attestation type + AttestationValid/ContentHash
  helpers -- a DCO-style provenance record reusing the vv package's
  independence concept (independent reviewer distinct from
  implementation author, hash-pinned to the exact content reviewed).
- New qualitybar package implementing both section 1.6.1 detection
  rules: DetectPlaceholder (FUSA-STUB001, always ERROR,
  disposition-suppressible only) and DetectBlankFallback
  (FUSA-STUB002, a distinct-value-ratio WARNING, advisory by default,
  suppressible only by a valid attestation).
- fmea/tara/safetycase/sas/hara each gain an Attestation field (nil
  by default -- no fabricated reviews) and an AttestationContentHash
  function.
- cmd_{fmea,tara,safety_case,sas,hara}.go run both detection rules,
  gate the exit code (FUSA-STUB002 only under the new
  --require-attestation/--strict flags), and carry a prior run's
  attestation forward across regeneration since Build always
  assembles a fresh document. Staleness is automatic via hash
  mismatch.
- fmea/tara Summary gains coveragePct + a stated denominator
  methodology, plus --min-coverage N.
- Regenerated fmea.json/tara.json/safety-case.json.
- 11 new requirements registered.

Signed-off-by: SoundMatt <SoundMatt@users.noreply.github.com>
Signed-off-by: SoundMatt <SoundMatt@users.noreply.github.com>
Comment thread qualitybar/qualitybar.go
Value string
}

var placeholderBracketRE = regexp.MustCompile(`\[[A-Za-z ][^\]]*\]`)
Comment thread qualitybar/qualitybar.go
var placeholderBracketRE = regexp.MustCompile(`\[[A-Za-z ][^\]]*\]`)

// placeholderSubstrings mirrors the x-FuSa spec §1.6.1 Rule A deny-list.
var placeholderSubstrings = []string{
@SoundMatt
SoundMatt merged commit 43aad48 into main Jul 28, 2026
21 of 22 checks passed
@SoundMatt
SoundMatt deleted the fusaops-attestation-detection-coverage-pr2 branch July 28, 2026 19:27
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.

2 participants