Skip to content

Setup: suggest the GitHub email for email.to - #137

Merged
JacobStephens2 merged 2 commits into
mainfrom
issue-129
Sep 29, 2026
Merged

JacobStephens2 merged 2 commits into
mainfrom
issue-129

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Setup now suggests an address for email.to instead of always writing it commented out.

 config::setup()                       # no User config, no terminal
   write DEFAULTS
+    with email.to = suggested_address()
+      gh api user → public profile email
+      else git config --global user.email, unless @users.noreply.github.com
+      else None → the commented-out `# to = …` line, as before

Only Setup looks the address up. A Run never does, so --email with no address and no email.to still stops the Run. Setup never asks gh for extra scopes. An existing User config is still left as it is, so an email.to that is already set is never replaced.

The fake gh now answers api user with a public email or null (user_email), and gh fake fails 'api user' makes it fail. Scenario has three new helpers: github_email_is, github_profile_fails and git_email_is.

Evidence

  • Before: thirdshift setup always wrote # to = "you@example.com", even when gh api user knew the address.
    After: tests/setup.rs passes 13/13, including these new tests:
    setup_writes_the_public_github_email_as_email_to        gh email → to = "octo@example.com"
    with_no_public_github_email_setup_writes_the_git_email  null → git user.email
    when_gh_api_user_fails_setup_writes_the_git_email       gh fails → git user.email
    a_noreply_git_email_is_never_written                    noreply → commented-out line
    with_neither_email_setup_writes_email_to_commented_out
    setup_never_replaces_an_existing_email_to
    a_run_…_still_needs_an_address_for_email                also asserts the Run makes no gh calls
    
    The unit test a_suggested_address_sets_email_to_in_place_of_the_commented_out_line checks TOML quoting and comment alignment. The full cargo test passes and clippy is clean.

Merge Danger

Door: two-way

The change only affects how a new User config is written. Reverting it brings back the commented-out line.

Blast Radius: small

Only thirdshift setup on a machine with no User config is affected. It now makes one extra gh api user call, and if that call fails Setup falls back to git.

Unaddressed findings

Standards

  • suggested_address builds its own Git and calls github directly instead of accepting dependencies: thirdshift setup #126 says "No new seam goes into the production code". The fake gh and the Scenario gitconfig are the seam this repo already uses.
  • config.rs now shells out, a mild Divergent Change: the suggestion belongs to Setup, and Setup lives in config.rs. Moving it would split Setup across modules for one function.
  • NO_EMAIL_TO copies a line of DEFAULTS: a unit test asserts that DEFAULTS contains that line exactly, so the replacement can't silently stop matching.

Spec

  • No test for an existing config that lacks email.to: Setup doesn't edit existing files yet. Whether a suggestion fills a missing key belongs to the issue that adds key-merging.
  • git_email_is(None) panics if the key is already unset: every Scenario sets user.email, so this can't happen today.
  • The noreply check ignores case, and the README was updated: both kept on purpose. They are hardening and documentation, not new behaviour.

Closes #129

🤖 Generated with Claude Code

JacobStephens2 and others added 2 commits September 29, 2026 22:52
The public profile email from gh api user, else the global git user.email
unless it is a @users.noreply.github.com address; with neither, email.to
stays commented out. A Run never looks it up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit 938dfaa into main Sep 29, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-129 branch September 29, 2026 23:03
@JacobStephens2 JacobStephens2 mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Setup: suggest the GitHub email for email.to

1 participant