spaxel/mothership/internal/api
jedarden 14565743c5 test(bf-69ym): end-to-end simulator→fleet-registry position flow
The only coverage of the simulator→registry position path was either
bridge-level unit tests (registry_bridge_test.go against a fake adapter) or
handler-level immediate-sync tests (TestImmediateSyncOnAddAndUpdate against a
recording fake with explicit positions). Nothing proved a position travels
from the simulator handler all the way into the live fleet.Registry — and
specifically that an origin-default node is written to the registry at the
spread geometry DefaultNodePositions assigns, not co-located at (0,0,0).

Add two end-to-end tests that wire a real SQLite-backed *fleet.Registry
behind the SimulatorHandler (the same wiring cmd/mothership/main.go uses,
via a test-local fleetRegistryTestAdapter that mirrors the production
fleetRegistryAdapter since the latter lives in package main and isn't
importable):

- TestSimulatorHandlerToRegistry_CreateAndUpdate: AddNode (no position) →
  CreateVirtualNode → SyncToRegistry → AddVirtualNode into the live registry,
  asserting the node lands at exactly DefaultNodePositions(space,1) (never
  (0,0,0)); then UpdateNode → SetNodePosition, asserting the new position
  flows through to the same registry row without duplicating it.

- TestSimulatorHandlerToRegistry_OriginNodesGetSpreadGeometry: 4 nodes
  posted at the DB default origin {0,0,1} must land in the registry at the
  distinct, spread-out DefaultNodePositions(space,4) set — never co-located
  at the origin (the failure mode in bf-18yn / bf-4q5w).

Split from bf-4oiz. go test ./internal/simulator/... ./internal/api/... and
full go test/vet ./... all green.

Co-Authored-By: Claude <noreply@anthropic.com>
Bead-Id: bf-69ym
2026-07-06 12:08:27 -04:00
..
alerts.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
analytics.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
analytics_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
backup.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
backup_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
baseline.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
baseline_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
ble_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
briefing.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
briefing_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
diurnal.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
diurnal_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
events.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
events_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
feedback.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
guided.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
integrations.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
localization.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
localization_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
notification_settings.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
notification_settings_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
notifications.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
notifications_test.go api/notifications: register preview endpoint in main.go 2026-05-05 13:09:54 -04:00
prediction.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
prediction_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
replay.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
replay_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
security.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
security_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
settings.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
settings_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
simulator.go feat(bf-5lii): wire immediate registry sync on simulator node create/update 2026-07-06 11:46:43 -04:00
simulator_test.go test(bf-69ym): end-to-end simulator→fleet-registry position flow 2026-07-06 12:08:27 -04:00
status.go feat(api): wire build-time version through StatusHandler (bf-iekf) 2026-07-04 04:29:59 -04:00
status_test.go feat(api): wire build-time version through StatusHandler (bf-iekf) 2026-07-04 04:29:59 -04:00
tracks.go fix: resolve analytics API test failures and improve corridor response format 2026-04-11 08:34:24 -04:00
tracks_test.go test: implement acceptance scenario integration tests (AS-1 through AS-6) 2026-05-05 05:45:15 -04:00
triggers.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
triggers_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
utils.go feat: verify dashboard WebSocket feed supports events, alerts, BLE, triggers, health 2026-04-07 09:54:14 -04:00
volume_triggers.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
volume_triggers_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
zones.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00
zones_test.go style(mothership): run go fmt to format all Go code 2026-05-24 15:30:02 -04:00