Repository navigation
Commit ec8850b
committed
fix(config): settle same-key writes against the state they were issued against
CodeRabbit review comments 4454026019 (Functional Correctness, Minor) and 4454026031
(Data Integrity & Integration, Minor) against 35a8bf3. Both held.
1. A rejection now rolls the mirror back whenever the rejecting write is the newest one
issued for the key, not only when it is the last write still running. When the newer
of two same-key writes fails while the older one is still in flight, readers no longer
report the rejected value for the duration of the older write. The landing repair from
35a8bf3 is unchanged: a landing may only write the mirror once nothing newer is in
flight, so an older write that lands after a newer one failed still corrects it.
2. resetAllState now bumps a generation counter along with clearing the maps. A write
issued before the reset that settles afterwards belongs to storage state that no
longer exists: its success handler used to put the pre-reset value back into
persistedValues (which initialize() does not clear), and a later rejected write would
restore that value into stateCache. Settlements from a stale generation are ignored
while the rejection is still reported to the caller.
Tests (46/46 in ContextProxy.spec.ts): the out-of-order landing test now also asserts
that the mirror reports the persisted value while the older write is in flight; a pre-reset
write that lands after the reset leaves the key unset and does not seed a later rollback;
a rejected pre-reset write does not roll back a write issued after the reset.
Mutation sweep over the new lines: 14 of 15 hand-written mutants killed (success may land
after a reset, failure may roll back across a reset, any rejection rolls the mirror back,
landing never repairs the mirror, persisted value not advanced / never seeded / seeded from
the incoming value, in-flight count never decremented, rejection leaves the write in flight,
reset keeps the generation, rejection swallowed, no optimistic cache write). One survives
and is disclosed rather than papered over: leaving writeSequences un-cleared on reset is
not observable because the generation guard already ignores that write - it is redundant
protection, and the sweep says so.
Regressions: full unit suite 58 failed / 12007 passed (was 12005 before this commit), the
same 15 pre-existing Windows failures. check-types: 114 pre-existing errors, none in a
touched file. eslint --max-warnings=0 exits 0; eslint-suppressions.json untouched.1 parent 35a8bf3 commit ec8850b
2 files changed
Lines changed: 94 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
| 58 | + | |
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| |||
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
377 | 384 | | |
378 | 385 | | |
379 | | - | |
| 386 | + | |
380 | 387 | | |
381 | 388 | | |
382 | 389 | | |
| |||
389 | 396 | | |
390 | 397 | | |
391 | 398 | | |
392 | | - | |
393 | | - | |
394 | | - | |
395 | | - | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
396 | 403 | | |
397 | 404 | | |
398 | 405 | | |
| |||
402 | 409 | | |
403 | 410 | | |
404 | 411 | | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
405 | 417 | | |
406 | 418 | | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
407 | 423 | | |
408 | 424 | | |
409 | 425 | | |
410 | 426 | | |
411 | 427 | | |
412 | | - | |
| 428 | + | |
413 | 429 | | |
414 | 430 | | |
415 | 431 | | |
416 | 432 | | |
417 | | - | |
418 | | - | |
419 | | - | |
420 | | - | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
421 | 443 | | |
422 | 444 | | |
423 | 445 | | |
| |||
646 | 668 | | |
647 | 669 | | |
648 | 670 | | |
649 | | - | |
650 | | - | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
651 | 676 | | |
652 | 677 | | |
653 | 678 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
312 | 312 | | |
313 | 313 | | |
314 | 314 | | |
315 | | - | |
316 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
| 320 | + | |
319 | 321 | | |
320 | 322 | | |
321 | 323 | | |
| |||
630 | 632 | | |
631 | 633 | | |
632 | 634 | | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
633 | 682 | | |
634 | 683 | | |
635 | 684 | | |
| |||
0 commit comments