Skip to content

feat(selfhost): add boot environment preflight#2579

Merged
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/selfhost-env-preflight
Jul 2, 2026
Merged

feat(selfhost): add boot environment preflight#2579
JSONbored merged 1 commit into
JSONbored:mainfrom
oktofeesh1:codex/selfhost-env-preflight

Conversation

@oktofeesh1

Copy link
Copy Markdown
Contributor

Summary

Adds a self-host environment preflight that reports all missing or invalid boot requirements at once instead of failing one variable at a time. Closes #2080.

What changed

  • Added a pure preflightEnv validator with formatted boot errors.
  • Wired the self-host Node entrypoint to run the preflight immediately after file-secret loading.
  • Covered missing Redis, setup-wizard conditionals, Orb broker bypass, Postgres URL validation, all-problems reporting, and secret-value redaction.

Why

Self-host operators should get one actionable startup report for required configuration instead of a restart loop that reveals each missing variable separately.

Validation

  • npx vitest run test/unit/selfhost-preflight.test.ts --coverage.enabled true --coverage.include src/selfhost/preflight.ts --coverage.reporter text
  • npm run typecheck
  • git diff --check
  • npm run test:ci
  • npm audit --audit-level=moderate

Notes

  • The local MCP preflight CLI was available from the workspace package but not authenticated in this environment, so the full local gate above was used as the release check.

@oktofeesh1
oktofeesh1 requested a review from JSONbored as a code owner July 2, 2026 09:43
@dosubot dosubot Bot added the size:M label Jul 2, 2026
@loopover-orb

loopover-orb Bot commented Jul 2, 2026

Copy link
Copy Markdown

Warning

🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨

⏸️ Gittensory review result - manual review recommended

Review updated: 2026-07-02 11:12:12 UTC

4 files · 1 AI reviewer · no blockers · readiness 62/100 · CI pending · blocked

⏸️ Suggested Action - Manual Review

  • Touches a guarded path — held for manual review

Review summary
The change adds a focused self-host preflight validator, runs it immediately after file-secret loading, and updates the self-host smoke workflow to provide the new setup-wizard requirements. The validator accumulates missing/invalid Redis, setup, app credential, and Postgres configuration without echoing secret values, and the added unit coverage exercises the meaningful branches shown in the diff. I do not see a reachable correctness break in the provided changed files.

Nits — 6 non-blocking
  • nit: src/selfhost/preflight.ts:83 names the boolean `hasPartialGitHubApp`, but it is true for both partial and complete GitHub App configuration, so `hasAnyGitHubAppCredential` would make the setup-bypass condition easier to audit.
  • nit: src/selfhost/preflight.ts:61 hard-codes RSA private keys; keep this only if GitHub App keys are intentionally RSA-only here, otherwise validate that the PEM parses as a private key without pinning the algorithm.
  • src/selfhost/preflight.ts:83: rename `hasPartialGitHubApp` or split it into `hasAnyGitHubAppCredential` and `hasCompleteGitHubAppCredential` so future changes do not misread the setup-wizard bypass.
  • src/selfhost/preflight.ts:61: add a short comment or test name documenting why RSA is required for GitHub App private keys.
  • Readiness score is below the configured threshold — Use the readiness panel as advisory maintainer context; the score does not block this PR.
  • Touches a guarded path — held for manual review — A maintainer must review and merge this change.
Signal Result Evidence
Code review ✅ No blockers 1 reviewer
Linked issue ✅ Linked #2080
Related work ⚠️ 1 scoped overlap Top overlaps are listed below; lower-confidence bulk is hidden.
Change scope ❌ 8/20 High review scope from cached public metadata (size label size:L; 1 linked issue).
Validation posture ❌ 5/25 Preflight is holding this PR: the review lane is unavailable, so it is not ready for automated review.
Contributor workload ✅ 10/10 Author activity: 68 registered-repo PR(s), 61 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor oktofeesh1; Gittensor profile; 68 PR(s), 4 issue(s).
Gate result ⚠️ Not blocking Advisory; not blocking this PR.
Review context
  • Author: oktofeesh1
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository registration is not available in the local Gittensory cache.
  • Public profile languages: not available
  • Official Gittensor activity: 68 PR(s), 4 issue(s).
  • Related work: Titles/paths share 11 meaningful terms. (issue #2550, PR #2585)
Contributor next steps
  • Review top overlaps.
  • Add a concise scope and risk note.
  • Await review-lane availability.
  • Refresh registry data or choose a registered active repo.
  • Check active issues and PRs before submitting.
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.

🟩 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 Gittensory, a quiet PR intelligence layer for OSS maintainers.

  • Re-run Gittensory review

@loopover-orb loopover-orb Bot added gittensor gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier. labels Jul 2, 2026
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.99%. Comparing base (ea07de7) to head (5f01a65).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2579   +/-   ##
=======================================
  Coverage   95.98%   95.99%           
=======================================
  Files         229      230    +1     
  Lines       25810    25864   +54     
  Branches     9389     9410   +21     
=======================================
+ Hits        24774    24828   +54     
  Misses        425      425           
  Partials      611      611           
Files with missing lines Coverage Δ
src/selfhost/preflight.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@oktofeesh1
oktofeesh1 force-pushed the codex/selfhost-env-preflight branch from c592da8 to 5f01a65 Compare July 2, 2026 11:12
@dosubot dosubot Bot added the lgtm label Jul 2, 2026
@JSONbored
JSONbored merged commit 839342b into JSONbored:main Jul 2, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:feature Gittensor-scored feature linked to a feature issue — scores a 0.25x multiplier.

Development

Successfully merging this pull request may close these issues.

feat(selfhost): boot-time preflight that reports missing/invalid required env with actionable messages

2 participants