Skip to content

ref: dead-code and duplication cleanup#843

Merged
Chemaclass merged 3 commits into
mainfrom
ref/codebase-cleanup
Jul 20, 2026
Merged

ref: dead-code and duplication cleanup#843
Chemaclass merged 3 commits into
mainfrom
ref/codebase-cleanup

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

A multi-agent audit swept the codebase across eight quality axes (DRY, shared constants, dead code, source cycles, fragile constructs, error-hiding defensive code, legacy/fallback code, comment slop). Five axes were already clean; three surfaced provably-safe removals.

💡 Changes

  • Reuse the existing format_duration helper in print_execution_time instead of open-coding the same ms→Xm Ys/X.XXs/Xms branching (branch-equivalence verified at the 1000/60000 ms boundaries; off the per-test hot path).
  • Drop the superseded get_tags_for_function stdout wrapper and its 4 tests — runner.sh uses the fork-free build_tags_map + tags_for_function pair directly, leaving zero production callers.
  • Remove 9 internal state/clock accessor functions with zero call sites anywhere in the tracked repo (backing _BASHUNIT_* vars are read/written directly).

Internal only — no user-facing behavior change, so no CHANGELOG entry. Full gate green: sequential + --parallel --simple --strict (1380 passed), make sa, make lint, ./build.sh --verify.

https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED

The run-footer time formatter open-coded the same ms -> Xm Ys / X.XXs / Xms
branching already provided by bashunit::console_results::format_duration.
Since print_execution_time runs once per run (not on the per-test hot path),
delegate to the shared helper instead of re-deriving the logic.

Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
The stdout-returning tag wrapper had zero production callers: runner.sh uses
the fork-free build_tags_map + tags_for_function pair directly. Only its own
unit tests exercised it. Remove the wrapper and its 4 tests, keeping the tags
path singular. function_matches_tags tests remain.

Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
Drop 9 internal getters/resets that had zero call sites anywhere in the
tracked repo (proven via git grep; no dynamic dispatch, not part of the
public assertion/CLI API). The backing _BASHUNIT_* variables are read and
written directly, so these accessors were dead:

- bashunit::state::get_test_exit_code
- bashunit::state::get_test_title
- bashunit::state::get_current_test_interpolated_function_name
- bashunit::state::get_test_hook_failure / reset_test_hook_failure
- bashunit::state::get_test_hook_message / reset_test_hook_message
- bashunit::state::is_assertion_failed_in_test
- bashunit::clock::total_runtime_in_nanoseconds

Claude-Session: https://claude.ai/code/session_01JSeB8UzLCpqst55hAK6dED
@Chemaclass Chemaclass added the refactoring Refactoring or cleaning related label Jul 20, 2026
@Chemaclass Chemaclass self-assigned this Jul 20, 2026
@Chemaclass
Chemaclass merged commit 8ca608c into main Jul 20, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the ref/codebase-cleanup branch July 20, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Refactoring or cleaning related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant