refactor(*): 稳定期治理 - 收敛核心架构、错误语义并修复跨项目数据竞态

This commit is contained in:
ddCat
2026-09-09 22:02:10 +08:00
parent bacd502f5c
commit b5f3413ded
298 changed files with 12681 additions and 26428 deletions

View File

@@ -37,6 +37,20 @@ func TestTaskTextEventCursorPrefersQueryAndSupportsLastEventID(t *testing.T) {
}
}
func TestTaskTextEventCursorRejectsInvalidValues(t *testing.T) {
gin.SetMode(gin.TestMode)
for _, query := range []string{"after=abc", "after=-1"} {
t.Run(query, func(t *testing.T) {
request := httptest.NewRequest("GET", "/api/tasks/task-1/text-events?"+query, nil)
context, _ := gin.CreateTestContext(httptest.NewRecorder())
context.Request = request
if after, err := taskTextEventCursor(context); err == nil || after != 0 {
t.Fatalf("cursor = %d, err = %v; want a rejected cursor", after, err)
}
})
}
}
func TestStreamTaskTextEventsCachedReplayReachesTerminalWithoutDuplicateDelta(t *testing.T) {
t.Setenv("REDIS_URL", "")
db, err := gorm.Open(sqlite.Open(":memory:"), &gorm.Config{})