Skip to content

test(selfhost): cover env_get and require_cmd in selfhost-deploy-common - #7920

Closed
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:test-selfhost-deploy-common-coverage-v2
Closed

test(selfhost): cover env_get and require_cmd in selfhost-deploy-common#7920
davion-knight wants to merge 1 commit into
JSONbored:mainfrom
davion-knight:test-selfhost-deploy-common-coverage-v2

Conversation

@davion-knight

Copy link
Copy Markdown
Contributor

Problem

test/unit/selfhost-deploy-common.test.ts covered only maybe_infisical_run — and, via their own recently-merged bug-fix PRs, env_put (#7766) and compose_file_args (#7765). The remaining two functions in scripts/lib/selfhost-deploy-common.shenv_get and require_cmd, both sourced by 5 deploy/verify scripts — had no test seam at all, the same structural gap that let two other bugs in this file ship unnoticed.

Per #7769's scope note, this adds only the remaining coverage (env_get, require_cmd); env_put/compose_file_args are already covered by their companion fixes and aren't duplicated.

Tests

Following the file's existing source-and-invoke harness (spawnSync("bash", …) sourcing the lib):

env_get — reads an existing key's value; strips surrounding single/double quotes; ignores comment/blank lines and matches the key exactly (a FOOBAR= line does not satisfy env_get FOO); returns non-zero for a missing key and for a missing file.

require_cmd — succeeds silently for a command on PATH; exits non-zero with the actionable required command not found: <cmd> error otherwise (asserting execution does not continue past it).

Notes

Test-only — no change to the shell library. scripts/** and test/** are both outside Codecov's scope, so there's no codecov/patch obligation; the file's 18 tests (11 existing + 7 new) all pass and root typecheck is clean.

Closes #7769

selfhost-deploy-common.test.ts covered only maybe_infisical_run, env_put, and
compose_file_args (the last two added by their own bug-fix PRs). env_get and
require_cmd -- both sourced by 5 deploy/verify scripts -- had no test seam,
the same structural gap that let two other bugs in this file ship unnoticed.

Add tests following the file's existing source-and-invoke harness:
- env_get: reads an existing key, strips surrounding quotes, ignores
  comment/blank lines and matches the key exactly (not as a prefix), and
  returns non-zero for a missing key or missing file.
- require_cmd: succeeds silently for a command on PATH, and exits non-zero
  with an actionable 'required command not found' error otherwise.

Test-only; no change to the shell library.

Closes JSONbored#7769
@davion-knight
davion-knight requested a review from JSONbored as a code owner July 21, 2026 17:48
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 21, 2026
@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-21 17:56:35 UTC

1 file · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This is a test-only PR adding coverage for env_get and require_cmd in scripts/lib/selfhost-deploy-common.sh, following the file's existing source-and-invoke harness pattern used for the other functions in the same suite. The tests are well-targeted: env_get cases cover exact-key matching (not prefix), quote-stripping, comment/blank-line handling, missing key, and missing file; require_cmd cases assert both the success and failure exit paths using a REACHED_END marker to prove execution actually stopped. The PR closes #7769 and explicitly avoids duplicating env_put/compose_file_args coverage already added in #7766/#7765.

Nits — 3 non-blocking
  • The four FAILED validate-tests/validate checks have no detail provided, so their cause can't be verified from this diff — if they're pre-existing/unrelated to this file, that should be confirmed on the PR rather than assumed.
  • Consider a case where the key's value itself contains a `=` (e.g. `FOO=bar=baz`) to confirm env_get doesn't truncate at the first `=`.
  • Consider a case with trailing whitespace after the value to confirm the strip behavior handles it as expected.

CI checks failing

  • validate
  • validate-tests (3)
  • validate-tests (2)
  • validate-tests (1)

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #7769
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 143 registered-repo PR(s), 89 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor davion-knight; Gittensor profile; 143 PR(s), 4 issue(s).
Improvement ℹ️ Insufficient signal risk: clean · value: insufficient-signal · LLM: minor
Linked issue satisfaction

Addressed
The PR adds test coverage for env_get and require_cmd following the existing harness structure, and explains that compose_file_args/env_put are already covered by companion issues #7765/#7766, matching the issue's scope note to avoid duplication.

Review context
  • Author: davion-knight
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Rust
  • Official Gittensor activity: 143 PR(s), 4 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask 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.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

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.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (3), validate-tests (2), validate-tests (1))). 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.

@loopover-orb loopover-orb Bot closed this Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

scripts/lib/selfhost-deploy-common.sh: 3 of 4 functions have zero test coverage

2 participants