docs(comments): 注释中文化 · internal/runtime/memory(31 文件,纯替换)
- 只翻注释/文档字符串:820 增 / 820 删 严格 1:1;剥掉整行注释与行尾注释尾巴后, 逐文件与 HEAD 比对「代码部分差异 = 0」;裁决/design 编号计数逐项与 HEAD 一致 - 保留可执行 SQL 样例、SQLite 报错原文、pgvector/HNSW/ANN/BLOB 等技术词原文 - 复核:go build 绿 + memory/projectindex/vector 三包测试绿;gofmt 仅剩 2 个既有未格式化文件(改动前即如此,未顺手修)
This commit is contained in:
1 parent
eb1828ee7a
commit
61cf80d5ee
31 files changed
+820
-820
No files matched your search
@@ -6,8 +6,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// insertLegacyChapterSQL writes a project_chapter row with caller-supplied raw
|
||||
// timestamps, standing in for a row persisted before the fixed-width layout.
|
||||
// insertLegacyChapterSQL 用调用方给定的原始时间戳写入一行
|
||||
// project_chapter,代表定宽布局之前持久化的行。
|
||||
const insertLegacyChapterSQL = `INSERT INTO project_chapter
|
||||
(id, project_id, title, content, created_at, updated_at)
|
||||
VALUES (?, 'proj.1', '旧章节', '旧内容', ?, ?)`
|
||||
@@ -37,9 +37,9 @@ func TestFormatTime_定宽_正常(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStore_ListChapters_变宽时间戳_排序 is the projectindex regression for the
|
||||
// variable-width timestamp bug: RFC3339Nano would store these as ":05.83" and
|
||||
// ":05.8309789", whose text order is the reverse of their time order.
|
||||
// TestStore_ListChapters_变宽时间戳_排序 是 projectindex 针对变宽
|
||||
// 时间戳缺陷的回归:RFC3339Nano 会把它们存成 ":05.83" 与
|
||||
// ":05.8309789",其文本顺序与时间顺序相反。
|
||||
func TestStore_ListChapters_变宽时间戳_排序(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
@@ -49,8 +49,8 @@ func TestStore_ListChapters_变宽时间戳_排序(t *testing.T) {
|
||||
older := sec.Add(830 * time.Millisecond)
|
||||
newer := older.Add(978900 * time.Nanosecond)
|
||||
|
||||
// The newer chapter is inserted first, so a rowid-only tiebreak would put it
|
||||
// last: only correctly ordered created_at text places it last-but-one.
|
||||
// 较新的章节先插入,因此只按 rowid 排序会把它放到
|
||||
// 最后:只有正确排序的 created_at 文本才会把它放在倒数第二。
|
||||
if err := s.AddChapter(ctx, "proj.1", Chapter{
|
||||
Title: "较晚", Content: "x", CreatedAt: newer, UpdatedAt: newer,
|
||||
}); err != nil {
|
||||
@@ -83,9 +83,9 @@ func TestStore_ListChapters_变宽时间戳_排序(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestStore_ListChapters_同一时间戳_插入序 covers the tie case: consecutive
|
||||
// AddChapter calls can share one clock tick, so rowid ASC must keep them in
|
||||
// insertion order.
|
||||
// TestStore_ListChapters_同一时间戳_插入序 覆盖并列情形:连续的
|
||||
// AddChapter 调用可能共享同一时钟刻,因此 rowid ASC 必须让它们保持
|
||||
// 插入顺序。
|
||||
func TestStore_ListChapters_同一时间戳_插入序(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
@@ -115,9 +115,9 @@ func TestStore_ListChapters_同一时间戳_插入序(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestNew_归一化历史时间戳_正常 writes legacy variable-width rows into both
|
||||
// tables, re-opens the store to trigger normalization, and checks the repaired
|
||||
// text plus idempotence and the unparseable-row skip.
|
||||
// TestNew_归一化历史时间戳_正常 把旧的变宽数据写入两张
|
||||
// 表,重新打开存储触发规范化,并检查修复后的文本
|
||||
// 以及幂等性与无法解析行的跳过。
|
||||
func TestNew_归一化历史时间戳_正常(t *testing.T) {
|
||||
t.Parallel()
|
||||
ctx := context.Background()
|
||||
@@ -135,7 +135,7 @@ func TestNew_归一化历史时间戳_正常(t *testing.T) {
|
||||
t.Fatalf("insert unparseable chapter: %v", err)
|
||||
}
|
||||
|
||||
// Re-opening normalizes both tables; an unparseable value must not block it.
|
||||
// 重新打开会规范化两张表;无法解析的值不得阻塞它。
|
||||
if _, err := New(ctx, s.db, testLogger()); err != nil {
|
||||
t.Fatalf("New (normalize): %v", err)
|
||||
}
|
||||
@@ -163,7 +163,7 @@ func TestNew_归一化历史时间戳_正常(t *testing.T) {
|
||||
t.Errorf("unparseable created_at = %q, want it left as is", broken)
|
||||
}
|
||||
|
||||
// A further open must be a no-op.
|
||||
// 再次打开必须是空操作。
|
||||
if _, err := New(ctx, s.db, testLogger()); err != nil {
|
||||
t.Fatalf("New (second pass): %v", err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user