Fix location races, run database tests in CI, add make check
Test and publish / test (push) Has been cancelled
Test and publish / publish (push) Has been cancelled

Location: a leave decided its destination before taking the device lock,
so a "leave home" racing an "arrive gym" could undo the arrival. The
decision (now ingest.Destination) runs inside MoveTo under the lock.
Transition external IDs were device|label|time, which collided (500) when
out-of-order events were clamped to the same start; they now name the
interval being closed.

hypr-agent: a control command arriving during shutdown no longer blocks
its goroutine forever.

Tests: internal/testdb gives each database test its own throwaway
database, so they run in parallel and no longer truncate the dev data.
New store tests cover both location bugs. CI starts a Postgres container
so these tests actually run, and adds gofmt, staticcheck (pinned as a go
tool) and -race. `make check` runs the same locally.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-14 22:48:41 +01:00
co-authored by Claude Opus 5.5
parent 0be97384fa
commit cfe17ecf5d
13 changed files with 285 additions and 80 deletions
+6 -2
View File
@@ -61,8 +61,12 @@ func ServeControl(ctx context.Context, out chan<- ControlEvent) error {
fmt.Fprintf(conn, "unknown command %q\n", cmd)
return
}
out <- ControlEvent{Command: cmd, At: time.Now()}
fmt.Fprintln(conn, "ok")
select {
case out <- ControlEvent{Command: cmd, At: time.Now()}:
fmt.Fprintln(conn, "ok")
case <-ctx.Done(): // the agent stopped reading
fmt.Fprintln(conn, "shutting down")
}
}()
}
}