chore: establish local platform baseline

This commit is contained in:
Codex Local
2026-08-26 06:41:54 +08:00
commit 29bdf4900f
575 changed files with 95644 additions and 0 deletions
@@ -0,0 +1,45 @@
package diagnostics
import (
"testing"
"time"
)
func TestValidatePilotWeeklySnapshotInputUsesSevenCalendarDays(t *testing.T) {
now := time.Date(2026, 3, 10, 12, 0, 0, 0, time.UTC)
_, start, end, err := validatePilotWeeklySnapshotInput(PilotWeeklySnapshotInput{
CandidateVersion: "0.55.0-rc.test",
BuildDigest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
WeekStart: "2026-03-02",
Timezone: "America/New_York",
Reason: "Archive weekly pilot evidence",
}, now)
if err != nil {
t.Fatal(err)
}
if got := end.Sub(start); got != 167*time.Hour {
t.Fatalf("DST weekly duration=%s, want 167h", got)
}
}
func TestValidatePilotWeeklySnapshotInputRejectsNonMondayAndFutureWeek(t *testing.T) {
now := time.Date(2026, 8, 25, 12, 0, 0, 0, time.UTC)
for _, input := range []PilotWeeklySnapshotInput{
{WeekStart: "2026-08-24", Timezone: "Asia/Shanghai", Reason: "Archive weekly pilot evidence"},
{CandidateVersion: "0.55.0-rc.test", BuildDigest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", WeekStart: "2026-08-25", Timezone: "Asia/Shanghai", Reason: "Archive weekly pilot evidence"},
{CandidateVersion: "0.55.0-rc.test", BuildDigest: "sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", WeekStart: "2026-08-31", Timezone: "Asia/Shanghai", Reason: "Archive weekly pilot evidence"},
} {
if _, _, _, err := validatePilotWeeklySnapshotInput(input, now); err == nil {
t.Fatalf("expected invalid input: %+v", input)
}
}
}
func TestRateBasisPointsRoundsToNearestPoint(t *testing.T) {
if got := rateBasisPoints(2, 3); got != 6667 {
t.Fatalf("rate=%d, want 6667", got)
}
if got := rateBasisPoints(0, 0); got != 0 {
t.Fatalf("empty rate=%d, want 0", got)
}
}