refactor: extract shared test harness and consolidate audit findings#2
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses all 5 refactor bundles identified by the vibe-code-audit self-audit report:
tests/_test_lib.shwith sharedpass()/fail(),assert_eq(),setup_tmproot(),print_results(),build_filtered_path(), andassert_no_crash_diagnostics(). All 9 test files refactored to source the shared harness. Uniform--- Results: X passed, Y failed ---summary format.kv_from_file()andrepo_has_file_named()fromrun_index.shinto_lib.shfor reuse across pipeline scripts and tests.EMBED_ENV_FILEconstant in_lib.sh, replacing hardcoded$HOME/.config/vibe-code-audit/embed.envpath inrun_agentroot_embed.sh.build_filtered_path()andassert_no_crash_diagnostics()from the harness.shell=bashdirective to_lib.shand_test_lib.sh. Expand CI shellcheck gate to cover all 6 pipeline scripts +_lib.sh._lib.shdependency by design).vibe-code-audit/<timestamp>/).Net change: -152 lines (~300 duplicated lines removed, ~150 added in shared harness).
Test plan
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.shand_test_lib.shpass shellcheck cleankv_from_file/repo_has_file_nameddefinitions only in_lib.sh_lib.shandinstall.shEMBED_ENV_FILEunit tests added tolib_unit_test.sh(default value + override)pass()/fail()definitions remain in refactored test files