feat(platform): harden telemetry pipeline and unify Semi UI workspaces

This commit is contained in:
lingniu
2026-07-18 00:26:36 +08:00
parent 65b4e4f055
commit 159c80b0ae
136 changed files with 21616 additions and 1785 deletions

View File

@@ -0,0 +1,38 @@
package feichibridge
import (
"os"
"path/filepath"
"testing"
"time"
)
func TestStateStorePersistsAcknowledgedCursor(t *testing.T) {
path := filepath.Join(t.TempDir(), "nested", "state.json")
store, err := OpenStateStore(path)
if err != nil {
t.Fatal(err)
}
at := time.Date(2026, 7, 17, 12, 0, 0, 0, time.UTC)
if err := store.CommitRealtime("LTEST32960VIN0001", at, "hash"); err != nil {
t.Fatal(err)
}
if err := store.CommitBackfill("LTEST32960VIN0001", at.Add(-time.Minute)); err != nil {
t.Fatal(err)
}
reopened, err := OpenStateStore(path)
if err != nil {
t.Fatal(err)
}
got := reopened.Vehicle("LTEST32960VIN0001")
if !got.LastRealtimeTime.Equal(at) || got.LastRealtimeHash != "hash" {
t.Fatalf("state = %#v", got)
}
info, err := os.Stat(path)
if err != nil {
t.Fatal(err)
}
if info.Mode().Perm() != 0o600 {
t.Fatalf("state mode = %o", info.Mode().Perm())
}
}