Skip to content

refactor: extract shared test harness and consolidate audit findings#2

Merged
codesoda merged 2 commits into
mainfrom
feat/audit-refactor-bundles
Mar 8, 2026
Merged

refactor: extract shared test harness and consolidate audit findings#2
codesoda merged 2 commits into
mainfrom
feat/audit-refactor-bundles

Conversation

@codesoda

@codesoda codesoda commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Summary

Addresses all 5 refactor bundles identified by the vibe-code-audit self-audit report:

  • Bundle 1+5 (test harness): Extract tests/_test_lib.sh with shared pass()/fail(), assert_eq(), setup_tmproot(), print_results(), build_filtered_path(), and assert_no_crash_diagnostics(). All 9 test files refactored to source the shared harness. Uniform --- Results: X passed, Y failed --- summary format.
  • Bundle 2 (promote utils): Move kv_from_file() and repo_has_file_named() from run_index.sh into _lib.sh for reuse across pipeline scripts and tests.
  • Bundle 3 (config constant): Define EMBED_ENV_FILE constant in _lib.sh, replacing hardcoded $HOME/.config/vibe-code-audit/embed.env path in run_agentroot_embed.sh.
  • Bundle 4 (render test dedup): Both render smoke tests now use shared build_filtered_path() and assert_no_crash_diagnostics() from the harness.
  • Shellcheck: Add shell=bash directive to _lib.sh and _test_lib.sh. Expand CI shellcheck gate to cover all 6 pipeline scripts + _lib.sh.
  • install.sh: Add NOTE comment documenting standalone POSIX design (no _lib.sh dependency by design).
  • gitignore: Ignore audit output directories (vibe-code-audit/<timestamp>/).

Net change: -152 lines (~300 duplicated lines removed, ~150 added in shared harness).

Test plan

  • All 10 test files pass (lib_unit_test, manifest_integrity, trap_cleanup, render_pdf_smoke, render_system_map_smoke, empty_repo, grep_fallback, embed_env_hardening, atomic_index_midrun_failure, run_index_mock_smoke)
  • _lib.sh and _test_lib.sh pass shellcheck clean
  • Bundle 2 success metric: kv_from_file/repo_has_file_named definitions only in _lib.sh
  • Bundle 3 success metric: config path literal only in _lib.sh and install.sh
  • New EMBED_ENV_FILE unit tests added to lib_unit_test.sh (default value + override)
  • Review: no inline pass()/fail() definitions remain in refactored test files

codesoda added 2 commits March 8, 2026 16:51
Address all 5 refactor bundles from the vibe-code-audit report:

- Bundle 1+5: Extract tests/_test_lib.sh with shared pass()/fail(),
  assert_eq(), setup_tmproot(), print_results(), build_filtered_path(),
  and assert_no_crash_diagnostics(). Standardize all 9 test files to
  uniform "--- Results: X passed, Y failed ---" format.
- Bundle 2: Promote kv_from_file() and repo_has_file_named() from
  run_index.sh into _lib.sh for reuse across pipeline and tests.
- Bundle 3: Define EMBED_ENV_FILE constant in _lib.sh, replacing
  hardcoded path in run_agentroot_embed.sh.
- Bundle 4: Render test dedup via shared build_filtered_path() and
  assert_no_crash_diagnostics() helpers.
- Add shellcheck shell directive to _lib.sh and _test_lib.sh.
- Expand shellcheck CI gate to cover all 6 pipeline scripts + _lib.sh.
- Add NOTE comment to install.sh documenting standalone POSIX design.

Net: -152 lines (~300 duplicated lines removed, ~150 added in harness).
All 10 tests pass. Both shared libs pass shellcheck clean.
@codesoda codesoda marked this pull request as ready for review March 8, 2026 06:55

@cadence cadence Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cadence Session Review

No AI session data was found for this PR's commits.

Sign up to Cadence to have your AI sessions reviewed

@codesoda codesoda merged commit a22258a into main Mar 8, 2026
@codesoda codesoda deleted the feat/audit-refactor-bundles branch March 8, 2026 06:58
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