Repository navigation
refactor(initcmd): delete the failureKind relay - #44
Conversation
|
Architect review — approved. Pure relay deletion: each failInitialization site now classifies inline with the exact mapping the deleted classifyInitialization performed (Generic/Config direct, authorization/verification via the retained local classifiers); run() returns errors unwrapped. The one semantic nuance — non-wrapped errors from injected doubles losing the explicit Generic fallback — is covered by default exit-code resolution. Two files, no drive-bys. |
TDD assessmentVerdict: insufficient. The existing tests do pin several exit codes through the init Cobra command, so run returning initializer errors unchanged is exercised end-to-end: missing config saver, authorization classifications, generic verification failure, credential write/redaction, config-save failure, and both rollback-failure variants would fail if run collapsed them to the wrong code. But the distributed mapping is not covered site by site. Exact missing exit-code assertions are:
The less-traveled save paths are covered well: config-save failure asserts Config for both delete-new and restore-old rollback, rollback errors remain Config, and credential-write/rollback store errors assert Config while checking redaction. Cheapest placement: add one table-driven test in internal/cmd/initcmd/init_test.go, extending initHarness/initStore only with opener, Exists, and Get error hooks (and dependency overrides), then execute the command and assert exitcode.Code for each row. Return an invalid envelope from Authorize for the encode case and add one Config-class verification row to the existing verification coverage. Also add Generic to either existing-credential refusal assertion; no new abstraction is needed. |
Summary
LOC delta
Verification
Closes #34