Preserve auto-report compatibility and doctor draft handoff#145
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Non-technical summary
This fixes a reliability bug in clauck's auto-report surface. Older installs that still have
"auto_report": "draft"in config no longer crash the CLI, andclauck doctor --drynow queues the background draft before handing off todoctor --fixwhen you accept the suggested fix.Why this matters now: issue #125 is still open on
main, and both failure modes undermine clauck's inspectability. One bricks routine CLI usage after a legacy config write; the other silently drops the durable report on the most common interactive fix path.The system is better afterward because report compatibility is preserved across config shape changes, and doctor no longer loses the auto-draft during an immediate fix handoff.
Technical summary
lib/clauckthat accepts both legacy scalar config ({"auto_report": "draft"}) and the nestedauto_report.modeshape._notify_pending_auto_reports(),_write_auto_draft(), andcmd_status()through that normalizer so CLI entry, status output, and draft writes all stay compatible.os.execvp()when the user accepts the queued fix.tests/test_clauck_report.pyfor:cmd_status()_write_auto_draft()and_notify_pending_auto_reports()Relevant intent: this preserves inspectability and trust-via-proof by keeping report surfaces usable across config evolution and by ensuring doctor findings are durably recorded even when the operator immediately opts into the fix path.
Tests:
python3 -m unittest -v tests.test_clauck_reportpython3 -m unittest discover tests -vBreaking changes: none intended.
Additional notes
Trade-off: invalid non-string/non-mapping
auto_reportvalues now normalize tooffinstead of raising. That favors CLI survivability over surfacing malformed config as a hard crash.Deferred follow-up: this does not rewrite old config files in place; it preserves compatibility at read time only.
Remaining gap: if we later want stricter config validation, that should happen as an explicit migration or
clauck configrepair path rather than by breaking reads again.