Skip to content

fix: hara ASIL C0 table, Sx/Ex/Cx format, subcmd errors, init guard (v0.5.29)#39

Merged
SoundMatt merged 1 commit into
mainfrom
fix/hara-asil-parity
Jun 13, 2026
Merged

fix: hara ASIL C0 table, Sx/Ex/Cx format, subcmd errors, init guard (v0.5.29)#39
SoundMatt merged 1 commit into
mainfrom
fix/hara-asil-parity

Conversation

@SoundMatt

Copy link
Copy Markdown
Owner

Summary

  • cfusa hara ASIL table: extended from 3-column (C1–C3) to 4-column (C0–C3) to match go-FuSa's DetermineASIL. S0/E0 = QM, C0 = valid class.
  • cfusa hara asil: accepts --severity S2 --exposure E4 --controllability C2 prefix format
  • cfusa hara asil: missing params → exit 2 (was exit 1)
  • cfusa hara init: guards against overwriting existing .fusa-hara.json → exit 2
  • cfusa hara <unknown>: unknown subcommand → exit 2 (was silent fallthrough to show)
  • 5 new tests in test_hara.c; updated 3 tests in test_hara_advanced.c

Parity

go-FuSa: TestDetermineASIL_Table4, TestRunHara_ASIL, TestRunHara_ASIL_MissingFlags, TestRunHara_InitAlreadyExists, TestRunHara_UnknownSubcommand

Test plan

  • All 34 test suites pass (verified locally: 100% pass)
  • cfusa hara asil --severity S2 --exposure E4 --controllability C2 prints ASIL-C
  • cfusa hara asil --severity S2 --exposure E4 --controllability C0 prints ASIL-A
  • cfusa hara asil --severity S2 exits 2
  • cfusa hara init on existing file exits 2
  • cfusa hara nope exits 2

…n subcmd (v0.5.29)

- cmd_hara: extend ASIL table from C1-C3 (3 cols) to C0-C3 (4 cols) matching
  go-FuSa DetermineASIL — S2/E4/C2 now ASIL-C, S2/E4/C3 now ASIL-D, etc.
- cmd_hara asil: accept --severity S2 / --exposure E4 / --controllability C2
  prefix format; use -1 sentinel to detect missing params
- cmd_hara asil: missing params returns exit 2 (was exit 1)
- cmd_hara init: returns exit 2 with "already exists" if .fusa-hara.json exists
- cmd_hara: unknown subcommand returns exit 2 (was silent fallthrough to show)
- tests/test_hara: update missing-params to expect exit 2; add 5 new tests
- tests/test_hara_advanced: update s0/e0/c0 tests to reflect valid boundary values

Parity with go-FuSa TestDetermineASIL_Table4, TestRunHara_ASIL,
TestRunHara_ASIL_MissingFlags, TestRunHara_InitAlreadyExists,
TestRunHara_UnknownSubcommand.

Signed-off-by: Matt Jones <matt@jellybaby.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Matt Jones <47545907+SoundMatt@users.noreply.github.com>
Comment thread cmd/cfusa/cmd_hara.c
case 's': s = atoi(optarg); break;
case 'e': e = atoi(optarg); break;
case 'c': c = atoi(optarg); break;
case 's': { const char *v = optarg; if (v[0]=='S'||v[0]=='s') v++; s = atoi(v); break; }
Comment thread cmd/cfusa/cmd_hara.c
case 'e': e = atoi(optarg); break;
case 'c': c = atoi(optarg); break;
case 's': { const char *v = optarg; if (v[0]=='S'||v[0]=='s') v++; s = atoi(v); break; }
case 'e': { const char *v = optarg; if (v[0]=='E'||v[0]=='e') v++; e = atoi(v); break; }
Comment thread cmd/cfusa/cmd_hara.c
case 'c': c = atoi(optarg); break;
case 's': { const char *v = optarg; if (v[0]=='S'||v[0]=='s') v++; s = atoi(v); break; }
case 'e': { const char *v = optarg; if (v[0]=='E'||v[0]=='e') v++; e = atoi(v); break; }
case 'c': { const char *v = optarg; if (v[0]=='C'||v[0]=='c') v++; c = atoi(v); break; }
Comment thread tests/test_hara.c
void test_hara_init_already_exists_returns_2(void)
{
/* First init should succeed */
char *argv1[] = {"cfusa", "init", "--dir", HARA_TEST_DIR, NULL};
Comment thread tests/test_hara.c
cmd_hara(4, argv1);

/* Second init → exit 2 */
char *argv2[] = {"cfusa", "init", "--dir", HARA_TEST_DIR, NULL};
@SoundMatt SoundMatt merged commit 592ad7d into main Jun 13, 2026
10 checks passed
@SoundMatt SoundMatt deleted the fix/hara-asil-parity branch June 13, 2026 22:57
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