Skip to content

Bump browser ssh versions for ssh rewrite#510

Merged
heisbrot merged 2 commits intomainfrom
feature/ssh-rewrite
Nov 18, 2025
Merged

Bump browser ssh versions for ssh rewrite#510
heisbrot merged 2 commits intomainfrom
feature/ssh-rewrite

Conversation

@heisbrot
Copy link
Copy Markdown
Contributor

@heisbrot heisbrot commented Nov 18, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced SSH server detection for improved connectivity.
  • Improvements

    • Updated SSH access instructions with the --enable-ssh-root flag.
    • Updated WASM client to version 0.60.0.
  • Chores

    • Removed cypress from dev dependencies.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 18, 2025

Walkthrough

The PR replaces version parsing with semantic version comparison, adds SSH server type detection with conditional JWT handling, updates the default WASM package path to v0.60.0, introduces version testing, and removes the cypress devDependency. These changes modernize version logic and improve SSH configuration.

Changes

Cohort / File(s) Summary
Version Management & Comparison
src/utils/version.ts, src/utils/version.test.ts, src/modules/peers/PeerVersionCell.tsx
Replaced parseVersionString with a new compareVersions semantic versioning function; updated isRoutingPeerSupported and isNativeSSHSupported to use the new comparison logic; added comprehensive test suite for version checking edge cases.
SSH & Remote Access
src/modules/remote-access/ssh/useSSH.ts, src/modules/peer/PeerSSHInstructions.tsx
Added SSH server type detection via client.detectSSHServerType() to conditionally pass access token; updated SSH instructions text and netbird command to include --enable-ssh-root flag.
Configuration & Dependencies
src/utils/config.ts, package.json
Updated default WASM package path from v0.59.11 to v0.60.0 and added optional chaining for safer access; removed cypress devDependency.

Sequence Diagram(s)

sequenceDiagram
    participant React as React Component
    participant useSSH
    participant client as SSH Client
    participant conn as SSH Connection
    
    React->>useSSH: connect(config, accessToken)
    useSSH->>client: detectSSHServerType(hostname, port)
    client-->>useSSH: requiresJwt: boolean
    
    alt requiresJwt = true
        useSSH->>conn: createSSHConnection(config, accessToken)
    else requiresJwt = false
        useSSH->>conn: createSSHConnection(config)
    end
    
    conn-->>useSSH: connection
    useSSH-->>React: connection ready
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Version comparison logic: Verify compareVersions correctly implements semantic versioning across all version strings with "v" prefix, dev/beta/rc suffixes
  • SSH server type detection: Confirm the conditional JWT flow doesn't break existing authentication for non-JWT SSH servers
  • Multiple call sites updated: PeerVersionCell and version-related functions now depend on compareVersions—ensure no edge cases with undefined or malformed versions
  • New test coverage: Validate test.ts edge cases align with actual version format variations in production

Poem

🐰 A rabbit hops through version trees,
With semantic compare and JWT keys,
SSH now detects with care,
No parsing strings left bare,
Cypress flies away with ease!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Bump browser ssh versions for ssh rewrite' directly reflects the main changes: updating SSH-related functionality (version comparisons, SSH detection logic, wasm version bump) as part of an SSH rewrite effort.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/ssh-rewrite

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/utils/version.ts (1)

39-63: Consider documenting pre-release version handling behavior.

The compareVersions function handles basic semantic versions correctly. However, the behavior with pre-release suffixes (e.g., "v0.60.0-beta") may not be immediately obvious:

  • Line 48: split(".").map(Number) converts "0.60.0-beta" to [0, 60, NaN]
  • Lines 54-60: NaN comparisons always return false, causing the function to fall through and return true
  • This treats "0.60.0-beta" as >= "0.60.0", which appears intentional for feature support checks

While this works for the current test cases and use cases, consider adding a comment explaining this behavior, or explicitly handle pre-release versions if stricter semver compliance is needed in the future.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a632eee and bd5ea83.

📒 Files selected for processing (7)
  • package.json (0 hunks)
  • src/modules/peer/PeerSSHInstructions.tsx (2 hunks)
  • src/modules/peers/PeerVersionCell.tsx (2 hunks)
  • src/modules/remote-access/ssh/useSSH.ts (2 hunks)
  • src/utils/config.ts (1 hunks)
  • src/utils/version.test.ts (1 hunks)
  • src/utils/version.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • package.json
🧰 Additional context used
🧬 Code graph analysis (2)
src/utils/version.test.ts (1)
src/utils/version.ts (1)
  • isNativeSSHSupported (83-86)
src/modules/peers/PeerVersionCell.tsx (1)
src/utils/version.ts (1)
  • compareVersions (43-63)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build_n_push
  • GitHub Check: build_n_push
🔇 Additional comments (7)
src/modules/peer/PeerSSHInstructions.tsx (1)

42-42: LGTM!

The simplified description is clearer and more concise, focusing on the core purpose without implementation details.

src/modules/remote-access/ssh/useSSH.ts (2)

43-53: LGTM!

The SSH server type detection and conditional JWT authentication are well-implemented. The error handling correctly catches exceptions from both detectSSHServerType and createSSHConnection.


74-74: LGTM!

Correctly added accessToken to the dependency array since it's now used within the callback. This ensures the callback is recreated when the token changes, preventing stale closure issues.

src/utils/version.test.ts (1)

1-34: Excellent test coverage!

The test suite comprehensively covers edge cases including:

  • Versions with/without "v" prefix
  • Pre-release suffixes (beta, rc)
  • Development builds
  • Boundary conditions around v0.60.0

The CI-friendly exit code handling ensures build failures on test failures.

src/modules/peers/PeerVersionCell.tsx (1)

10-10: LGTM!

The migration to compareVersions is implemented correctly:

  • Line 34: The guard for missing latestVersion prevents runtime errors
  • Line 35: The logic !compareVersions(version, latestVersion) correctly identifies when version < latestVersion (update available)

The import reordering has no functional impact.

Also applies to: 17-17, 34-35

src/utils/version.ts (2)

71-76: LGTM!

The migration to compareVersions maintains the same logic while using the new semantic version comparison approach.


78-86: LGTM!

The native SSH support check now correctly uses the new compareVersions function with the v0.60.0 threshold, aligning with the PR's objective to bump SSH versions for the SSH rewrite.

Comment thread src/modules/peer/PeerSSHInstructions.tsx
Comment thread src/utils/config.ts
@heisbrot heisbrot requested a review from lixmal November 18, 2025 15:24
@heisbrot heisbrot merged commit d81b75a into main Nov 18, 2025
5 checks passed
@heisbrot heisbrot deleted the feature/ssh-rewrite branch November 18, 2025 16:08
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.

2 participants