فهرست منبع

test(perf): double the CI cost in the migration budget

The migrating first open measured 1,963 ms on the CI runner under the
128 MB heap limit; 4,000 ms keeps a 2x margin while the repeated-snapshot
implementation still fails by heap exhaustion and would need ~10 s.
Tianyi Cui 4 هفته پیش
والد
کامیت
c53b0bb5ed

+ 2 - 2
.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.i18n.yaml

@@ -2,5 +2,5 @@
 # side as of the last confirmed-consistent state. Both languages carry equal authority;
 # after editing either side, bring the other along and re-record with:
 #   pnpm run verify-translation-pairing --write .agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md
-2026-09-04-session-open-performance-gate.md: ea6a9434dd0f16d9e92a2ff14be4cd9699667007
-2026-09-04-session-open-performance-gate.zh.md: b1db1ca730a73fe503dd476401fcd44ab9a9cda4
+2026-09-04-session-open-performance-gate.md: fb22f4cfbc0dad9e68b5219d7fc4aba6a47398f4
+2026-09-04-session-open-performance-gate.zh.md: bc574f9e4963933b1dae76a165ffb00a31a87ae3

+ 1 - 1
.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.md

@@ -18,7 +18,7 @@ The first two gates cover the two regressed paths:
 
 | Benchmark | Workload | Gates |
 |---|---|---|
-| `packages/session/session-persistence-jsonl/tests/open-generation.bench.ts` | 200 turns × (500 text + 125 reasoning deltas) = 127,400 released-v0 events, about 2.8 MB, encoded through the frozen v0 codec with packed rows | migrating first `open()` ≤ 3,000 ms under a 128 MB heap; fresh-process open of the published current generation ≤ 500 ms; minimum of three attempts |
+| `packages/session/session-persistence-jsonl/tests/open-generation.bench.ts` | 200 turns × (500 text + 125 reasoning deltas) = 127,400 released-v0 events, about 2.8 MB, encoded through the frozen v0 codec with packed rows | migrating first `open()` ≤ 4,000 ms under a 128 MB heap; fresh-process open of the published current generation ≤ 500 ms; minimum of three attempts |
 | `packages/client/ui-chat/tests/conversation-fold.bench.client.ts` | 200 replies whose compact streams hold 2,000 text + 500 reasoning deltas each (500,000 deltas in 1,600 records), folded through every Chat Definition by the real `ConversationNodeAssembler` | large fold ≤ 150 ms; large fold ≤ 5× the fold of the same window with 100 deltas per reply |
 
 Measured on the reference machine at the commit that introduced the gate, the migration benchmark exhausted the 128 MB heap and the fold benchmark scaled 11× between the small and large windows, so both gates fail on the regressed code and pass once the paths do O(records) work.

+ 1 - 1
.agents/notes/implemented/testing/2026-09-04-session-open-performance-gate.zh.md

@@ -18,7 +18,7 @@ Linux pull request 运行必需的 `node 24 / benchmarks` job,执行 `pnpm run
 
 | 基准 | 负载 | Gate |
 |---|---|---|
-| `packages/session/session-persistence-jsonl/tests/open-generation.bench.ts` | 200 轮 ×(500 text + 125 reasoning delta)= 127,400 个 released-v0 事件,约 2.8 MB,经冻结 v0 codec 以 packed row 编码 | 迁移的首次 `open()` 在 128 MB 堆下 ≤ 3,000 ms;新进程打开已发布 current generation ≤ 500 ms;三次尝试取最小值 |
+| `packages/session/session-persistence-jsonl/tests/open-generation.bench.ts` | 200 轮 ×(500 text + 125 reasoning delta)= 127,400 个 released-v0 事件,约 2.8 MB,经冻结 v0 codec 以 packed row 编码 | 迁移的首次 `open()` 在 128 MB 堆下 ≤ 4,000 ms;新进程打开已发布 current generation ≤ 500 ms;三次尝试取最小值 |
 | `packages/client/ui-chat/tests/conversation-fold.bench.client.ts` | 200 个回复,每个紧凑 stream 含 2,000 text + 500 reasoning delta(1,600 条记录中 500,000 个 delta),由真实 `ConversationNodeAssembler` 经全部 Chat Definition fold | 大窗口 fold ≤ 150 ms;大窗口 fold ≤ 每回复 100 delta 的同一窗口的 5 倍 |
 
 在引入该 gate 的提交上于参考机器测得:迁移基准耗尽 128 MB 堆,fold 基准在小窗口与大窗口之间缩放 11 倍,因此两个 gate 都在回归代码上失败,并在两条路径改为 O(records) 工作后通过。

+ 4 - 5
packages/session/session-persistence-jsonl/tests/open-generation.bench.ts

@@ -21,12 +21,11 @@ const SHAPE = { turns: 200, textDeltas: 500 } as const
  * Wall-clock budget for the migrating first `open()`. The pre-stack backend
  * decoded the same bytes in about 35 ms on the reference machine; a whole
  * artifact migration that validates, transforms, publishes, and re-reads the
- * log under the heap limit below costs about 1 s there and about twice that
- * on the CI runner. The budget leaves headroom above that while staying far
- * below the ~5 s (~10 s on CI) that the repeated-snapshot implementation
- * needed.
+ * log under the heap limit below costs about 1 s there and about 2 s on the
+ * CI runner. The budget doubles the CI cost while staying far below the ~5 s
+ * (~10 s on CI) that the repeated-snapshot implementation needed.
  */
-const MIGRATION_BUDGET_MS = 3_000
+const MIGRATION_BUDGET_MS = 4_000
 
 /**
  * Old-space limit for the migrating child process. Pre-stack decoding of the