refactor(module): extract dual-mode bootstrap into lib/module_bootstrap.sh (deepening #3)#255
Merged
Merged
Conversation
…ap.sh (deepening #3) Every module/*.module.sh repeated a ~13-17 line standalone-vs-engine bootstrap header. That collapses into one lib/module_bootstrap.sh exposing module_bootstrap (no-op in engine mode; in standalone: set -euo pipefail + inherit_errexit, resolve MODULE_DIR/REPO_ROOT/LIB_DIR, source logger/general/module_helper -- same options, same libs, same order, self-locating from its own path). Each module + the 4 templates now carry a ~3-line stub that sources the bootstrap and calls it. ADR-0001 standalone/engine boundary + the runner contract are unchanged. A guarded never-executed `source module_helper.sh` (with a `# shellcheck source=` directive, kcov-excluded) lets shellcheck follow the 2-level dynamic source so metadata vars are not flagged SC2034 -- avoids a new disable directive. Adds module_bootstrap_spec.bats (11 tests). Claude-Session: https://claude.ai/code/session_01NX5H2vuMTv4mBmjpPYoS3s Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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
Architecture deepening #3 (grilling-locked): extract the repeated dual-mode
bootstrap header out of every module into one
lib/module_bootstrap.sh.module_bootstrap: no-op in engine mode; in standalone runs the strict-modeoptions, resolves MODULE_DIR/REPO_ROOT/LIB_DIR, and sources
logger/general/module_helper -- byte-identical behavior, self-locating from
its own path.
module/*.module.sh+ 4 templates now carry a ~3-line stub (down from~13-17). ADR-0001 boundary + runner contract unchanged.
sourcewith a# shellcheck source=hint so static analysis can follow the2-level dynamic source).
Test plan
paths+export, engine no-op (no clobber/re-source), self-location, env-LIB_DIR
precedence.
false-green from a hidden template_smoke failure and fixed it).
Note: coverage margin is thin (baseline 80.83% -> 80.23%; the extraction removed
~13 per-module executed header lines). Clears the gate but a future unrelated dip
could push it under.
Deepening candidate #3.
.agents/memoryuntouched.Generated with Claude Code.