Repository navigation
Commit b097aaa
authored
fix: doctor --fix reports config changes that were never written when validation refuses the candidate (#124462)
* fix(doctor): never report unpersisted config fixes
doctor --fix printed "Doctor changes" panels while computing candidate
mutations, then crashed with a raw Error and persisted nothing when the
repaired candidate still failed write validation (e.g. an unknown root
key repaired alongside an unrepairable schema type error).
Root cause: the compute->print->validate->persist ordering was wrong.
Panels were printed at mutation time, but validation only ran inside the
atomic writer, after all panels were visible.
Fix at the owner boundaries:
- doctor-config-flow queues repair-mode "Doctor changes" panels in a
sink instead of printing them; preview panels still print immediately.
Committed side-effect repair notes (SQLite/filesystem) keep printing
at repair time; candidate-config notes from the repair sequence are
routed through the same deferred sink.
- io.write throws a typed CONFIG_VALIDATION_FAILED error (with the full
issue list) via a new createConfigValidationFailedError owner in
io.write-errors.
- runWriteConfigHealth prints queued panels only after the atomic write
commits, and renders a validation refusal as a "Doctor warnings" panel
stating no config changes were written plus the exact paths to fix by
hand. The contribution loop stops after refusal (same invariant as the
cron-ownership deferral) and doctor exits 1 without a raw Error leak.
Regression tests: pre-fix, the new validation-refusal e2e test fails on
the lying "Doctor changes" panel; contribution-level tests cover the
refusal note, held panels printing exactly once after commit, and no
retry of the identical candidate.
* fix(doctor): report partial persistence accurately after a later write refusal
Post-rebase CI and ClawSweeper follow-ups:
- repair-sequencing tests now assert the deferred configChangeNotes contract
(candidate-only mutation notes moved out of changeNotes by the parent
commit); committed side-effect notes stay in changeNotes.
- formatConfigValidationFailure is module-private; its guidance formatting is
covered through createConfigValidationFailedError, fixing the knip
unused-export gate.
- When the initial write pass committed and only the later post-repair write
is refused, the warnings panel says earlier fixes were saved instead of
claiming no config changes were written, and the outro says "some config
fixes were not applied". New regression test covers commit-then-refusal.1 parent 6f418b9 commit b097aaa
13 files changed
Lines changed: 454 additions & 67 deletions
File tree
- src
- commands
- doctor
- config
- flows
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1686 | 1686 | | |
1687 | 1687 | | |
1688 | 1688 | | |
1689 | | - | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
1690 | 1692 | | |
1691 | | - | |
1692 | 1693 | | |
| 1694 | + | |
1693 | 1695 | | |
1694 | 1696 | | |
1695 | 1697 | | |
| |||
2885 | 2887 | | |
2886 | 2888 | | |
2887 | 2889 | | |
2888 | | - | |
| 2890 | + | |
2889 | 2891 | | |
2890 | 2892 | | |
2891 | 2893 | | |
| |||
2919 | 2921 | | |
2920 | 2922 | | |
2921 | 2923 | | |
2922 | | - | |
2923 | | - | |
2924 | | - | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
2925 | 2932 | | |
2926 | 2933 | | |
2927 | 2934 | | |
| |||
3570 | 3577 | | |
3571 | 3578 | | |
3572 | 3579 | | |
3573 | | - | |
3574 | | - | |
| 3580 | + | |
| 3581 | + | |
3575 | 3582 | | |
3576 | 3583 | | |
3577 | | - | |
| 3584 | + | |
3578 | 3585 | | |
3579 | 3586 | | |
3580 | 3587 | | |
| |||
3595 | 3602 | | |
3596 | 3603 | | |
3597 | 3604 | | |
3598 | | - | |
3599 | | - | |
3600 | | - | |
3601 | | - | |
3602 | | - | |
3603 | | - | |
3604 | | - | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
| 3619 | + | |
3605 | 3620 | | |
3606 | 3621 | | |
3607 | 3622 | | |
| |||
3633 | 3648 | | |
3634 | 3649 | | |
3635 | 3650 | | |
3636 | | - | |
| 3651 | + | |
3637 | 3652 | | |
3638 | 3653 | | |
3639 | | - | |
| 3654 | + | |
3640 | 3655 | | |
3641 | 3656 | | |
3642 | 3657 | | |
| |||
3647 | 3662 | | |
3648 | 3663 | | |
3649 | 3664 | | |
3650 | | - | |
| 3665 | + | |
| 3666 | + | |
| 3667 | + | |
3651 | 3668 | | |
| 3669 | + | |
3652 | 3670 | | |
3653 | 3671 | | |
3654 | 3672 | | |
| |||
3731 | 3749 | | |
3732 | 3750 | | |
3733 | 3751 | | |
3734 | | - | |
| 3752 | + | |
3735 | 3753 | | |
3736 | 3754 | | |
3737 | 3755 | | |
3738 | | - | |
3739 | | - | |
3740 | | - | |
3741 | | - | |
| 3756 | + | |
| 3757 | + | |
| 3758 | + | |
| 3759 | + | |
| 3760 | + | |
| 3761 | + | |
3742 | 3762 | | |
3743 | 3763 | | |
3744 | 3764 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
112 | 124 | | |
113 | 125 | | |
114 | 126 | | |
| |||
189 | 201 | | |
190 | 202 | | |
191 | 203 | | |
| 204 | + | |
192 | 205 | | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
| 209 | + | |
201 | 210 | | |
202 | 211 | | |
203 | 212 | | |
| |||
337 | 346 | | |
338 | 347 | | |
339 | 348 | | |
340 | | - | |
| 349 | + | |
341 | 350 | | |
342 | 351 | | |
343 | 352 | | |
| |||
482 | 491 | | |
483 | 492 | | |
484 | 493 | | |
| 494 | + | |
| 495 | + | |
485 | 496 | | |
486 | 497 | | |
487 | 498 | | |
488 | 499 | | |
489 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
490 | 504 | | |
491 | 505 | | |
492 | 506 | | |
| |||
529 | 543 | | |
530 | 544 | | |
531 | 545 | | |
532 | | - | |
533 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
534 | 552 | | |
535 | 553 | | |
536 | 554 | | |
| |||
579 | 597 | | |
580 | 598 | | |
581 | 599 | | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
582 | 605 | | |
583 | 606 | | |
584 | 607 | | |
585 | 608 | | |
| 609 | + | |
586 | 610 | | |
587 | 611 | | |
588 | 612 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
0 commit comments