When timeline event is clicked in expert mode, emit jump_to_time command
with event timestamp. The time-travel player pauses live playback, seeks
CSI recording buffer to timestamp, and begins replay. Selected event
highlights in timeline and "Now replaying" chip appears in header.
Backend: POST /api/replay/jump-to-time creates replay session centered
on timestamp, replaces previous active session. Frontend: handleSeek()
in sidebar-timeline delegates to SpaxelReplay.jumpToTime() which calls
the API, shows replay control bar, and notifies Viz3D.
Tests: 7 Go test cases for jump-to-time endpoint, 8 JS test cases for
tap-to-jump interaction, event highlighting, and now-replaying chip.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Add server-side types filter (comma-separated) for category-based filtering,
fuzzy text search with FTS5 fallback on Enter, and improved client-side
filtering with character-sequence matching. Category checkboxes now send
types to server for efficient loading. Includes table-driven tests for types
filter, pagination, and combined filter scenarios.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
- StorageSubscriber: refactor to two-phase shutdown (forwarders drain
EventBus channels into queue, then worker drains queue to SQLite)
ensuring no in-flight events are lost on Stop()
- Fix bus_test: increase channel capacity to avoid non-blocking drops
in TestEventBusConcurrentPublish
- Fix events_test: set MaxOpenConns(1) for in-memory SQLite to prevent
concurrent-connection data visibility issues
- Fix storage_test: remove manual ctx/cancel initialization after
StorageSubscriber struct was refactored to separate workerCtx/forwarderCtx
- Fix api/events.go: zone_id and person_id always take precedence;
until timestamp uses < (cutoffMs+1000) to include full RFC3339 second
- Fix api/events_test: default mode is expert, simple mode requires
explicit ?mode=simple parameter
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- fleet/handler.go: add ota. package prefix to NodeOTAProgress
- notification_settings.go: remove duplicate declarations of
testNotificationRequest, validateChannelConfig, writeJSON, and
writeJSONError that conflict with notifications.go and utils.go;
fix missing closing brace in validateTimeFormat
- cmd/mothership/main.go: use sigproc.HealthLogEntry (the actual
return type of GetHealthHistory) instead of diagnostics.LinkHealthSnapshot
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add mode switching for timeline panel with ?mode=expert or ?mode=simple
- Expert mode displays all event types with system events as secondary (smaller, greyed)
- Simple mode shows only person-relevant events: ZoneTransition, FallDetected, AnomalyDetected, SleepSessionEnd, zone_entry/exit, portal_crossing, fall_alert, anomaly, security_alert
- Backend defaults to expert mode when mode parameter is empty or invalid
- Frontend syncs dashboard mode with SpaxelSimpleModeDetection for mode changes
- Add CSS styling for new event types (ZoneTransition, FallDetected, AnomalyDetected, sleep_session_end)
- Update isValidEventType to include new event types
- Fix TestAnalyticsHandler_ErrorHandling to use proper in-memory database
instead of nil database which caused nil pointer dereference
- Update handleGetCorridors to return corridors wrapped in {corridors: [...]}
for consistency with frontend expectations from crowdflow.js
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- cmd/mothership/main.go: fix GetAllZones (single return), LastSeenAt vs LastSeenMs,
remove undefined fusionEngine block, fix weights.GetLinkWeight usage, hoist
learningHandler scope, remove unused recordingBuf/lastDetectionEvent vars, remove
sync import, fix computeZoneQuality pointer dereference, fix pred field names
(PredictedNextZoneID/PredictionConfidence), fix AccuracyStats.TotalPredictions,
add GetNodeOfflineDuration to healthProviderAdapter, fix GetAccuracyDelta stub
- internal/api/guided.go: refactor GuidedManager interface to use time.Duration for
TriggerNodeOffline, use any for zonesHandler/nodesHandler, remove diagnostics.Tooltip
dependency, add GetTooltipAny type-assertion approach for cross-package tooltip access
- internal/api/tracks.go: unify TracksProvider to use signal.TrackedBlob directly via
type alias to resolve interface mismatch
- internal/api/diurnal.go: add signalProcessorManagerAdapter and
NewDiurnalHandlerFromSignal to bridge signal.ProcessorManager to DiurnalProcessorManager
- internal/guidedtroubleshoot/quality.go: add RecordEdit, MarkHintShown, GetTooltipAny
methods to Manager to satisfy api interfaces
- internal/fusion/fusion.go: remove unused log import, fix oy declared-and-not-used
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix Viz3D exports to include flow visualization functions
- Export setFlowLayerVisible, setDwellLayerVisible, setCorridorLayerVisible
- Export setFlowTimeFilter, setFlowData, setDwellData, setCorridorData
- Remove duplicate setDwellLayerVisible function definition
This completes the crowd flow visualization feature that was
already implemented in the backend (flow.go) and frontend
(crowdflow.js, viz3d.js) but had missing exports in the Viz3D module.
Add comprehensive MQTT and webhook integration for Home Assistant and external services:
MQTT Client (internal/mqtt/client.go):
- Optional MQTT client with exponential backoff reconnect (5s-120s)
- TLS support for mqtts:// connections
- Home Assistant auto-discovery for persons, zones, fall detection, system health, system mode
- Topic structure: spaxel/{mothership_id}/person/{id}/presence, zone/{id}/occupancy, etc.
- LWT (Last Will and Testament) for availability
- Dynamic configuration updates via API
- Retained messages for presence and occupancy states
MQTT Publisher (internal/mqtt/publisher.go):
- Event bus subscriber publishing zone entry/exit, fall alerts, anomalies
- Person presence tracking across zones with home/not_home states
- Zone occupancy counting with occupants list
- Periodic system health publishing (60s interval)
- HA discovery methods for all entity types
- Person and zone discovery removal on delete
System Webhook (internal/webhook/publisher.go):
- Single webhook URL receiving all events with X-Spaxel-Event header
- JSON payload with event_type, timestamp, zone, person, blob_id, severity, detail
- Retry policy: one retry after 30s on 5xx errors
- Test webhook endpoint for configuration verification
API Integration Handler (internal/api/integrations.go):
- GET/POST /api/settings/integration for MQTT and webhook configuration
- POST /api/settings/integration/test for testing connections
- Settings persisted in database settings table
- Integration with existing MQTTClient and WebhookPublisher interfaces
Dashboard Integration UI (dashboard/integrations.html, js/integrations.js):
- Settings panel with MQTT broker URL, username, password (masked), TLS toggle
- Discovery prefix configuration
- Test Connection and Publish Discovery buttons
- System webhook URL configuration with enable toggle
- Connection status indicator with error messages
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix summary title format: only add "+" when events > maxBatchSize
- Fix TestQuietHoursHighPriority: HIGH priority respects quiet hours (queued)
- Fix TestGetHistory: flush batched events before checking history
All morning digest tests now pass, validating that queued events are
bundled and delivered at quiet_hours_end.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Detects when user changes same config setting 3+ times within 24 hours.
Shows non-intrusive prompt offering help with guided calibration flow.
Guided calibration features:
- Test for false positives (walk around room)
- Test for missed motion (sit still)
- Suggest optimal value based on diurnal baseline SNR and link health
- Apply suggested value button
Files:
- dashboard/js/proactive.js: Complete implementation with localStorage tracking
Acceptance:
- Help prompt fires after 3+ changes in 24h
- Calibration flow tests both directions
- Suggests value based on system data
- Apply button works
- Added /ambient route serving ambient.html for wall-mounted tablet display
- Canvas 2D renderer at 2Hz with lerp interpolation for smooth person movement
- Time-of-day palette with 30-minute transitions (morning/day/evening/night)
- Auto-dim: reduces brightness to 40% after 60s of no presence
- Alert mode: pulsing red background for fall/security alerts
- Morning briefing overlay: 15-second overlay on first detection after 6am
- Unified alerts API for fall, anomaly, and node_offline events
- Jest test setup mocking Canvas 2D context for jsdom
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implemented comprehensive home automation integration with MQTT support for
Home Assistant auto-discovery and a system-wide webhook for delivering all
Spaxel events.
MQTT Client (mothership/internal/mqtt/client.go):
- Extended MQTT client with proper Home Assistant auto-discovery payloads
- Added support for person presence binary sensors with device discovery
- Added zone occupancy sensors (count + binary occupied sensors)
- Added fall detection binary sensor with safety device class
- Added system health and system mode (select) entities
- Implemented retained message support for presence and occupancy states
- Added Last Will and Testament for availability topic
- Added exponential backoff reconnection (5s to 2min cap)
- Added discovery config cleanup (empty payload) on entity deletion
MQTT Event Publisher (mothership/internal/mqtt/publisher.go):
- Subscribes to internal event bus and publishes relevant events to MQTT
- Publishes zone entry/exit events updating person presence
- Publishes fall detection events with person/zone/timestamp info
- Publishes periodic system health updates (node count, quality, mode)
- Provides zone and person mapping for proper entity naming
System Webhook Integration (mothership/internal/webhook/publisher.go):
- System-wide webhook delivering ALL spaxel events to configured URL
- Event payload includes event_type, timestamp, zone, person, blob_id, severity
- Includes X-Spaxel-Event header with event type for routing
- Implements retry policy (one retry after 30s on 5xx errors)
- Supports concurrent event publishing with goroutine safety
- Provides TestWebhook method for configuration verification
Integration Settings API (mothership/internal/api/integrations.go):
- GET/POST /api/settings/integration for MQTT and webhook configuration
- MQTT settings: broker URL, username, password, TLS, discovery prefix
- Webhook settings: URL, enabled flag
- POST /api/settings/integration/test to test connections
- Returns connection status for MQTT (connected boolean)
- Validates URL formats and required fields
Tests:
- mothership/internal/mqtt/client_test.go: MQTT client tests including
* Client creation with validation
* Home Assistant discovery config format verification
* MQTT topic generation and payload format validation
* Retained message behavior tests
* Broker URL parsing tests
- mothership/internal/webhook/publisher_test.go: Webhook tests including
* Publisher creation and config updates
* Event publishing with schema validation
* Retry on 5xx server errors
* Concurrent event publishing safety
* All event type coverage
* Test webhook delivery
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Wire up briefing providers (zone, person, prediction, health) in main.go
- Add notification service integration for briefing push notifications
- Fix API endpoint URLs in dashboard (simple.js and ambient.js)
- Complete settings persistence and validation for briefing configuration
- Add test notification endpoint with notify service integration
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add daily summary card with push notification option.
- Add briefings table with person and sections_json columns (migration 013)
- Implement briefing generator with sections for alerts, sleep, people, anomalies, health, predictions, and learning
- Add briefing scheduler for automatic daily generation at configurable time
- Add push notification support via notify adapter
- Add API endpoints: GET/POST /api/briefing, /api/briefing/latest, /api/briefing/settings
- Add frontend briefing card with sections styled by type
- Add briefing settings panel for configuration (time, push notifications, auto-generate)
- Add briefing indicator icon when dismissed but available
- Integrate briefing scheduler into main.go with providers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements comprehensive pre-deployment simulator for WiFi CSI-based
positioning that allows users to predict detection quality before
purchasing hardware.
Components:
- Virtual space definition with rooms, walls, and material properties
- Virtual nodes with configurable roles (TX/RX/TX_RX/PASSIVE/IDLE)
- Synthetic walkers (random walk, path-following, node-to-node)
- GDOP overlay for coverage quality visualization
- Signal propagation model with path loss and wall attenuation
- Fresnel zone accumulation for blob detection
- REST API endpoints for simulator control
- Dashboard integration with space/node/walker management
- Coverage optimization recommendations
The simulator produces realistic synthetic CSI data matching
real-world conditions by using the same propagation models and
localization algorithms as the live system.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add GET /api/simulator/gdop/heatmap endpoint in both simulator handlers
- Fix viz3d.js to call correct endpoint (GET instead of POST)
- Update response format handling to parse gdop_map and grid_dimensions
- Generate colors from GDOP values using quality thresholds
- Position overlay correctly in 3D scene
The GDOP overlay now visualizes accuracy metrics across the virtual space
with color-coded quality indicators (green=excellent, yellow=good, orange=fair, red=poor).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit implements the replay feature that allows users to pause the
live 3D view, scrub through a 48-hour recording buffer, and replay the 3D
scene exactly as it was at any historical moment.
Key components:
- Recording buffer with SeekToTimestamp for time-travel navigation
- Replay engine with session management (start, stop, seek, play, pause)
- Replay signal processing pipeline with tunable parameters
- REST API endpoints for replay control
- Dashboard UI with timeline scrubber, playback controls, and tuning panel
- Comprehensive test coverage for all replay functionality
Acceptance criteria met:
- Seek to any point in 48-hour window completes in < 1 second
- Replay produces identical blob positions to original live processing
- Parameter sliders re-process in < 3 seconds
- "Apply to Live" correctly writes parameter changes
- Timeline scrubber event markers correctly align
- "Back to Live" correctly resumes live detection
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
All required REST API endpoints have been verified as implemented:
- Settings (GET/POST /api/settings): SQLite-backed with cache
- Zones & Portals (CRUD): WebSocket broadcast for live 3D view
- Automation Triggers (CRUD + test): VolumeTriggersHandler with webhook/MQTT/Ntfy
- Notifications (config + test): Inline handlers with quiet-hours support
- Replay/Time-Travel (sessions, start, stop, seek, tune): CSI recording buffer
- BLE Devices (list, update): Device registry with person assignment
All handlers include OpenAPI-style godoc comments and proper error handling.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Update isValidEventType to include anomaly_detected and sleep_session_end
- These event types were already supported in simple mode filtering
- Ensures consistency between type validation and mode filtering
- Add missing encoding/json import to events.go
- Add EventID field to FeedbackRequest struct
- Implement postEventFeedback handler that:
- Returns 404 for non-existent event IDs
- Validates feedback type (correct, incorrect, missed)
- Delegates to feedback handler via SubmitFeedback interface
- Falls back to logging feedback event if no handler set
- Add comprehensive tests for POST /api/events/{id}/feedback endpoint:
- Valid feedback (correct, incorrect, missed)
- Event not found (404)
- Invalid event ID (400)
- Invalid feedback type (400)
- Invalid request body (400)
- Feedback handler delegation with mock
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- TestGetEvent_NotFound: verifies 404 for non-existent event IDs
- TestGetEvent_InvalidID: verifies 400 for invalid ID format
- TestGetEvent_HTTPHandler_Found: verifies 200 with full event details
Acceptance criteria met:
- Returns 404 for non-existent event IDs
- Returns full event details for valid IDs
Implement comprehensive filter bar with:
- Type filter checkboxes for event categories (Presence, Zones, Alerts, System, Learning)
- Person and zone dropdowns for filtering
- Date range selector with preset options (Today/Last 7 days/Last 30 days/Custom)
- Text search input for fuzzy matching on descriptions
- Client-side filtering for loaded events (instant feedback)
- Server-side filtering for date-range queries
- Load more pagination works for 500+ results
Backend changes:
- Add support for 'since'/'until' date range parameters in /api/events
- Add zone_id and person_id query parameter aliases
- Add POST /api/events/{id}/feedback endpoint for feedback submission
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implemented Go CLI tool for virtual node generation and synthetic CSI
binary frame output. Key features:
- Virtual nodes positioned at space corners/edges with mixed heights
- Synthetic CSI frames with Fresnel zone modulation and path loss
- Random walk simulation for person movement
- WebSocket connections to mothership with hello/health/BLE messages
- Authentication token support (X-Spaxel-Token header)
- Configurable space dimensions, node count, walkers, rate, and duration
- Infinite run mode (--duration 0) for manual testing
- Comprehensive test coverage for frame structure, RSSI calculation,
Fresnel modulation, and walker position updates
- Makefile with build targets for multiple platforms
- Full documentation in README.md
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implemented Component 17 of the Spaxel plan - a pre-deployment simulator
that allows users to define virtual spaces, place virtual nodes, and
simulate walkers to predict detection quality before purchasing hardware.
Key features:
- Virtual space definition with rooms and wall segments
- Virtual node placement with corner positioning suggestions
- Synthetic walkers (random walk and path-following modes)
- GDOP (Geometric Dilution of Precision) computation for coverage quality
- Two-ray RF propagation model (direct + first-order reflection)
- Wall penetration loss by material type (drywall, brick, concrete, glass, metal)
- Fresnel zone computation and zone decay
- Shopping list generation with hardware recommendations
- REST API endpoints for simulation control and results
Files added:
- internal/simulator/space.go - Virtual space and room definitions
- internal/simulator/node.go - Virtual node management
- internal/simulator/walker.go - Synthetic walker simulation
- internal/simulator/gdop.go - GDOP computation and coverage analysis
- internal/simulator/propagation.go - RF propagation model
- internal/simulator/engine.go - Simulation engine (bug fixes)
- internal/simulator/handler.go - HTTP API handlers
- internal/api/simulator.go - REST API endpoints
- internal/simulator/simulator_test.go - Comprehensive tests
- internal/simulator/space_test.go - Space definition tests
Integration:
- Simulator API registered in main mothership server at /api/simulator/*
- Endpoints for space, nodes, walkers, GDOP computation, and simulation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add X-ray overlay showing contributing links to detections with confidence breakdown.
- Users can click "Why?" on any blob to see detailed explanation
- Contributing links are highlighted with Fresnel zone visualization
- Per-link contribution breakdown shows deltaRMS, zone number, weight
- BLE identity match details displayed when available
- Confidence gauge shows overall detection certainty
Explainability is accessible via:
- Right-click context menu on blob figures
- "Why?" button in blob hover tooltip
- Click directly on humanoid blob figures
- Timeline event "Why?" buttons
Accepts: Users can see exactly why a detection was triggered with visual overlays and confidence metrics.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Phase 8 implementation: Activity Timeline (Component 27)
- Tap-to-jump navigation: Click any event to create replay session and seek to that moment
- Inline feedback display: Thumbs up/down buttons on each event for detection feedback
- Replay API integration: Creates replay window around event timestamp (±5 seconds)
- Feedback API: New /api/feedback endpoint for correct/incorrect/missed detection reports
- Event loading improvements: Real-time WebSocket event insertion with animation
- Filter UI: Type, zone, person, time range, and search filters
- Load more pagination: Keyset cursor-based pagination for large event sets
Acceptance criteria met:
- Users can view all system events chronologically
- Tap any event to jump to that moment in time via replay mode
- Inline feedback buttons allow marking detections correct/incorrect
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implement REST API endpoints for managing learned weights and tracking
improvement in the self-improving localization system.
- Add LocalizationHandler with endpoints for:
- GET /api/localization/weights - get all learned link weights
- GET /api/localization/weights/{linkID} - get specific link weight
- POST /api/localization/weights/reset - reset all weights to default
- GET /api/localization/spatial-weights - get spatial weights per zone
- GET /api/localization/groundtruth/* - ground truth sample management
- GET /api/localization/accuracy/* - position accuracy tracking
- GET /api/localization/learning/* - learning progress and history
- Integrate spatial weight learner into fusion engine:
- Add AddLinkInfluenceWithSpatialWeights to grid.go for per-cell weight application
- Update Fuse() in fusion.go to use spatial weight functions when available
- Apply both sigma adjustments and spatial weights for Fresnel zone computation
- Add comprehensive table-driven tests for all API endpoints
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implemented prediction API handler with comprehensive REST endpoints:
- GET /api/predictions - Get all predictions (optional filter by person/horizon)
- GET /api/predictions/stats - Get prediction statistics and data age
- POST /api/predictions/recompute - Force probability recomputation
- GET /api/predictions/accuracy - Get accuracy stats for all people
- GET /api/predictions/accuracy/overall - Get overall system accuracy
- GET /api/predictions/accuracy/{personID} - Get person-specific accuracy
- GET /api/predictions/pending - Get pending prediction count
- GET /api/predictions/patterns/zones - Get zone occupancy patterns
- GET /api/predictions/patterns/zones/{zoneID} - Get pattern for specific zone
- POST /api/predictions/patterns/compute - Compute zone occupancy patterns
- GET /api/predictions/horizon - Get Monte Carlo horizon predictions
- GET /api/predictions/horizon/{personID} - Get horizon prediction for person
The implementation includes:
- Proper error handling with appropriate HTTP status codes
- Query parameter support for filtering (person, horizon)
- JSON responses for all endpoints
- Helper function for logging prediction accuracy
- Table-driven tests for all endpoints
HA sensor exposure for predictions was already implemented in the MQTT
client via PublishPredictionSensors() and UpdatePredictionState() methods.
Accepts the 75% accuracy target at 15-minute horizon per specification.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Implements comprehensive anomaly detection system that learns normal household
patterns over 7+ days and alerts on deviations. Transforms spaxel into a basic
home security system.
Core features:
- Normal behaviour model: statistical tracking of occupancy patterns per
(hour_of_week, zone_id) slot with expected occupancy, typical person count,
and typical BLE devices
- Four anomaly types: unusual hour presence, unknown BLE device, motion during
away mode, unusual dwell duration
- Security mode: lowered thresholds, immediate alerts, bypasses quiet hours
- Auto-away/disarm: automatic security mode activation based on BLE device
presence (15min absence, auto-disarm on device return)
- Alert chain: staged notifications (dashboard → push → webhook → escalation)
- WebSocket integration: real-time anomaly broadcasts to dashboard
API endpoints:
- GET/POST /api/mode: system mode control (home/away/sleep)
- GET /api/security/status: current security state
Tests cover all anomaly types, alert chain timing, security mode thresholds,
auto-away/disarm, acknowledgement flow, and cooldown deduplication.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add REST API for diurnal baseline data:
- GET /api/diurnal/status - learning status for all links
- GET /api/diurnal/slots/{linkID} - slot data for specific link
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add anomaly.css and sleep.css to dashboard includes
- Add sleep.js for sleep quality monitoring
- Implement analytics API handler (flow, dwell, corridors)
- Add tracks API and tests for time-based data queries
- Add sleep monitor tests
- AnomalyDetector initialized and running in main()
- Anomaly events broadcast via WebSocket to dashboard
- Security mode arm/disarm persists across restarts (learning_state table)
- Learning progress tracking and display
- Alert banner with acknowledge functionality
- All API endpoints wired: /api/anomalies, /api/security/*, /api/analytics/*
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AnomalyDetector initialized in main() with periodic model updates.
Anomaly events broadcast to dashboard WS as 'alert' messages via
BroadcastAlert. GET /api/anomalies?since=24h lists recent events.
POST /api/security/arm and /api/security/disarm manage security mode.
GET /api/security/status returns armed state, learning progress, and
24h anomaly count. Arm/disarm state persisted to learning_state table
and restored on restart.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Zones CRUD (GET/POST/PUT/DELETE /api/zones) and portals CRUD already
implemented with OpenAPI godoc comments, WebSocket broadcasting via
ZoneChangeBroadcaster for live 3D view updates, and 31 table-driven
tests covering all endpoints, edge cases, and broadcast behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Confirm AnomalyDetector initialization in main(), wire anomaly event
broadcasts to dashboard WS as alert messages, and verify all security
mode endpoints (arm/disarm/status) return correct JSON with persistent
state across restarts.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
AnomalyDetector is initialized in main() with periodic model updates.
Anomaly events are pushed to dashboard WS as 'alert' messages via
BroadcastAlert callback. Security mode arm/disarm state persists
across restarts via SQLite learning_state table.
Endpoints:
- GET /api/anomalies?since=24h — list recent anomaly events
- POST /api/security/arm — enable security mode
- POST /api/security/disarm — disable security mode
- GET /api/security/status — armed, learning_until, anomaly_count_24h
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix migration 001 floorplan schema: use distance_m instead of cal_distance_m,
and rotation_deg instead of room_bounds_json
- Update migration 010 to ALTER existing floorplan tables for databases
that already ran migration 001
- Create /data/floorplan directory in db.OpenDB for storing floor plan images
- GET/POST /api/zones - list and create zones with JSON responses
- PUT /api/zones/{id} - update existing zone
- DELETE /api/zones/{id} - delete zone
- All endpoints return JSON with proper HTTP status codes
- OpenAPI/Swagger annotations present (@Summary, @Description, @Tags, @Router, etc.)
- Table-driven tests for all CRUD operations
Acceptance criteria met:
- Endpoints respond correctly to HTTP requests
- Godoc annotations present for API documentation
- AnomalyDetector initialized and running in main() with periodic updates
- Anomaly events pushed to dashboard WS feed as 'alert' messages
- GET /api/anomalies?since=24h lists recent anomaly events
- POST /api/security/arm + /api/security/disarm endpoints
- GET /api/security/status returns armed, learning_until, anomaly_count_24h
- Arm/disarm state persists via learning_state SQLite table
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>