Skip to content

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

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

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

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:30
@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:44:25 UTC

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

🛑 Suggested Action - Fix Blockers

Review summary
This is a pure test-addition PR that extends test/unit/selfhost-deploy-common.test.ts to cover env_get and require_cmd, the two remaining untested functions in the shared shell lib, following the existing source-and-invoke harness pattern already used for the other functions in the file. The tests exercise real, reachable behavior (key lookup, quote-stripping, comment/prefix handling, missing key/file, PATH lookup, missing command) via actual subprocess execution rather than mocks, so they validate the real code path. The PR closes issue #7769 as required and matches its description exactly, with no changes to the shell library itself.

Nits — 3 non-blocking
  • The four undetailed 'validate'/'validate-tests' CI failures can't be diagnosed from what's given, but per BASE BRANCH STATUS this branch is 1 commit behind default — worth rebasing to rule that out before assuming a defect in this diff.
  • test/unit/selfhost-deploy-common.test.ts: env_get's quote-stripping test doesn't cover a mismatched-quote case (e.g. `FOO="unterminated`), though this is minor since the shell lib itself isn't changing here.
  • If validate-tests keeps failing after a rebase onto the current default branch, re-run CI before re-investigating — the failure is most likely unrelated to this diff.

CI checks failing

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

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

Partially addressed
The PR adds real, well-structured test coverage for env_get and require_cmd matching the existing harness, but compose_file_args coverage is not present in this diff and its claim that it's already covered by a companion PR (#7765) cannot be verified from the provided information.

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 (1), validate-tests (2), validate-tests (3))). 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