Skip to content

chore(welcome): remove orphaned useBackendReachable probe (#2037)#3410

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
oxoxDev:chore/2037-remove-orphaned-backend-probe
Jun 5, 2026
Merged

chore(welcome): remove orphaned useBackendReachable probe (#2037)#3410
senamakel merged 1 commit into
tinyhumansai:mainfrom
oxoxDev:chore/2037-remove-orphaned-backend-probe

Conversation

@oxoxDev
Copy link
Copy Markdown
Contributor

@oxoxDev oxoxDev commented Jun 5, 2026

Summary

  • Removes the orphaned useBackendReachable hook (app/src/hooks/useBackendReachable.ts) and its test — dead code with zero importers.
  • The hook's docstring still claims the "Continue locally" CTA "is gated on unreachable … per issue Add a local-only escape hatch in onboarding when api.tinyhumans.ai is unreachable #2037 AC", which is stale: the shipped design renders that CTA unconditionally.
  • Pure dead-code removal — no runtime behavior change.

Problem

In #2208 the maintainer first added useBackendReachable and gated the Welcome "Continue locally" CTA on a backend-reachability probe (commit df85d78f1, "Per #2037 AC, the offline-login button must only appear when the backend is unreachable"). A later commit in the same PR — 6ccd170a6 "route local users through manual setup" — deliberately de-wired the probe, made the CTA unconditional, and updated the Welcome tests to assert the button renders "regardless of runtime mode" / "in cloud mode too".

The result on main: the CTA is intentionally always-on, but useBackendReachable.ts and its test were left behind with no importers and a docstring that documents an approach the maintainer's own later commit reversed. knip flags it, and the stale docstring misleads anyone reading it into thinking an AC is unmet.

Solution

Delete app/src/hooks/useBackendReachable.ts and app/src/hooks/__tests__/useBackendReachable.test.tsx. Nothing imports either (verified repo-wide). getBackendUrl — the only thing the hook depended on — remains in use by 10 other call sites and is untouched.

This intentionally does not re-introduce the probe/banner UX. That would reverse a deliberate maintainer decision; if that UX is still wanted it should be a separate, discussed change.

Submission Checklist

  • N/A: removal of dead code and its own test — no behavior to add tests for.
  • N/A: changed lines are deletions only — diff-cover has no new lines to cover.
  • N/A: behaviour-only/no-op change — no coverage-matrix feature row affected.
  • N/A: no matrix feature IDs affected.
  • No new external network dependencies introduced.
  • N/A: does not touch a release-cut smoke surface (removes an unused hook).
  • N/A: not closing the issue in this PR — see ## Related.

Impact

  • Desktop/web/CLI: none. The removed hook had no importers, so no code path changes.
  • Removes one knip unused-export finding; eliminates a misleading docstring.

Related


AI Authored PR Metadata (required for Codex/Linear PRs)

Linear Issue

  • Key: N/A
  • URL: N/A

Commit & Branch

  • Branch: chore/2037-remove-orphaned-backend-probe
  • Commit SHA: 37aff1441

Validation Run

  • pnpm --filter openhuman-app format:check
  • pnpm typecheck
  • Focused tests: N/A — only deletions; the deleted test covered the removed hook.
  • Rust fmt/check (if changed): N/A — no Rust changed (pre-push rust:check passed regardless).
  • Tauri fmt/check (if changed): N/A — no Tauri changed.

Validation Blocked

  • command: N/A
  • error: N/A
  • impact: N/A

Behavior Changes

  • Intended behavior change: none — dead-code removal.
  • User-visible effect: none.

Summary by CodeRabbit

  • Tests

    • Removed backend connectivity verification test suite.
  • Chores

    • Removed internal backend status monitoring functionality.

…ai#2037)

The useBackendReachable hook and its test were added in tinyhumansai#2208 to gate the
"Continue locally" CTA on backend reachability, but a later commit in that
same PR (route local users through manual setup) intentionally de-wired the
probe and made the CTA unconditional, locking that in via tests asserting
the button renders regardless of runtime mode.

The hook has had zero importers since, and its docstring still claims the
CTA "is gated on unreachable ... per issue tinyhumansai#2037 AC" — stale, contradicting
the shipped always-on design. Remove the dead hook + test so knip stops
flagging it and the misleading docstring no longer implies an unmet AC.
@oxoxDev oxoxDev requested a review from a team June 5, 2026 13:27
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 2026

📝 Walkthrough

Walkthrough

This PR removes the useBackendReachable hook and its test suite. The hook previously probed backend reachability by issuing a timed fetch request to the configured backend endpoint, transitioning through probing, reachable, and unreachable states.

Changes

Cohort / File(s) Summary
Backend Reachability Hook Removal
app/src/hooks/useBackendReachable.ts, app/src/hooks/__tests__/useBackendReachable.test.tsx
Removed the useBackendReachable hook that fetched backend URL and issued timed /health requests with AbortController, along with its Vitest test suite covering status transitions and error cases. Deleted exported type BackendProbeStatus ('probing' | 'reachable' | 'unreachable').

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

A probe once watched the backend's distant door,
With quiet /health checks forevermore—
But now it fades, its mission yet unclear,
Deleted clean, the path ahead is near. 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR removes code related to #2037 objectives without completing the full feature implementation required by that issue. This PR should clarify its relationship to #2037: either confirm it's a preparatory cleanup with a separate tracking issue for the full feature, or document why the full acceptance criteria are being abandoned.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately describes the main change: removing the unused useBackendReachable hook and its test file.
Out of Scope Changes check ✅ Passed All changes are in-scope: removal of unused hook and test files with no other modifications or unrelated deletions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@senamakel senamakel merged commit 43233c6 into tinyhumansai:main Jun 5, 2026
23 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a local-only escape hatch in onboarding when api.tinyhumans.ai is unreachable

2 participants