Commit c6d0bf2
committed
fix(session): unbreak CI - small-cap trim fixtures + incremental redaction
TestSave_TrimsOversizedSession timed out at 10m in CI: the 40 MiB
fixture forced redact.RedactSecrets (20+ regexes) over the whole
transcript on save, and saveLocked re-redacts the ENTIRE history on
every save - O(history) per write, O(n^2) over a session's life.
- MaxSessionFileBytes is now a var (comment: production treats it as
fixed) so cap-trimming tests use a 64 KiB cap with tiny fixtures
instead of multi-MiB transcripts; the oversized trim tests drop from
~25s to <0.1s and the session package from ~42s to ~1.5s.
- Real production win behind the same failure: sessions are append-only,
so saveLocked now redacts only messages at or beyond a persisted
RedactBoundary instead of the full transcript on every save. Old
files default to 0 (= redact all once); the boundary is set to the
surviving message count before the final marshal so it persists.
- New TestSave_IncrementalRedaction pins the boundary behavior;
small-cap fixtures keep identical trim semantics coverage.1 parent 84df555 commit c6d0bf2
3 files changed
Lines changed: 105 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
39 | 41 | | |
40 | 42 | | |
41 | 43 | | |
| |||
52 | 54 | | |
53 | 55 | | |
54 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
55 | 65 | | |
56 | 66 | | |
57 | 67 | | |
| |||
355 | 365 | | |
356 | 366 | | |
357 | 367 | | |
358 | | - | |
359 | | - | |
360 | | - | |
361 | | - | |
362 | | - | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
363 | 375 | | |
364 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
365 | 384 | | |
366 | 385 | | |
367 | 386 | | |
| |||
377 | 396 | | |
378 | 397 | | |
379 | 398 | | |
380 | | - | |
381 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
382 | 402 | | |
383 | 403 | | |
384 | 404 | | |
| |||
389 | 409 | | |
390 | 410 | | |
391 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
392 | 421 | | |
393 | 422 | | |
394 | 423 | | |
| |||
472 | 501 | | |
473 | 502 | | |
474 | 503 | | |
475 | | - | |
| 504 | + | |
476 | 505 | | |
477 | 506 | | |
478 | 507 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
46 | 56 | | |
47 | 57 | | |
48 | 58 | | |
| 59 | + | |
49 | 60 | | |
50 | 61 | | |
51 | 62 | | |
| |||
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| 85 | + | |
74 | 86 | | |
75 | 87 | | |
76 | 88 | | |
| |||
107 | 119 | | |
108 | 120 | | |
109 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1291 | 1291 | | |
1292 | 1292 | | |
1293 | 1293 | | |
| 1294 | + | |
1294 | 1295 | | |
1295 | | - | |
1296 | | - | |
1297 | | - | |
| 1296 | + | |
| 1297 | + | |
| 1298 | + | |
| 1299 | + | |
1298 | 1300 | | |
1299 | 1301 | | |
1300 | 1302 | | |
| |||
1318 | 1320 | | |
1319 | 1321 | | |
1320 | 1322 | | |
1321 | | - | |
| 1323 | + | |
1322 | 1324 | | |
1323 | 1325 | | |
1324 | 1326 | | |
| |||
1352 | 1354 | | |
1353 | 1355 | | |
1354 | 1356 | | |
| 1357 | + | |
1355 | 1358 | | |
1356 | | - | |
| 1359 | + | |
| 1360 | + | |
1357 | 1361 | | |
1358 | 1362 | | |
1359 | 1363 | | |
| |||
0 commit comments