Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
32 lines
964 B
Go
32 lines
964 B
Go
package seheweit
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
func TestHistoryWindow(t *testing.T) {
|
|
now := time.Date(2026, 11, 1, 12, 34, 56, 0, time.UTC)
|
|
for _, tc := range []struct {
|
|
hours, wantHours int
|
|
bucket int64
|
|
}{
|
|
{-1, 1, 60000}, {0, 1, 60000}, {1, 1, 60000}, {24, 24, 240000}, {168, 168, 1680000}, {999, 168, 1680000},
|
|
} {
|
|
got := Window(tc.hours, now)
|
|
if got.ToMS != now.UnixMilli() || got.FromMS != now.Add(-time.Duration(tc.wantHours)*time.Hour).UnixMilli() || got.BucketMS != tc.bucket {
|
|
t.Fatalf("hours=%d %+v", tc.hours, got)
|
|
}
|
|
buckets := got.ToMS/got.BucketMS - got.FromMS/got.BucketMS + 1
|
|
if buckets > MaxHistoryPoints {
|
|
t.Fatalf("too many buckets: %d", buckets)
|
|
}
|
|
}
|
|
if RetentionCutoff(now.UnixMilli()) != now.Add(-7*24*time.Hour).UnixMilli() {
|
|
t.Fatal("retention changed")
|
|
}
|
|
if ResourceEventID != "builtin.resource.sample" || ResourceEventType != "resource.sample" {
|
|
t.Fatal("persisted identifiers changed")
|
|
}
|
|
}
|