Conversation
Co-authored-by: ddol <445312+ddol@users.noreply.github.com> Agent-Logs-Url: https://github.com/banshee-data/velocity.report/sessions/1391681a-ee41-49b9-a6cf-3d8d3604c8e5
Replace the flat capabilities response shape with per-sensor-class maps keyed by a stable sensor name (e.g. 'default'). This allows multiple sensors of the same class (radar, lidar) to coexist in future without breaking the API contract. Wire changes: - SensorStatus / LidarSensorStatus replace LidarCapability - Capabilities.Radar is now map[string]SensorStatus - Capabilities.Lidar is now map[string]LidarSensorStatus - 'State' field renamed to 'Status'; top-level LidarSweep removed - Default fallback in showCapabilities updated - capabilitiesProvider.Capabilities() builds named-object maps - All tests updated for the new shape
Align the Svelte frontend with the new /api/capabilities JSON shape
where radar and lidar are Record<string, SensorStatus> maps keyed by
sensor name, replacing the flat boolean/object fields.
- api.ts: replace LidarCapability with SensorStatus and
LidarSensorStatus; Capabilities uses Record maps
- capabilities.ts: default to { radar: { default: ... }, lidar: {} };
derive lidarEnabled via Object.values().some()
- +layout.svelte: gate LiDAR nav items on the new map shape
- api.test.ts, capabilities.test.ts: update all test data to the new
shape
Co-authored-by: ddol <445312+ddol@users.noreply.github.com> Agent-Logs-Url: https://github.com/banshee-data/velocity.report/sessions/1391681a-ee41-49b9-a6cf-3d8d3604c8e5
🤖 Version Bump AdvisoryWarnings❌ Web Frontend code changed but version unchanged - update 📖 See CHANGELOG.md for detailed guidelines. This is an automated advisory. Review the detected changes and update versions accordingly. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
Redesigns the /api/capabilities contract to support multiple named sensors per sensor class (radar/LiDAR) by switching from a flat single-sensor shape to map[string]T / Record<string, T> keyed by sensor name, and updates the frontend gating + tests accordingly.
Changes:
- Backend: replace flat
Radar bool/LidarCapabilitywithRadar map[string]SensorStatusandLidar map[string]LidarSensorStatus, plus updated defaults/providers/tests. - Frontend: update
Capabilitiestypings and derived stores to operate on named-object maps; update nav gating. - Docs/tests: add a plan doc describing the new format; update Go/TS test fixtures for the new shape.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
internal/api/server.go |
Introduces SensorStatus/LidarSensorStatus and changes Capabilities fields to named maps. |
internal/api/server_admin.go |
Updates the default /api/capabilities fallback response to the new map-based shape. |
cmd/radar/capabilities.go |
Updates the runtime capabilities provider to emit radar.default and optional lidar.default. |
internal/api/capabilities_test.go |
Updates API handler tests for the new JSON shape and map access. |
cmd/radar/capabilities_test.go |
Updates provider tests for map-based capabilities. |
web/src/lib/api.ts |
Updates TypeScript API types to map-based Capabilities with per-sensor status interfaces. |
web/src/lib/api.test.ts |
Updates API client tests to the new capabilities response shape. |
web/src/lib/stores/capabilities.ts |
Updates default capabilities + derived stores (lidarEnabled, lidarState) for map semantics. |
web/src/lib/stores/capabilities.test.ts |
Updates store tests for map-based capabilities and derived logic. |
web/src/routes/+layout.svelte |
Updates LiDAR nav gating to check Object.values($capabilities.lidar). |
docs/plans/api-multi-sensor-capabilities-plan.md |
Adds a plan/spec doc for the multi-sensor capabilities redesign. |
| caps := Capabilities{ | ||
| Radar: true, | ||
| Lidar: LidarCapability{ | ||
| Enabled: false, | ||
| State: "disabled", | ||
| Radar: map[string]SensorStatus{ | ||
| "default": {Enabled: true, Status: "receiving"}, | ||
| }, | ||
| LidarSweep: false, | ||
| Lidar: map[string]LidarSensorStatus{}, | ||
| } |
There was a problem hiding this comment.
This default response now represents LiDAR absence as an empty map (lidar: {}), which is semantically "no LiDAR configured" rather than an explicit disabled sensor. The doc comment above showCapabilities still says "LiDAR as disabled"; consider updating it to reflect the empty-map contract to avoid confusion for API consumers.
| "radar": { | ||
| "default": { | ||
| "enabled": true, | ||
| "status": "receiving", | ||
| "last_reading_at": "2026-03-24T06:45:12Z" | ||
| } | ||
| }, |
There was a problem hiding this comment.
The plan/examples and type definitions include a last_reading_at field, but the implemented Go/TypeScript SensorStatus types in this PR do not include it. Either implement last_reading_at end-to-end or remove it from the plan/spec so the documentation matches the shipped API.
| | `enabled` | `bool` | Sensor channel was activated at startup | | ||
| | `status` | `string` | Runtime state: `disabled`, `starting`, `receiving`, `stale`, `error` | | ||
| | `last_reading_at` | `string \| null` | ISO 8601 timestamp of last data received; `null` = never | | ||
| | `sweep` | `bool` | (lidar only) Sweep/auto-tuner operational | | ||
|
|
||
| ### State machine | ||
|
|
||
| ``` | ||
| disabled → starting → receiving ⇄ stale | ||
| ↘ error | ||
| ``` |
There was a problem hiding this comment.
The plan defines the status state machine/literals around "receiving"/"stale" and does not mention "ready", but the current implementation/provider emits "ready" for LiDAR. Please reconcile the documented status vocabulary/state machine with what the API actually returns (update the plan or adjust the implementation/tests).
Co-authored-by: ddol <445312+ddol@users.noreply.github.com> Agent-Logs-Url: https://github.com/banshee-data/velocity.report/sessions/abefb8ec-c4fd-4cea-a61a-12ddfc230d28
…r lidarState test Co-authored-by: ddol <445312+ddol@users.noreply.github.com> Agent-Logs-Url: https://github.com/banshee-data/velocity.report/sessions/abefb8ec-c4fd-4cea-a61a-12ddfc230d28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: David Dolphin <445312+ddol@users.noreply.github.com>
docs/plans/api-multi-sensor-capabilities-plan.mdwith the agreed format (radar/lidarnamed objects, no_sensorssuffix)💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.