Skip to content

Add serial configuration UI and LiDAR network configuration design#290

Open
Copilot wants to merge 8 commits intomainfrom
copilot/update-serial-configuration-ui
Open

Add serial configuration UI and LiDAR network configuration design#290
Copilot wants to merge 8 commits intomainfrom
copilot/update-serial-configuration-ui

Conversation

Copy link
Contributor

Copilot AI commented Feb 20, 2026

Replaces the stale copilot/add-serial-configuration-ui branch with a clean reimplementation against current main. Adds DB-driven serial port configuration with hot-reload, a settings UI, and a design document for extending the same pattern to LiDAR network interfaces.

Serial port configuration backend

  • DB layer (internal/db/serial_config.go): CRUD for radar_serial_config table with migration 000029. Schema uses LIKE 'ops243-%' CHECK constraint for sensor model extensibility.
  • serialmux.PortOptions (internal/serialmux/options.go): Typed serial parameters with Normalise(), Equal(), SerialMode(). Validates baud rates 110–256000. Defaults: 19200/8N1.
  • SerialPortManager (internal/api/serial_reload.go): Hot-reload wrapper implementing SerialMuxInterface. Maintains persistent event fanout across reloads via RWMutex-guarded delegation. Background Monitor() polls DB for config changes.
  • API handlers (internal/api/serial_config.go, serial_testing.go): REST endpoints at /api/serial/{configs,models,test,devices,reload}. Test endpoint uses PortOptions.Normalise()/SerialMode() and warns when probing an active port.
  • Sensor model registry (internal/api/sensor_models.go): Static catalogue of supported radar models with default serial parameters.

Web frontend

  • Settings page (web/src/routes/(constrained)/settings/serial/+page.svelte): Config CRUD with add/edit dialogs, port test with live feedback, device enumeration.
  • API client (web/src/lib/api.ts): Typed functions for all serial and HINT sweep endpoints.

Test coverage

  • serialmux/options_test.go: 27 tests covering Normalise/Equal/SerialMode — 0% → 100%
  • db/serial_config_test.go: Error paths, not-found, disabled flag — 65% → 93%
  • api/serial_config_test.go: Method validation, field validation, DB errors — 40% → 92%
  • api/serial_reload_test.go: ReloadConfig paths, Monitor retry/cancel, event fanout — 34% → 96%
  • api/server.go serial routes: SetSerialManager, currentSerialMux fallback — 21% → 90%
  • web/src/lib/api.test.ts: 29 new tests for serial + HINT endpoints — functions 81% → 100%

LiDAR network configuration design

  • docs/lidar/architecture/lidar-network-configuration.md: Extends the SerialPortManager hot-reload pattern to LiDAR UDP listener binding. Covers interface enumeration, gateway/address discovery, Hesai traffic probing (ports 2368–2370), and live rebind without process restart. Defines LiDARNetworkManager, DB schema (lidar_network_config), API surface, and settings UI wireframe.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@github-actions
Copy link

github-actions bot commented Feb 20, 2026

🤖 Version Bump Advisory

Warnings

⚠️ Database migration detected

  • Files: internal/db/migrations/000029_create_radar_serial_config.up.sql
  • Review for breaking changes (MAJOR) vs additive changes (MINOR)
    Radar version unchanged - consider bumping version in Makefile
    Web Frontend code changed but version unchanged - update web/package.json

📖 See CHANGELOG.md for detailed guidelines.

This is an automated advisory. Review the detected changes and update versions accordingly.

@ddol ddol marked this pull request as ready for review February 20, 2026 07:14
Copilot AI review requested due to automatic review settings February 20, 2026 07:14
Copilot AI changed the title [WIP] Update branch to resolve conflicts and apply new conventions Re-implement serial configuration UI on current main Feb 20, 2026
Copilot AI requested a review from ddol February 20, 2026 07:19
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 implements a comprehensive serial configuration UI and API for velocity.report, enabling database-driven serial port management with hot-reload capability. The changes introduce a new configuration layer that allows users to manage multiple serial port configurations for radar sensors through a web interface, test connections, and reload configurations without restarting the server.

Changes:

  • Added complete serial configuration UI in Svelte with CRUD operations, connection testing, and sensor model selection
  • Implemented SerialPortManager with hot-reload support and persistent event fanout across mux swaps
  • Added database schema and migration for radar_serial_config table with sensor model constraints
  • Created API endpoints for serial configuration, device discovery, testing, and reloading

Reviewed changes

Copilot reviewed 16 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web/src/routes/(constrained)/settings/serial/+page.svelte New Svelte page for serial configuration UI with create/edit/delete/test functionality
web/src/routes/(constrained)/settings/+page.svelte Added navigation link to serial configuration page using $app/paths resolve()
web/src/lib/api.ts Added TypeScript types and API client functions for serial configuration endpoints
internal/serialmux/options.go New PortOptions type with Normalise(), Equal(), and SerialMode() methods (British English)
internal/db/serial_config.go Database CRUD operations for serial configurations
internal/db/serial_config_test.go Comprehensive test coverage for DB layer including constraints
internal/db/schema.sql Added radar_serial_config table with triggers and indexes
internal/db/migrations/000029_create_radar_serial_config.up.sql Migration creating serial config table with default HAT configuration
internal/db/migrations/000029_create_radar_serial_config.down.sql Rollback migration for serial config table
internal/api/sensor_models.go Sensor model registry with OPS243-A and OPS243-C definitions
internal/api/serial_config.go HTTP handlers for serial config CRUD operations with validation
internal/api/serial_config_test.go API endpoint tests covering create/read/update/delete operations
internal/api/serial_testing.go Serial port testing endpoint with auto-baud detection and device discovery
internal/api/serial_reload.go SerialPortManager with hot-reload, event fanout, and thread-safe mux swapping
internal/api/serial_reload_test.go Tests for SerialPortManager subscription persistence and delegation
internal/api/server.go Registered serial API routes and added SetSerialManager() method
.gitignore Added web/build/ to ignore list

Copilot AI changed the title Re-implement serial configuration UI on current main Address PR review comments and fix Jest coverage threshold Feb 20, 2026
@codecov
Copy link

codecov bot commented Feb 20, 2026

Copilot AI changed the title Address PR review comments and fix Jest coverage threshold Add serial configuration UI with hot-reload support and comprehensive test coverage Feb 20, 2026
@ddol ddol changed the title Add serial configuration UI with hot-reload support and comprehensive test coverage [go] serial configuration ui Feb 20, 2026
Copilot AI and others added 8 commits February 20, 2026 00:48
…s, reload manager, and tests

Co-authored-by: ddol <445312+ddol@users.noreply.github.com>
…th CRUD and test dialogs

Co-authored-by: ddol <445312+ddol@users.noreply.github.com>
Co-authored-by: ddol <445312+ddol@users.noreply.github.com>
- Refactor testSerialPort to use serialmux.PortOptions.Normalise/SerialMode
- Add active-port warning when testing a port in use by SerialPortManager
- Relax CHECK constraint to LIKE 'ops243-%' for future extensibility
- Add tests for serial config, HINT sweep, and sweep explanation API functions

Co-authored-by: ddol <445312+ddol@users.noreply.github.com>
…ve 90%+ coverage

Files covered:
- serialmux/options.go: 0% → 100%
- db/serial_config.go: 65.62% → 93.2%
- api/serial_config.go: 40.11% → 92.3%
- api/serial_reload.go: 34.32% → 96.2%
- api/server.go: 21.42% → 90.2% (serial portions)

Co-authored-by: ddol <445312+ddol@users.noreply.github.com>
@ddol ddol force-pushed the copilot/update-serial-configuration-ui branch from c22c77d to e216309 Compare February 20, 2026 08:48
Copilot AI changed the title [go] serial configuration ui Add serial configuration UI and LiDAR network configuration design Feb 21, 2026
@ddol ddol force-pushed the copilot/update-serial-configuration-ui branch from b2d09fc to e216309 Compare February 21, 2026 04:48
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.

3 participants