Sfoglia il codice sorgente

test(perf): size the migration budget for the CI runner

The migrating first open of the synthetic log costs about 1 s on the
reference machine under the 128 MB heap limit and about twice that on the
CI runner, so 3,000 ms keeps headroom while staying far below the ~5 s
(~10 s on CI) of the repeated-snapshot implementation.
Tianyi Cui 1 mese fa
parent
commit
9048e8ee11

+ 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;
 # 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:
 # 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
 #   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: 6115522ba676cb4caae93926e265c13df78aad74
-2026-09-04-session-open-performance-gate.zh.md: d7d71662cc6592bf3df0420028a5d8a3329c7a40
+2026-09-04-session-open-performance-gate.md: 65f997a2a0e6ff5b69b2513126b85b752db2d9fb
+2026-09-04-session-open-performance-gate.zh.md: 565ec3ed2a37c88fdf7fe8abb1d02baca0d5d499

+ 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 |
 | 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()` ≤ 2,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()` ≤ 3,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 ≤ 3× the fold of the same window with 100 deltas per reply |
 | `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 ≤ 3× 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.
 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 |
 | 基准 | 负载 | 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 堆下 ≤ 2,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 堆下 ≤ 3,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 的同一窗口的 3 倍 |
 | `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 的同一窗口的 3 倍 |
 
 
 在引入该 gate 的提交上于参考机器测得:迁移基准耗尽 128 MB 堆,fold 基准在小窗口与大窗口之间缩放 11 倍,因此两个 gate 都在回归代码上失败,并在两条路径改为 O(records) 工作后通过。
 在引入该 gate 的提交上于参考机器测得:迁移基准耗尽 128 MB 堆,fold 基准在小窗口与大窗口之间缩放 11 倍,因此两个 gate 都在回归代码上失败,并在两条路径改为 O(records) 工作后通过。

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

@@ -21,11 +21,12 @@ const SHAPE = { turns: 200, textDeltas: 500 } as const
  * Wall-clock budget for the migrating first `open()`. The pre-stack backend
  * 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
  * decoded the same bytes in about 35 ms on the reference machine; a whole
  * artifact migration that validates, transforms, publishes, and re-reads the
  * artifact migration that validates, transforms, publishes, and re-reads the
- * log costs a small multiple of that, and the budget leaves a further
- * multiple for slower CI hosts while staying far below the ~5 s that the
- * repeated-snapshot implementation needed.
+ * 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.
  */
  */
-const MIGRATION_BUDGET_MS = 2_000
+const MIGRATION_BUDGET_MS = 3_000
 
 
 /**
 /**
  * Old-space limit for the migrating child process. Pre-stack decoding of the
  * Old-space limit for the migrating child process. Pre-stack decoding of the