Commit graph

751 commits

Author SHA1 Message Date
Argo Workflows CI
86ea9356e6 ci: auto-bump version to 0.1.330 2026-05-06 03:11:54 +00:00
jedarden
714c51acf6 simulator: fix GDOP overlay and shopping list JSON output
- Fix infinity handling in accuracy_map for GDOP overlay JSON output
- Convert average_gdop infinity to string for JSON compatibility
- Use 9999.0 sentinel value for infinity in accuracy_map array

This fixes the 'unsupported value: +Inf' error when using --gdop-overlay flag.
Both --gdop-overlay and --shopping-list now output valid JSON.
2026-05-05 23:11:26 -04:00
Argo Workflows CI
f10a517b11 ci: auto-bump version to 0.1.329 2026-05-06 02:44:04 +00:00
jedarden
a2abacb48d simulator: CSI simulator with synthetic walkers and propagation model
- Implements full CSI simulator CLI at cmd/sim/
- Synthetic CSI frame generation using two-ray propagation model (direct + first-order reflection)
- Walker types: random-walk, path-following, node-to-node traversal
- User-defined paths via JSON file (--path-file)
- Wall attenuation with material properties (drywall, brick, concrete, glass, metal)
- BLE advertisement simulation (--ble flag)
- Ground truth CSV output with walker positions and per-link deltaRMS
- Scenario support: fall detection, OTA, bag-on-couch
- Blob count verification via --verify flag
- Seed-based reproducibility for deterministic tests
- Full test coverage (33 tests passing)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 22:43:32 -04:00
Argo Workflows CI
ade0b10ac9 ci: auto-bump version to 0.1.328 2026-05-06 02:17:22 +00:00
jedarden
5ad6730524 fix(simulator): fix TestTwoRayModel wall reflection test case
The test was using a wall at x=10 from y=0 to y=5, which still creates
a valid reflection geometry for TX at (1,1) and RX at (3,3). The
reflection point calculation correctly finds that the reflected ray
would intersect the wall at y≈2.125, which is within the wall's bounds.

Fixed the test to use a wall that truly cannot create a valid reflection:
vertical wall at x=2 from y=10 to y=15. The reflection of TX (1,1) across
x=2 would be at (3,1). The line from (3,1) to RX (3,3) is vertical at x=3,
which never intersects the wall at x=2.

The simulator implements:
- Synthetic walkers (random walk, path-following, node-to-node)
- CSI generation with two-ray propagation model
- Wall attenuation (drywall: 3dB, brick/concrete: 10dB, glass: 2dB, metal: 20dB)
- Fresnel zone-based deltaRMS computation
- BLE simulation and CSV ground truth output

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 22:16:49 -04:00
Argo Workflows CI
26a27b748c ci: auto-bump version to 0.1.327 2026-05-06 01:55:07 +00:00
jedarden
a0ed41e899 fix(simulator): remove unused variables from propagation engine
Cleaned up unused variables in ray-based propagation model:
- Removed unused directPathLoss in computeReflectionPower
- Removed unused reflectionZ in floor/ceiling reflection functions

The propagation engine implements:
- Direct path computation (TX -> walker -> RX)
- First-order reflections (walls, floor, ceiling)
- Path loss model using log-distance
- Wall attenuation based on material type
- Fresnel zone modulation

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 21:54:33 -04:00
Argo Workflows CI
58f85b48b7 ci: auto-bump version to 0.1.326 2026-05-06 01:41:06 +00:00
jedarden
80d070d0d3 feat(placement): add space key to place virtual nodes at camera target
- Press space bar to place a new virtual node at camera target position
- Node is placed at intersection of camera ray with ground plane
- Position is clamped to room bounds
- Height defaults to 80% of room height or 1.5m minimum
- Virtual nodes are rendered as ghost wireframe nodes (via viz3d.js)
- Links to/from virtual nodes are dashed (via viz3d.js)

This completes the 'space + virtual node placement' feature for the
simulator, reusing the 3D editor with ghost wireframe nodes and dashed links.
2026-05-05 21:40:48 -04:00
Argo Workflows CI
425236c746 ci: auto-bump version to 0.1.325 2026-05-06 01:24:13 +00:00
jedarden
c46dfa21fc feat(simulator): implement 3D editor reuse with ghost wireframe nodes and dashed links
- Refactored simulate.js to properly use existing HTML structure from simulator.html
- Added ghost wireframe node visualization using THREE.OctahedronGeometry with wireframe material
- Implemented dashed links between virtual nodes using THREE.LineDashedMaterial
- Added CSS for selected state highlighting and proper panel positioning
- Reused TransformControls from 3D editor for node placement
- Virtual nodes appear as teal-colored wireframe octahedrons
- Links between virtual nodes render as teal dashed lines
- GDOP overlay updates in real-time as nodes are dragged

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 21:23:33 -04:00
Argo Workflows CI
1e03f17e24 ci: auto-bump version to 0.1.324 2026-05-06 00:27:41 +00:00
jedarden
d185817a0b feat(simulator): add viz3d.js dependency to simulator.html
The simulator page now includes the viz3d.js 3D visualization layer
which provides the scene management API needed by the simulator.
This ensures the simulator 3D scene is properly initialized.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 20:27:22 -04:00
jedarden
bf0f5b4b54 test(simulator): fix tests to match current API
Component 17 pre-deployment simulator is fully implemented. This commit
updates the test file to match the current API after refactoring:

- Changed from PropagationModel.PathLoss() to PhysicsModel.PathLossdB()
- Changed from PropagationModel.WallLoss() to PhysicsModel.WallAttenuation()
- Changed from PropagationModel.ReceivedPower() to PropagationModel.ExpectedRSSI()
- Changed from PropagationModel.PhaseAt() to PhaseAtSubcarrier()
- Changed from PropagationModel.DeltaRMS() to PhysicsModel.DeltaRMS()
- Removed non-existent IsInFirstFresnelZone() - use FresnelZoneNumber() instead
- Removed non-existent SimulateCSIData(), GenerateCSIFrame(), GenerateCSIFrames(), ComputeLinkMetrics()

All simulator tests now pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 20:27:22 -04:00
Argo Workflows CI
10956f8c44 ci: auto-bump version to 0.1.323 2026-05-05 22:34:31 +00:00
jedarden
f18916d3a9 feat(replay): implement time-travel debugging with parameter tuning
- Add 'Pause Live' button that freezes 3D view and reveals timeline scrubber
- Implement scrubbing backward/forward through recorded history (1×, 2×, 5×)
- 3D scene renders blobs exactly as detected at scrubbed time, including trails
- Add parameter tuning overlay with sliders for detection parameters:
  - Detection threshold (deltaRMS)
  - Baseline time constant (tau)
  - Fresnel weight decay rate
  - Subcarrier selection count (NBVI)
  - Breathing sensitivity
- Adjusting slider re-runs pipeline on recorded CSI with new parameters
- Add 'Apply to Live' button that writes tuned parameters to running pipeline

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 18:33:37 -04:00
Argo Workflows CI
9515e06110 ci: auto-bump version to 0.1.322 2026-05-05 21:38:55 +00:00
jedarden
179f9e6ea4 feat(api): implement GET /api/zones/:id/history occupancy history endpoint
- Add hourly zone history snapshot recording that runs every hour
- Returns [{timestamp, count, people:[]}] in hourly buckets
- Supports period query parameter: 24h (default), 7d, 30d
- Zone history is persisted in zone_history SQLite table
- Initial snapshot recorded on startup for the current hour
2026-05-05 17:38:22 -04:00
Argo Workflows CI
b69431d657 ci: auto-bump version to 0.1.321 2026-05-05 21:27:52 +00:00
jedarden
911c1ff154 test(api/zones): add comprehensive test for GET /api/zones/:id/history
Add TestGetZoneHistoryWithData which verifies:
- Response format with timestamp, count, and people array
- Period query parameter (24h, 7d, 30d)
- Correct number of hourly buckets returned
- People array parsing from JSON

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 17:27:32 -04:00
Argo Workflows CI
8a2681b26a ci: auto-bump version to 0.1.320 2026-05-05 21:19:55 +00:00
jedarden
9f9df2f70c zones: implement GET /api/zones/:id/history endpoint
Implement hourly occupancy history endpoint that returns zone_history
records from the database. The endpoint returns hourly snapshots with
count and people list, supporting period query parameter (24h, 7d, 30d).

Changes:
- Modified GetZoneHistory to query zone_history table instead of
  computing from crossing_events
- Added encoding/json import to parse people JSON field
- Split database schema creation into manager_migrate.go for editability
- Split zone history snapshot logic into manager_history.go
- Updated tests to insert zone_history data instead of crossing_events

The zone_history table stores pre-aggregated hourly snapshots written
by RecordZoneHistorySnapshot, which should be called periodically.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 17:19:35 -04:00
Argo Workflows CI
408f3b6a78 ci: auto-bump version to 0.1.319 2026-05-05 19:30:29 +00:00
jedarden
71c105c85d api: complete GET /api/portals/:id/crossings endpoint
Add crossing_events table (migration 16) for portal crossing log with
cursor pagination support. The endpoint returns [{timestamp, direction,
person, blob_id, from_zone, to_zone}] with ?limit and ?before cursor
pagination parameters.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 15:30:08 -04:00
Argo Workflows CI
d032ce8199 ci: auto-bump version to 0.1.318 2026-05-05 18:31:54 +00:00
jedarden
62133dff5b api: complete GET /api/portals/:id/crossings endpoint
- Add ID field to CrossingEvent struct for database row ID
- Update GetPortalCrossings to query and return the database id column
- Fix getPortalCrossings handler to populate all response fields:
  - ID: database row ID
  - PortalID: portal ID from the crossing event
  - BlobID: blob identifier
  - Direction: a_to_b or b_to_a
  - FromZone: source zone name
  - ToZone: destination zone name
  - Timestamp: crossing timestamp
  - Person: BLE identity if available
- Update tests to verify all fields are properly set

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 14:31:31 -04:00
Argo Workflows CI
a60777cc47 ci: auto-bump version to 0.1.317 2026-05-05 18:11:22 +00:00
jedarden
15c082c344 fleet: add idle role to validRoles and add disable/enable tests
- Added "idle" to validRoles map for consistency with disable/enable flow
- Added comprehensive tests for disableNode and enableNode handlers
- Tests cover: disable from tx/rx/tx_rx, already idle, node not found
- Tests cover: enable with saved role, no saved role (defaults to rx),
  already enabled, node not found
- Added round-trip test for full disable/enable cycle

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 14:10:52 -04:00
Argo Workflows CI
9fe1265525 ci: auto-bump version to 0.1.316 2026-05-05 17:51:15 +00:00
jedarden
21829b9738 api: add GET /api/baseline and POST /api/baseline/capture endpoints
Some checks are pending
CI Benchmark - Fusion Loop Timing / Fusion Loop Timing Benchmark (push) Waiting to run
Implements baseline read/capture endpoints for the dashboard. GET /api/baseline
returns [{link_id, snapshot_time_ms, confidence, n_sub}] for all links.
POST /api/baseline/capture starts a 60s quiet-room capture with optional
links filter.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 13:50:31 -04:00
Argo Workflows CI
b067131614 ci: auto-bump version to 0.1.315 2026-05-05 17:40:21 +00:00
jedarden
6d8fc086ff api: register GET /api/status and GET /api/occupancy endpoints
Implements two REST API endpoints as defined in the plan's REST API spec:

1. GET /api/status - Returns system status including:
   - version: Application version string
   - nodes: Number of online nodes
   - blobs: Number of currently tracked blobs
   - uptime_s: Uptime in seconds
   - detection_quality: System-wide detection quality (0-100)

2. GET /api/occupancy - Returns zone occupancy data:
   - zones: Map of zone names to {count, people[]}
     - count: Number of people in the zone
     - people: List of person names (BLE-identified)

These are simple read-only endpoints for dashboard and Home Assistant
integration for quick system checks and occupancy queries without WebSocket.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 13:39:56 -04:00
Argo Workflows CI
2f4c9d71be ci: auto-bump version to 0.1.314 2026-05-05 17:10:31 +00:00
jedarden
37571ece97 api/notifications: register preview endpoint in main.go
The GET /api/notifications/preview endpoint was already implemented
in internal/api/notifications.go but was never registered in main.go.
This commit wires up the NotificationsHandler to enable the test
thumbnail endpoint for UI development and QA.

The endpoint accepts query parameters:
- type: notification type (fall, anomaly, zone_enter, sleep)
- person: person name (optional, defaults to "Alice")

It calls the appropriate Generate*Thumbnail function from the
render package and returns PNG bytes with Content-Type: image/png.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 13:09:54 -04:00
Argo Workflows CI
45aa553a1f ci: auto-bump version to 0.1.313 2026-05-05 16:52:33 +00:00
jedarden
8a642705e8 mqtt: wire security_mode and rebaseline command subscriptions
- Add SubscribeToSecurityMode handler that calls anomalyDetector.SetSecurityMode()
  with SecurityModeArmed for 'arm' and SecurityModeDisarmed for 'disarm'
- Add SubscribeToRebaseline handler that publishes event bus events for baseline capture
- Both subscriptions allow Home Assistant automations to control security and rebaseline
2026-05-05 12:51:37 -04:00
Argo Workflows CI
a5dcc5d580 ci: auto-bump version to 0.1.312 2026-05-05 16:42:33 +00:00
jedarden
8a8b605a0b ota: implement auto-update with canary strategy and quiet window
Implements Component 6 from the plan - automatic OTA updates with canary
deployment strategy and configurable quiet window scheduling.

Features:
- Canary strategy: updates one node first, monitors detection quality
  for 10 minutes (configurable), then rolls out fleet-wide if quality
  degradation is below threshold (default 5%)
- Quiet window: configurable time range (default 02:00-05:00) when
  auto-updates are allowed. Supports overnight windows (e.g., 22:00-06:00)
- Zone vacancy check: only updates when all zones have been vacant
  for >10 minutes
- Auto-update mode toggle: enable/disable via settings
- REST API endpoints for status, config, trigger, cancel, and history
- Dashboard integration for real-time progress updates

Settings keys:
- auto_update_enabled: bool (default false)
- quiet_window_start: HH:MM format (default "02:00")
- quiet_window_end: HH:MM format (default "05:00")
- canary_duration_min: 5-60 minutes (default 10)
- auto_update_quality_threshold: 0.01-0.5 (default 0.05)

Implementation:
- internal/ota/autoupdate.go: AutoUpdateManager with canary selection,
  monitoring, and fleet rollout
- internal/ota/autoapi.go: REST API handlers
- internal/autoupdate/adapters.go: integration with quality provider,
  node provider, event notifier, zone vacancy checker
- internal/api/settings.go: auto-update settings with validation
- dashboard/js/ota.js: auto-update state tracking

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 12:41:39 -04:00
Argo Workflows CI
3e6edf1323 ci: auto-bump version to 0.1.311 2026-05-05 16:27:54 +00:00
jedarden
564d62cf33 ota: minor fixes to auto-update integration
- Export NodeConnectedGetter interface type in adapters
- Add GetConnectedMACs() method to fleet.Manager
- Fix syntax error in main.go (missing closing brace)
- Correct dashboard broadcaster setup to use autoupdate adapter

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 12:27:18 -04:00
Argo Workflows CI
1afd5df72b ci: auto-bump version to 0.1.310 2026-05-05 15:48:36 +00:00
jedarden
3254fcaf67 ota: implement auto-update with canary strategy and quiet window
Implements Component 6 OTA auto-update system with:

- Canary deployment strategy: update one node first, monitor quality
  for configurable duration (default 10 min), then roll out fleet-wide
- Configurable quiet window (default 02:00-05:00 local time) for
  automatic updates
- Auto-update mode toggle (auto_update_enabled setting)
- Quality-based rollback: if canary degrades detection quality
  beyond threshold (default 5%), abort and alert
- Zone vacancy check: only update when all zones vacant for >10 min
- Dashboard broadcaster integration for real-time progress updates
- Event notifier integration for timeline events
- REST API endpoints: /api/ota/auto/status, /api/ota/auto/trigger,
  /api/ota/auto/cancel, /api/ota/auto/config, /api/ota/auto/history

New settings:
- auto_update_enabled (bool, default false)
- quiet_window_start (string, default "02:00")
- quiet_window_end (string, default "05:00")
- canary_duration_min (int, default 10)
- auto_update_quality_threshold (float, default 0.05)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:48:07 -04:00
jedarden
582e45734c api: add GET /api/doctor endpoint for pre-flight configuration diagnostics
The /api/doctor endpoint complements /healthz (runtime state) with
configuration correctness checks. Returns 200 with a JSON report
containing all check results.

Checks implemented:
- data_dir_writable: verifies /data is writable with >100 MB free
- db_integrity: runs PRAGMA integrity_check
- firmware_dir: checks for *.bin files in /firmware
- mdns_binding: verifies mDNS service is registered (or SPAXEL_MDNS_ENABLED=false)
- mqtt_reachable: TCP connectivity test if SPAXEL_MQTT_BROKER is set
- ntp_reachable: UDP connectivity test if SPAXEL_NTP_SERVER is set
- install_secret: verifies install_secret row exists in auth table
- pin_configured: verifies pin_bcrypt is non-null in auth table
- node_token_consistency: verifies all nodes have valid MAC addresses

Response format includes overall status (ok/warn/error), individual check
results with name/status/message, and checked_at timestamp.

Requires session cookie authentication via authHandler.RequireAuth.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 11:48:07 -04:00
Argo Workflows CI
b036bd5183 ci: auto-bump version to 0.1.309 2026-05-05 11:38:56 +00:00
jedarden
386820e7b7 test: implement acceptance scenario integration tests (AS-1 through AS-6)
Implemented all 6 acceptance scenarios as verifiable integration tests:
- AS-1: First-time setup in under 5 minutes
- AS-2: Person detected while walking
- AS-3: Fall alert fires correctly
- AS-4: BLE identity resolves to person name
- AS-5: OTA update succeeds / rollback on bad firmware
- AS-6: Replay shows recorded history

Each scenario includes multiple test cases covering pass/fail criteria.
Tests use spaxel-sim as the test harness for simulating CSI data without
hardware. The integration test entry point runs all scenarios sequentially
for CI/CD verification.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 07:38:16 -04:00
Argo Workflows CI
88a8b1899b ci: auto-bump version to 0.1.308 2026-05-05 09:45:41 +00:00
jedarden
77a2fbc9c0 test: implement acceptance scenario integration tests (AS-1 through AS-6)
- Added comprehensive integration tests in test/acceptance/ covering all 6 acceptance scenarios from plan.md
- AS-1: First-time setup in under 5 minutes - verifies PIN setup and node auto-discovery
- AS-2: Person detected while walking - verifies blob detection during walker simulation
- AS-3: Fall alert fires correctly - verifies fall detection with webhook integration
- AS-4: BLE identity resolves to person name - verifies BLE device registration and identity matching
- AS-5: OTA update succeeds / rollback on bad firmware - verifies OTA workflow and rollback
- AS-6: Replay shows recorded history - verifies replay session creation, seeking, and playback

Tests use spaxel-sim CLI as the test harness and verify:
- API endpoint responses (/api/auth/setup, /api/nodes, /api/blobs, /api/events, /api/ble/devices, /api/replay/*)
- Detection accuracy thresholds (>60% blob presence during walking)
- Alert generation and webhook delivery
- Firmware version updates and rollback behavior
- Replay session lifecycle management

All tests skip by default unless ACCEPTANCE_TEST=1 or SPAXEL_INTEGRATION_TEST=1 is set.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-05 05:45:15 -04:00
Argo Workflows CI
c080933ace ci: auto-bump version to 0.1.307 2026-05-05 06:49:02 +00:00
jedarden
2eeeabbbb5 ci: add golangci-lint static analysis configuration
- Configure minimum linter set: errcheck, staticcheck, govet, ineffassign, unused
- Disable noisy style linters: gocyclo, funlen, wsl
- Add per-path exclusions for appropriate error handling patterns
- Configure errcheck exclusions for standard library and common patterns
- Configure staticcheck to enable only S/SA series (correctness)
- All tests pass with 0 lint issues

Per plan §Quality Gates / Definition of Done (item 3)
2026-05-05 02:48:35 -04:00