Repository navigation
Setup: edit an existing User config in place - #138
Merged
Merged
Conversation
With toml_edit, Setup keeps an existing User config's values, comments and key order, and adds each key this version knows but the file lacks at its default with its comment. A User config a Run would refuse is refused the same way and left untouched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Setup replaces the User config through a temporary file, keeping its permissions, so a failed write can't truncate it. The commented-out email.to check matches only an [email] header, the unreachable arm says so, and the README notes inline tables and the email.to line. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
Summary
thirdshift setupover an existing User config now edits it in place withtoml_edit(pure Rust, so it builds under musl per ADR-0003), instead of leaving it as it was.Before, with a partial User config:
After
thirdshift setup </dev/null:Evidence
main,setupover an existing User config returns "already set up" after parsing it and writes nothing, so a partial file gains none of its missing keys.After:
cargo testpasses in full, clippy is clean, andtests/setup.rshas 10 of 10 passing, including:1with the same stderr a Run gives, and the file is unchangedlogs.dirsetuptwice adds the commented-outemail.toline only oncecompletecover dotted keys, inline tables, no trailing newline, and trailing comments. They also check that a Run parses the result with the settings it had before, and that runningcompletea second time changes nothing.Merge Danger
Door: two-way
This rewrites users' files, but only by adding lines, and it never rewrites a file that is already complete. Reverting the PR restores the old behavior.
Blast Radius: small
Only
thirdshift setupover an existing User config is affected. A Run,email-test,update,versionandhelpdon't change. The only new dependency istoml_edit.Unaddressed findings
Standards
toml_editAPIs and one drops comments, so a closure-taking helper wouldn't make it clearer.emailsection is special-cased by name (Primitive Obsession). Skipped:email.tois the one key with no default, so the special case is real.has_commented_out_email_torescans the raw text. Partly addressed: it now matches an[email]header exactly. The rescan stays becausetoml_editscatters comments across key decor, the next header and the document trailer.Spec
email.*keys don't get the commented-outemail.toline. Skipped: it's a rare form and there's no natural place for the line. The keys themselves are still added.email.toline is scope creep. Skipped: it keeps "the file lists every key the installed version knows" true, and matches the file Setup writes from scratch.toml_editattaches such comments. The comment is kept, and the settings and their order are unchanged.merge, launch, email, logsorder. Skipped: that order is for new files. Inserting sections between the user's own would move their text.Closes #128
🤖 Generated with Claude Code