Skip to content

refactor(wipe): drop dead method_cmd; wipe_drive is sole command source#39

Merged
Avicennasis merged 1 commit into
mainfrom
fix/wipe-method-cmd-dedup
Jul 16, 2026
Merged

refactor(wipe): drop dead method_cmd; wipe_drive is sole command source#39
Avicennasis merged 1 commit into
mainfrom
fix/wipe-method-cmd-dedup

Conversation

@Avicennasis

Copy link
Copy Markdown
Member

Summary

Resolves #49428. nist_method_for_type() returned a tier|desc|command triple, but the command field was dead duplication:

  • wipe_drive extracted it into a never-used local — the pre-existing SC2034 method_cmd warning.
  • No caller ever read field 3; the audit log and operator display record field 2 (the human description).

The duplicated command string was a latent advertised-vs-executed drift risk on a compliance-critical tool. Per the chosen approach (DRY / single source of truth):

  • nist_method_for_type now returns "tier|description" only.
  • Removed the dead method_cmd extraction from wipe_drive → clears the SC2034 for that var.
  • wipe_drive's case statement is now the sole source of truth for the per-type command; each branch carries a # ref: comment with its reference invocation so the documentation isn't lost.
  • tests/test_wipe-lib.bats updated to the two-field mapping.

No change to any executed wipe command, and no audit-schema change.

Testing

  • Full local suite green (test_autorun0, test_setup_results_dir, test_wipe-lib, test-wipe-lib, test_verify_wipe).
  • bats not installed locally; verified the mapping by sourcing the lib directly — output matches the updated test_wipe-lib.bats assertions exactly.
  • shellcheck --severity=warning on wipe-lib.sh: method_cmd SC2034 gone (remaining YELLOW/CYAN/remainder are pre-existing, out of scope).
  • bash -n clean on wipe-lib/wipe-now/wipe-wizard.

nist_method_for_type() returned a "tier|desc|command" triple, but the
command field was pure duplication: wipe_drive extracted it into a
never-used local (the SC2034 method_cmd warning) and no caller ever read
field 3 — the audit log and operator display record field 2 (description).
The duplicated command string was a latent advertised-vs-executed drift
risk on a compliance-critical tool.

- nist_method_for_type now returns "tier|description" only.
- Removed the dead method_cmd extraction from wipe_drive (clears SC2034).
- wipe_drive's case statement is now the single source of truth for the
  per-type command; each branch carries a "ref:" comment with its
  reference invocation so the documentation value isn't lost.
- Updated tests/test_wipe-lib.bats to the two-field mapping.

No change to any executed wipe command or to the audit schema.

Resolves #49428.
@Avicennasis
Avicennasis merged commit 8ec310f into main Jul 16, 2026
3 checks passed
@Avicennasis
Avicennasis deleted the fix/wipe-method-cmd-dedup branch July 16, 2026 14:00
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.

1 participant