Skip to content

Conversation

@mdennis281
Copy link
Owner

Build out the websocket UI for the new dedicated lanscape app

Copilot AI review requested due to automatic review settings January 29, 2026 22:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces an experimental WebSocket interface for LANscape, enabling real-time network scanning capabilities with a standalone async WebSocket server. The implementation provides a comprehensive API for scan management, port list operations, and utility functions with delta-based updates for efficient real-time data synchronization.

Changes:

  • Added complete WebSocket server infrastructure with protocol definitions, handlers, and delta tracking
  • Integrated WebSocket server mode into the main application with new command-line arguments (--ws-server, --ws-port)
  • Implemented comprehensive test coverage with 940 lines of unit and integration tests
  • Added dependencies: websockets>=12.0,<14.0 and pytest-asyncio>=0.23 for async testing

Reviewed changes

Copilot reviewed 15 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/test_websocket.py Comprehensive test suite covering protocol, handlers, delta tracking, and integration scenarios
pyproject.toml Added WebSocket and async testing dependencies
lanscape/ui/ws/server.py Core WebSocket server with async connection handling, message routing, and real-time scan updates
lanscape/ui/ws/protocol.py Pydantic-based message protocol definitions (request, response, error, event)
lanscape/ui/ws/handlers/tools.py Handler for subnet validation, network listing, and configuration queries
lanscape/ui/ws/handlers/scan.py Handler for scan operations including start, subscribe, and delta updates
lanscape/ui/ws/handlers/port.py Handler for port list CRUD operations
lanscape/ui/ws/handlers/base.py Base handler class with action registration and async/sync handler support
lanscape/ui/ws/handlers/__init__.py Handler module exports
lanscape/ui/ws/delta.py Delta tracking system using MD5 hashing for efficient change detection
lanscape/ui/ws/__init__.py WebSocket module exports
lanscape/ui/main.py Integration of WebSocket server startup with port validation logic
lanscape/core/runtime_args.py New runtime arguments for WebSocket server mode and port configuration
examples/local_scan_reliability.py Example demonstrating network scan reliability testing
examples/local_example.py Basic example of library usage
examples/__init__.py Path setup for examples
.gitpod.yml Removed Gitpod configuration file

Copilot AI review requested due to automatic review settings January 31, 2026 08:10
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 29 out of 32 changed files in this pull request and generated 11 comments.

Comments suppressed due to low confidence (1)

lanscape/ui/blueprints/api/scan.py:102

  • The terminate_scan endpoint doesn't check if the scan exists before calling scan.terminate(). If scan_manager.get_scan(scan_id) returns None, this will raise an AttributeError. The endpoint should check for None and return a 404 error, consistent with the get_scan and get_scan_summary endpoints.
@api_bp.route('/api/scan/<scan_id>/terminate', methods=['GET'])
def terminate_scan(scan_id):
    """Terminate a running scan.

    Args:
        scan_id (str): Unique identifier for the scan

    Returns:
        JSON response indicating success or failure
    """

    scan = scan_manager.get_scan(scan_id)
    scan.terminate()
    return jsonify({'success': True})

Copilot AI review requested due to automatic review settings January 31, 2026 09:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 33 out of 36 changed files in this pull request and generated 9 comments.

@mdennis281 mdennis281 marked this pull request as draft February 1, 2026 01:29
@mdennis281 mdennis281 marked this pull request as ready for review February 1, 2026 04:39
Copilot AI review requested due to automatic review settings February 1, 2026 04:39
@mdennis281 mdennis281 self-assigned this Feb 1, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 36 out of 38 changed files in this pull request and generated 10 comments.

DEFAULT_HOST = 'localhost'
DEFAULT_PORT = 8766

def __init__(self, host: str = DEFAULT_HOST, port: int = DEFAULT_PORT):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
Subclasses should register their handlers in __init__.
"""

def __init__(self):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
- port.delete: Delete a port list
"""

def __init__(self, port_manager: Optional[PortManager] = None):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
Clients receive only the changed portions of scan results.
"""

def __init__(self):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +56 to +63
def __init__(
self,
initial_multiplier: float = 1.0,
decrease_percent: float = 0.25,
debounce_sec: float = 5.0,
min_multiplier: float = 0.1,
on_warning: Optional[Callable[[str, dict], None]] = None
):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
Comment on lines +140 to +147
def __init__(
self,
max_workers: int,
retry_config: RetryConfig,
multiplier_controller: MultiplierController,
thread_name_prefix: str = "RetryPool",
on_job_error: Optional[Callable[[Any, Exception, str], None]] = None
):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
if not self.running:
self.results.end_time = time()

def _handle_warning(self, warning_type: str, warning_data: dict):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The method _handle_warning is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
- scan.unsubscribe: Unsubscribe from scan updates
"""

def __init__(self, scan_manager: Optional[ScanManager] = None):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
- tools.arp_supported: Check if ARP is supported on this system
"""

def __init__(self):
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The init method is missing a return type hint. According to the coding guidelines, type hints are required for all functions and methods. Add -> None as the return type.

Copilot generated this review using guidance from repository custom instructions.
@@ -0,0 +1,4 @@
import lanscape
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The import statement import lanscape on line 1 is not used in this module. This import should either be removed or have a comment explaining why it's needed (e.g., if it's required for module initialization). The other imports on lines 2-4 suggest this might be unnecessary.

Suggested change
import lanscape

Copilot uses AI. Check for mistakes.
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