Repository navigation
Commit 677e5e3
committed
test(config): pin that a reset settles every delete before it rejects
The Zoo-Code-Org#2235 row asked for a regression test for the straggler delete: a secrets.delete that
lands after resetAllState() has already rejected, once the guard is back down, so a save that
slipped into that window is erased from storage while the cache still serves it.
The first version of this case could not be written against the settled shape at all. Held open
by the test and awaited before the delete was released, resetAllState() simply never settled -
vitest timed it out at 20 s. That is itself the answer to the row: on this shape the ordering the
row describes is unreachable, because the reset does not reject until every delete has landed.
So the case observes the ordering instead of the hole. openRouterApiKey's delete rejects at once,
apiKey's lands 20 ms later on its own, and the case records whether it had landed by the moment
the reset's rejection was observed. It also asserts the guard window the fix buys: a save issued
while the pass is still settling is refused with SettingsWriteError rather than accepted, and the
first save after the reset resolves and leaves storage and cache holding the same value.
Measured with four runs of vitest run core/config in this tree, and the numstat below is from the
same runs:
at 41bd742, no case Test Files 10 passed (10) Tests 320 passed (320) (exit 0)
case added Test Files 10 passed (10) Tests 321 passed (321) (exit 0)
CONTROL, CX from Test Files 1 failed | 9 passed (10) Tests 1 failed | 320 passed (321), AssertionError: expected false to be true // Object.is equality | - Expect
492cfb3, case kept (the pre-settle shape: the reset rejects while apiKey's delete is
still outstanding, so stragglerLanded is false at that assertion)
final shape, formatted Test Files 10 passed (10) Tests 321 passed (321) (exit 0)
Test-only: 41 added / 0 deleted in ContextProxy.spec.ts and nothing else, from the git diff --numstat
that fed this message. ContextProxy.ts is untouched. tsc --noEmit -p . exit 0, eslint
--max-warnings=0 exit 0, prettier --check 0 on the committed copy and 0 on the HEAD
copy fed through the same invocation. --prune-suppressions leaves spec {"@typescript-eslint/no-explicit-any":{"count":5}}, CX {"@typescript-eslint/no-explicit-any":{"count":1}} exactly as
recorded and the suppressions file is not in the commit. No production behaviour changes, so no
new observable is introduced here.1 parent 41bd742 commit 677e5e3
1 file changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1310 | 1310 | | |
1311 | 1311 | | |
1312 | 1312 | | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1313 | 1354 | | |
1314 | 1355 | | |
1315 | 1356 | | |
| |||
0 commit comments