test(selfhost): cover env_get, compose_file_args, and require_cmd in the deploy-common lib - #7844
Conversation
…the deploy-common lib test/unit/selfhost-deploy-common.test.ts only exercised maybe_infisical_run (and, since JSONbored#7766, env_put), leaving env_get, compose_file_args, and require_cmd in scripts/lib/selfhost-deploy-common.sh with no test seam despite being sourced by five deploy/verify scripts. Add a small parameterized runner that sources the lib and invokes one function per case (mirroring the existing spawn-a-real-bash harness) and cover: require_cmd present/missing; env_get plain/quoted values, comment+blank skipping, first-match-wins, absent-key and missing-file exit 1, and the $ENV_FILE fallback; compose_file_args default, override-present, SELFHOST_COMPOSE_FILES override, and missing-file exit 1.
|
🚨 Contributor flagged. Click here for more info: Superagent Dashboard |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
Caution 🛑 LoopOver review result - fixes requiredReview updated: 2026-07-21 15:07:22 UTC
Review summary Nits — 5 non-blocking
CI checks failing
Flagged checks (non-blocking)
Decision drivers
Context & advisory signals — never blocks the verdict
Linked issue satisfactionAddressed Review context
Contributor next steps
Signal definitions
🧪 Chat with LoopOverAsk LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.
Full command reference: https://loopover.ai/docs/loopover-commands 🧪 Experimental — new and may change. 🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.
|
|
LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (1), validate-tests (3), validate-tests (2))). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed. |
What & why
Closes #7769.
test/unit/selfhost-deploy-common.test.tsonly exercisedmaybe_infisical_run(and, since #7766 landed,env_put). The other three functions inscripts/lib/selfhost-deploy-common.sh—env_get,compose_file_args, andrequire_cmd— had no test seam, despite being sourced by five deploy/verify scripts and being where two other already-filed bugs in this file went undetected. This adds real unit coverage for them.What's tested
A small parameterized runner (
runLibFn) sources the lib in a scratch dir and invokes one function per case, mirroring the existing spawn-a-real-bashharness. Cases:require_cmd: succeeds silently for a present command (bash); exits 1 withrequired command not found: …for a missing one.env_get: plain unquoted value; strips surrounding double and single quotes; skips comment/blank lines and returns the first matching key with indentation and=-spacing trimmed; exit 1 for an absent key; exit 1 for a missing file; falls back to$ENV_FILEwhen no file arg is given.compose_file_args: emits-f docker-compose.ymlby default; addsdocker-compose.override.ymlwhen present; usesSELFHOST_COMPOSE_FILESverbatim when set; exits 1 withcompose file not found: …for a listed-but-missing file.Scope is exactly the remaining coverage —
env_put(added by #7766) andmaybe_infisical_runare left untouched, and this doesn't pre-empt the companioncompose_file_args/env_putbug-fix issues (it tests the current behavior, not a fix).Validation
test/unit/selfhost-deploy-common.test.ts: 20 tests pass (4maybe_infisical_run+ 4env_put+ 12 new), typecheck clean,git diff --checkclean.compose_file_argsemit the wrong flag fails 3 of the new cases.test/**), additive after the existing blocks; branched off currentmain, mergeable-clean.