docs(gateway): gateway 剩余文件注释改中文(逐行 1:1,代码零字节改动)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

主人 2026-10-03 拍板「注释一律中文」;gateway 至此整包注释中文化完成(本会话共 3 批:
已推库 16 个文件 + 本批剩余文件)。
校验:机械校验(非注释改动行)= 空;剥注释后代码文本逐行比对全等(不一致文件数 0);
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:25 +08:00
1 parent 91e8d7a029
commit 074ffc4ebf
73 files changed
+2529 -2529

No files matched your search

+16 -16
View File
@@ -9,9 +9,9 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/history"
)
// TestHistoryListMessagesAfterCursor covers the forward cursor (A5): after returns the
// strictly-newer messages oldest-first, before keeps its existing newest-first behavior,
// and the two cursors are mutually exclusive.
// TestHistoryListMessagesAfterCursor 覆盖前向游标(A5):after 返回
// 严格更新的消息且最旧优先,before 保持既有的最新优先行为,
// 两个游标互斥。
func TestHistoryListMessagesAfterCursor(t *testing.T) {
t.Parallel()
_, ts, jwt, st := newHistoryEnv(t)
@@ -24,7 +24,7 @@ func TestHistoryListMessagesAfterCursor(t *testing.T) {
tok := signAny(t, jwt, "acct", auth.RoleOwner)
base := ts.URL + "/api/v1/sessions/" + history.MainSessionID + "/messages"
// after=2000 → strictly newer, oldest first.
// after=2000 → 严格更新,最旧优先。
resp, body := doReq(t, http.MethodGet, base+"?after=2000", nil, tok)
if resp.StatusCode != http.StatusOK {
t.Fatalf("after status = %d, want 200 (body=%s)", resp.StatusCode, body)
@@ -35,7 +35,7 @@ func TestHistoryListMessagesAfterCursor(t *testing.T) {
t.Fatalf("after=2000 = %+v, want ascending [3000 4000]", forward)
}
// after at the newest message → empty page, still 200.
// after 设为最新消息 → 空页,仍为 200。
resp, body = doReq(t, http.MethodGet, base+"?after=4000", nil, tok)
if resp.StatusCode != http.StatusOK {
t.Fatalf("after newest status = %d, want 200 (body=%s)", resp.StatusCode, body)
@@ -46,7 +46,7 @@ func TestHistoryListMessagesAfterCursor(t *testing.T) {
t.Fatalf("after=4000 = %+v, want empty", empty)
}
// before behavior is unchanged: newest first, strictly older.
// before 行为不变:最新优先,严格更旧。
resp, body = doReq(t, http.MethodGet, base+"?before=3000&limit=2", nil, tok)
if resp.StatusCode != http.StatusOK {
t.Fatalf("before status = %d, want 200 (body=%s)", resp.StatusCode, body)
@@ -57,7 +57,7 @@ func TestHistoryListMessagesAfterCursor(t *testing.T) {
t.Fatalf("before=3000 = %+v, want descending [2000 1000]", backward)
}
// after=0 is not a forward bound → falls back to the default newest-first page.
// after=0 不是前向边界 → 回退到默认的最新优先页。
resp, body = doReq(t, http.MethodGet, base+"?after=0&limit=2", nil, tok)
if resp.StatusCode != http.StatusOK {
t.Fatalf("after=0 status = %d, want 200 (body=%s)", resp.StatusCode, body)
@@ -69,8 +69,8 @@ func TestHistoryListMessagesAfterCursor(t *testing.T) {
}
}
// TestHistoryListMessagesAfterRejectsBadInput covers the 400s: both cursors together,
// and a negative or non-numeric after.
// TestHistoryListMessagesAfterRejectsBadInput 覆盖那些 400:两个游标同时
// 给出,以及 after 为负或非数字。
func TestHistoryListMessagesAfterRejectsBadInput(t *testing.T) {
t.Parallel()
_, ts, jwt, _ := newHistoryEnv(t)
@@ -78,9 +78,9 @@ func TestHistoryListMessagesAfterRejectsBadInput(t *testing.T) {
base := ts.URL + "/api/v1/sessions/" + history.MainSessionID + "/messages"
for _, q := range []string{
"?after=1000&before=3000", // both cursors
"?after=-1", // negative
"?after=abc", // non-numeric
"?after=1000&before=3000", // 两个游标都给
"?after=-1", // 负数
"?after=abc", // 非数字
} {
resp, body := doReq(t, http.MethodGet, base+q, nil, tok)
if resp.StatusCode != http.StatusBadRequest {
@@ -89,8 +89,8 @@ func TestHistoryListMessagesAfterRejectsBadInput(t *testing.T) {
}
}
// TestHistoryListMessagesAfterPlatformFilter asserts the platform filter composes with
// the forward cursor.
// TestHistoryListMessagesAfterPlatformFilter 断言平台过滤与前向游标
// 可以组合。
func TestHistoryListMessagesAfterPlatformFilter(t *testing.T) {
t.Parallel()
_, ts, jwt, st := newHistoryEnv(t)
@@ -119,8 +119,8 @@ func TestHistoryListMessagesAfterPlatformFilter(t *testing.T) {
}
}
// TestHistoryListMessagesAfterLimitClamp asserts the forward page is capped at 200 like
// the backward one, and that advancing the returned cursor pages forward without a gap.
// TestHistoryListMessagesAfterLimitClamp 断言前向页与后向一样上限 200,
// 且推进返回的游标能无缝隙地向前翻页。
func TestHistoryListMessagesAfterLimitClamp(t *testing.T) {
t.Parallel()
_, ts, jwt, st := newHistoryEnv(t)