Repository navigation
Closed
Labels
ready-for-agentFully specified, ready for an AFK agentFully specified, ready for an AFK agent
Description
Parent
What to build
A user who writes ~/.thirdshift/credentials.toml (the Credentials) by hand, with
[resend]
key = "re_..."can get a Run notification from a Run or Spec run, and a test email from thirdshift email-test, without setting RESEND_API_KEY. The environment variable still wins when it's set and non-empty. This is how the key reaches Runs started from cron, nohup or an agent's shell (see #190 and ADR 0007).
Start with a prefactor that changes no behaviour: one key-lookup module answers "what's the Resend API key, and where did it come from" (the environment or the Credentials). The email sender and Setup's existing key hint both call it, instead of each reading RESEND_API_KEY themselves. Then add the file fallback.
Acceptance criteria
- Prefactor: every read of the Resend key goes through one lookup module, which reports the key's source. The existing tests pass unchanged after this step alone.
- With
RESEND_API_KEYunset or empty and a key in the Credentials,email-testand a Run or Spec run that asked for a notification send with the file's key. Proved by theAuthorizationheaderResendStandInrecords. - With both set, the environment variable's key is sent.
- With no key anywhere,
email-testand a Run that asked for a notification exit1before any work with the missing-key message from Setup asks for the Resend API key and saves it in a Credentials file #190: runthirdshift setup; or add the key to the Credentials (real path, mode 600) in the shown[resend]/key = "re_..."format; or setRESEND_API_KEYin the environment the Run starts from (a crontab line, CI secret, or a shell profile the Run's shell reads). This replaces today'sRESEND_API_KEY is unset or emptytext. - Invalid TOML, an unknown table or key (e.g.
kye), or a non-stringkeyin the Credentials stopsemail-test, or a Run that needs the key, before any work with exit1, naming the file and the offending key. No notification is sent. - A Credentials file readable by group or others is still used, with a
warning:line on stderr saying tochmod 600it. - A missing Credentials file is not an error; it just means no key from the file.
- A Run without a notification succeeds with a broken Credentials file present, and
update,versionandhelpnever read it. - The README's Email and Run notifications sections describe the Credentials, the lookup order and the new missing-key message.
- Tests go through the binary with the
tests/supportharness, followingtests/email_test.rsandtests/run_notification.rs. The lookup module gets no unit tests of its own.
Blocked by
None (can start immediately)
Metadata
Metadata
Assignees
Labels
ready-for-agentFully specified, ready for an AFK agentFully specified, ready for an AFK agent
Activity
Merge origin/main into email-setup