oficina / home Public

Mail through rastrillo's FromCarlos, ready for CARLOS platform mail submission (SMTP unchanged until switched)

Re-pinned to the rastrillo patch tag, which adds only mail/. Boots with CARLOS_MAIL=submit and a socket, or on SMTP as before; refuses with neither. Fable APPROVED.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from mail/from-carlos-patch into main.
claude agent, operated by paul@keymail.dev 0731690505849e42b03c2879e7821df0a6fa390b parent 8bde754
8 files changed, +220 −38
  • AGENTS.md +12 −0
  • Makefile +3 −0
  • cmd/home/main.go +4 −2
  • go.mod +1 −1
  • go.sum +2 −4
  • internal/home/credits/notices.json +1 −1
  • internal/home/keys.go +62 −30
  • internal/home/keys_test.go +135 −0

CI passed — run details

CI log
amadan: .amadan/timeout: this job's budget is 20m0s (this runner allows up to 30m0s)
=== vet ===
CGO_ENABLED=0 go vet ./...
CGO_ENABLED=0 go vet -tags browser ./internal/home/
cd handoff && CGO_ENABLED=0 go vet ./...
cd roster && CGO_ENABLED=0 go vet ./...
cd dashboard && CGO_ENABLED=0 go vet ./...
cd connect && CGO_ENABLED=0 go vet ./...
cd teammode && CGO_ENABLED=0 go vet ./...
=== fmt ===
=== build ===
CGO_ENABLED=0 go build ./...
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build ./cmd/home ./cmd/oficina ./internal/operatorlaunch
cd handoff && CGO_ENABLED=0 go build ./...
cd roster && CGO_ENABLED=0 go build ./...
cd dashboard && CGO_ENABLED=0 go build ./...
cd connect && CGO_ENABLED=0 go build ./...
cd teammode && CGO_ENABLED=0 go build ./...
=== go-test ===
CGO_ENABLED=0 go test -count=1 ./...
?   	amadan.net/oficina/home/cmd/home	[no test files]
ok  	amadan.net/oficina/home/cmd/home-placeholder	0.847s
?   	amadan.net/oficina/home/cmd/oficina	[no test files]
ok  	amadan.net/oficina/home/internal/guardstest	0.142s
ok  	amadan.net/oficina/home/internal/home	50.668s
ok  	amadan.net/oficina/home/internal/home/directorydata	1.398s
ok  	amadan.net/oficina/home/internal/home/logtest	0.004s
ok  	amadan.net/oficina/home/internal/home/seal	0.003s
ok  	amadan.net/oficina/home/internal/home/sealtest	0.003s
ok  	amadan.net/oficina/home/internal/home/wisp	0.044s
ok  	amadan.net/oficina/home/internal/operator	6.385s
ok  	amadan.net/oficina/home/internal/operatorlaunch	4.114s
ok  	amadan.net/oficina/home/internal/provisioner	48.776s
cd handoff && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/handoff	0.658s
ok  	amadan.net/oficina/home/handoff/seal	0.002s
cd roster && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/roster	5.119s
cd dashboard && CGO_ENABLED=0 go test ./...
ok  	amadan.net/oficina/home/dashboard	(cached)
cd connect && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/connect	1.345s
ok  	amadan.net/oficina/home/connect/linkstore	0.423s
cd teammode && CGO_ENABLED=0 go test -count=1 ./...
ok  	amadan.net/oficina/home/teammode	0.102s
?   	amadan.net/oficina/home/teammode/teammodetest	[no test files]
=== race ===
go test -race -count=1 ./internal/home/ ./internal/operator/ ./internal/operatorlaunch/ ./internal/home/directorydata/
ok  	amadan.net/oficina/home/internal/home	388.292s
ok  	amadan.net/oficina/home/internal/operator	82.705s
ok  	amadan.net/oficina/home/internal/operatorlaunch	22.397s
ok  	amadan.net/oficina/home/internal/home/directorydata	23.657s
ok  	amadan.net/oficina/home/internal/provisioner	420.185s
cd handoff && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/handoff	12.808s
ok  	amadan.net/oficina/home/handoff/seal	1.014s
cd roster && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/roster	6.916s
cd dashboard && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/dashboard	1.064s
cd connect && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/connect	5.945s
ok  	amadan.net/oficina/home/connect/linkstore	6.327s
cd teammode && CGO_ENABLED=1 go test -race -count=1 ./...
ok  	amadan.net/oficina/home/teammode	1.946s
?   	amadan.net/oficina/home/teammode/teammodetest	[no test files]
diff --git a/AGENTS.md b/AGENTS.md
index fe6540c..943e157 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -357,6 +357,18 @@ quietly ignored).
- A 200 is not a deploy verification. Only `X-Carlos-Version` on the
canonical host, after the watch.
- A promote is not a deploy. Until the process cycles, the old binary serves.
+- **Ship with `--mail submit`.** It declares that the build sends through
+ CARLOS mail submission (`mail.FromCarlos`, `loadMailer` in
+ `internal/home/keys.go`, From `$CARLOS_MAIL_FROM`). Until `carlos email
+ submission on --app home` runs, Home keeps sending over `CARLOS_SMTP_*`
+ and still refuses to boot without `CARLOS_SMTP_PASS`; after it the agent
+ sets `CARLOS_MAIL=submit`, Home holds no mail credential, and every
+ instance must run a build shipped with the flag. `carlos deploy` has no
+ `--mail` flag yet (carlos main 9eec0236), so ship and promote:
+ `carlos ship --app home --account oficina --mail submit --version <v>
+ --target linux-arm64 releases/home-linux-arm64`, then `carlos promote
+ --app home --account oficina <v>` (or `carlos deploy --mail submit`
+ once that ships).
- **The home does not hibernate.** It is the one app on the estate where
cold-wake latency is a suite-wide outage. Stated because hibernation is
the platform default and would otherwise apply silently.
diff --git a/Makefile b/Makefile
index 8fbf2c5..1cf4200 100644
--- a/Makefile
+++ b/Makefile
@@ -53,6 +53,9 @@ release:
@echo "built $(RELEASE_BIN) reporting version $(VERSION)"
@echo "publish it with:"
@echo " amadan release create -repo oficina/$(APP) -notes-file NOTES.md $(VERSION) $(RELEASE_BIN)"
+ @echo "ship it declaring CARLOS mail submission, then promote it (AGENTS.md, Deploys):"
+ @echo " carlos ship -app $(APP) -mail submit -version $(VERSION) -target $(RELEASE_GOOS)-$(RELEASE_GOARCH) $(RELEASE_BIN)"
+ @echo " carlos promote -app $(APP) $(VERSION)"
# The gate, split into named targets so CI can report them individually
# (.amadan/ci.d calls these one at a time, each its own step). `make
diff --git a/cmd/home/main.go b/cmd/home/main.go
index 0610f93..8b78516 100644
--- a/cmd/home/main.go
+++ b/cmd/home/main.go
@@ -22,8 +22,10 @@
// platform path and the flag still wins locally.
//
// THIS BINARY REFUSES TO START WITHOUT ITS SECRETS: HOME_DEK,
-// HOME_PEPPER, HOME_SIGNIN_KEY, CARLOS_SMTP_PASS and the SMTP host and
-// from address. That is deliberate — every one of those absences
+// HOME_PEPPER, HOME_SIGNIN_KEY, and a mail channel: CARLOS mail
+// submission (CARLOS_MAIL=submit, set by the agent), or
+// CARLOS_SMTP_PASS and the SMTP host and from address. That is
+// deliberate — every one of those absences
// produces an app that answers /healthz and is broken or leaking.
//
// What that costs, stated plainly: the unit is Restart=always, and the
diff --git a/go.mod b/go.mod
index a680404..dc20303 100644
--- a/go.mod
+++ b/go.mod
@@ -9,7 +9,7 @@ require (
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816
amadan.net/oficina/home/handoff v0.0.0-20261114110939-e03a01a1881c
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4
- amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd
+ amadan.net/rastrillo/rastrillo v0.26.1
filippo.io/age v1.3.2
github.com/chromedp/cdproto v0.0.0-20250724212937-08a3db8b4327
github.com/chromedp/chromedp v0.14.2
diff --git a/go.sum b/go.sum
index e9041b2..5852733 100644
--- a/go.sum
+++ b/go.sum
@@ -4,14 +4,12 @@ amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d h1:p9+01xRdBD7s
amadan.net/oficina/estilo.git v0.0.0-20261025200559-260f98c42e2d/go.mod h1:4u0jNBtIdMLOsJyrScfqoEuYDJF7BBM3qM9YWbzt6aw=
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816 h1:AFDuOio0MxNxN9ZWVc3lul1QHkNjNUCO56kXpe/Fw3I=
amadan.net/oficina/home/dashboard v0.0.0-20261024234842-3774eb68f816/go.mod h1:+7xsX+QyVFrKy5gDAGh+FZ5+75z4CibWTL0wl9DWAw0=
-amadan.net/oficina/home/handoff v0.0.0-20261027235000-69ea999ccbf7 h1:F0wJpR9hBz5CBfCdw80TuBu0Ufioh+tmpODB9Y7ifH0=
-amadan.net/oficina/home/handoff v0.0.0-20261027235000-69ea999ccbf7/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
amadan.net/oficina/home/handoff v0.0.0-20261114110939-e03a01a1881c h1:KxjjyIlEu3hY1G6l26IrI2PRcogOscpTeydRgNzimbA=
amadan.net/oficina/home/handoff v0.0.0-20261114110939-e03a01a1881c/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4 h1:jg3sS7hy8Qaewrv/7CZ4kjIYE62FaIG4KMlfNs918dY=
amadan.net/oficina/home/roster v0.0.0-20261028165624-d942439ac4e4/go.mod h1:gqshuXyDtFZUCYbhuZyV3Epc51pUcsLbpqAqiA5UiXg=
-amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd h1:jlFSt95M1ontOg+VePU+kIJpChtWqDQAbnmlxqCnbgc=
-amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd/go.mod h1:RpyHVPD0udcSfHJroY0KZE/FUjgw6Tvfo8SJm2qeZGE=
+amadan.net/rastrillo/rastrillo v0.26.1 h1:PpTqWMY4a0EpzTW4U0mQ+0ATE1Oms5BSRc9zV6kil88=
+amadan.net/rastrillo/rastrillo v0.26.1/go.mod h1:RpyHVPD0udcSfHJroY0KZE/FUjgw6Tvfo8SJm2qeZGE=
c2sp.org/CCTV/age v0.0.0-20260829155415-4448f2097b2d h1:Blprhc2SbChNZtWcU+BLTM4YdoqYAS9V7cJgOwJKyAs=
c2sp.org/CCTV/age v0.0.0-20260829155415-4448f2097b2d/go.mod h1:SrHC2C7r5GkDk8R+NFVzYy/sdj0Ypg9htaPXQq5Cqeo=
filippo.io/age v1.3.2 h1:r6RSZLFSMm6rzKepZ7ZAYkKCu14f3/Me8c7uKYh7C8c=
diff --git a/internal/home/credits/notices.json b/internal/home/credits/notices.json
index 0631e6c..13c8d3e 100644
--- a/internal/home/credits/notices.json
+++ b/internal/home/credits/notices.json
@@ -46,7 +46,7 @@
},
{
"Name": "amadan.net/rastrillo/rastrillo",
- "Version": "v0.26.1-0.20260908075707-29e4491631bd",
+ "Version": "v0.26.1",
"SourceURL": "https://amadan.net/rastrillo/rastrillo",
"Notices": [
{
diff --git a/internal/home/keys.go b/internal/home/keys.go
index 927b0e1..ab437e8 100644
--- a/internal/home/keys.go
+++ b/internal/home/keys.go
@@ -98,13 +98,14 @@ func key32(name string) ([32]byte, error) {
return out, nil
}
-// LoadSecrets reads the four secrets and the three settings whose
+// LoadSecrets reads the three secrets and the mail channel whose
// absence is silent, and refuses to boot on any of them.
//
// HOME_DEK seals link state, team names and queue payloads
// HOME_PEPPER the blind index
// HOME_SIGNIN_KEY seals signin.Flow's Keymail pending blob
-// CARLOS_SMTP_PASS the mailer's credential
+// mail CARLOS mail submission (CARLOS_MAIL=submit), or
+// CARLOS_SMTP_HOST, _FROM and _PASS (loadMailer)
//
// dbPath is passed in rather than read from the environment because
// rastrillo.Resolve owns it, and it is checked here so that every boot
@@ -150,28 +151,61 @@ func LoadSecrets(dbPath string, logger *slog.Logger) (Secrets, error) {
return Secrets{}, err
}
- // mail.FromEnv falls back to mail.Logged with a warning when HOST or
- // FROM is absent, and Logged's Send logs "to", to — an address into
- // platform-held logs on every single sign-in. A warning is not
- // enough: that log is storage we cannot grep or redact, so this is
- // the one fallback we refuse instead of accept.
- //
- // CARLOS_SMTP_PASS is a different failure and is refused for a
- // different reason, so the message below distinguishes them. It
- // leaks nothing: with HOST and FROM set, FromEnv returns the SMTP
- // sender whether or not PASS is present. What a missing PASS costs
- // is delivery — every link fails at send time on an app that
- // otherwise looks healthy. (It is inert without CARLOS_SMTP_USER,
- // which `carlos email enable` delivers alongside it; refusing on
- // PASS is a bet that the platform sets both or neither.)
- //
- // Deliberately no loopback relaxation. Sheets' LoadAuthEnv allows
- // one for local development, keyed on its instance origin being an
- // http loopback host. The home has no origin variable at this step,
- // so the equivalent carve-out would have to invent one, and a
- // carve-out that turns off the leak guard is not a thing to invent
- // in passing. Local development without SMTP is deferred until
- // there is somewhere to put it.
+ s.Mailer, err = loadMailer(logger)
+ if err != nil {
+ return Secrets{}, err
+ }
+
+ return s, nil
+}
+
+// loadMailer builds the magic-link sender through rastrillo's
+// mail.FromCarlos, from one of two channels, and refuses to boot with
+// neither.
+//
+// CARLOS mail submission: the agent sets CARLOS_MAIL=submit beside its
+// control socket and admin token, and the platform delivers the From as
+// CARLOS_MAIL_FROM (the stem of Home's declared CARLOS_SMTP prefix).
+// The instance then holds no mail credential at all, which is why
+// CARLOS_SMTP_PASS is not asked for on this channel. FromCarlos refuses
+// a submission missing its socket, token or From, so a half-switched
+// instance stops here rather than at its first sign-in.
+//
+// SMTP: exactly the checks this function has always made, in the same
+// order with the same reasons.
+//
+// mail.FromEnv falls back to mail.Logged with a warning when HOST or
+// FROM is absent, and Logged's Send logs "to", to — an address into
+// platform-held logs on every single sign-in. A warning is not enough:
+// that log is storage we cannot grep or redact, so this is the one
+// fallback we refuse instead of accept. FromCarlos has no such
+// fallback, and it is only reached once the refusals below have passed.
+//
+// CARLOS_SMTP_PASS is a different failure and is refused for a
+// different reason, so the message below distinguishes them. It leaks
+// nothing: with HOST and FROM set, the SMTP sender is built whether or
+// not PASS is present. What a missing PASS costs is delivery — every
+// link fails at send time on an app that otherwise looks healthy. (It
+// is inert without CARLOS_SMTP_USER, which `carlos email enable`
+// delivers alongside it; refusing on PASS is a bet that the platform
+// sets both or neither.)
+//
+// Deliberately no loopback relaxation. Sheets' LoadAuthEnv allows one
+// for local development, keyed on its instance origin being an http
+// loopback host. The home has no origin variable at this step, so the
+// equivalent carve-out would have to invent one, and a carve-out that
+// turns off the leak guard is not a thing to invent in passing. Local
+// development without SMTP is deferred until there is somewhere to put
+// it.
+//
+// Called only from LoadSecrets, so only where Home serves: a CARLOS
+// seed or `cmd` one-shot has no control socket and the agent strips
+// CARLOS_MAIL from it, and Home's own one-shots (team-keygen,
+// operator-v1) return before LoadRuntime.
+func loadMailer(logger *slog.Logger) (mail.Sender, error) {
+ if os.Getenv("CARLOS_MAIL") == "submit" {
+ return mail.FromCarlos("CARLOS", logger)
+ }
var leaking, undeliverable []string
for _, name := range []string{"CARLOS_SMTP_HOST", "CARLOS_SMTP_FROM"} {
if strings.TrimSpace(os.Getenv(name)) == "" {
@@ -182,16 +216,14 @@ func LoadSecrets(dbPath string, logger *slog.Logger) (Secrets, error) {
undeliverable = append(undeliverable, "CARLOS_SMTP_PASS")
}
if len(leaking) > 0 {
- return Secrets{}, fmt.Errorf(
- "mail is not configured: %s not set, so magic links would be written to the log instead of emailed. Run `carlos email enable --app home`",
+ return nil, fmt.Errorf(
+ "mail is not configured: CARLOS_MAIL is not \"submit\" and %s not set, so magic links would be written to the log instead of emailed. Run `carlos email enable --app home`",
strings.Join(leaking, ", "))
}
if len(undeliverable) > 0 {
- return Secrets{}, fmt.Errorf(
+ return nil, fmt.Errorf(
"mail is not configured: %s not set, so every magic link would fail at send time. Run `carlos email enable --app home`",
strings.Join(undeliverable, ", "))
}
- s.Mailer = mail.FromEnv("CARLOS", logger)
-
- return s, nil
+ return mail.FromCarlos("CARLOS", logger)
}
diff --git a/internal/home/keys_test.go b/internal/home/keys_test.go
index 3d0a6b5..5a81563 100644
--- a/internal/home/keys_test.go
+++ b/internal/home/keys_test.go
@@ -1,11 +1,18 @@
package home
import (
+ "context"
"encoding/base64"
"io"
"log/slog"
+ "net"
+ "net/http"
+ "os"
+ "path/filepath"
"strings"
"testing"
+
+ "amadan.net/rastrillo/rastrillo/mail"
)
// b64 is a valid, correctly-sized value for whichever secret needs one.
@@ -35,6 +42,12 @@ func setSecretEnv(t *testing.T, overrides map[string]string) {
"CARLOS_SMTP_HOST": "smtp.example.invalid",
"CARLOS_SMTP_FROM": "home@example.invalid",
"CARLOS_SMTP_PASS": "hunter2",
+ // CARLOS mail submission's variables, cleared by default so a
+ // case is on SMTP unless it says otherwise.
+ "CARLOS_MAIL": "",
+ "CARLOS_CONTROL_SOCKET": "",
+ "CARLOS_ADMIN_TOKEN": "",
+ "CARLOS_MAIL_FROM": "",
}
for k, v := range complete {
if o, ok := overrides[k]; ok {
@@ -213,3 +226,125 @@ func TestNewRefusesIncompleteWiring(t *testing.T) {
t.Fatalf("New refused complete wiring: %v", err)
}
}
+
+// CARLOS platform mail submission (carlos plan Task 9). Once Home is
+// switched, the agent sets CARLOS_MAIL=submit beside its control
+// socket and admin token, the platform delivers CARLOS_MAIL_FROM, and
+// the five CARLOS_SMTP_* leave the bundle: no HOST, no FROM, no PASS.
+
+// smtpGone is a switched instance's bundle: none of the SMTP five.
+var smtpGone = map[string]string{"CARLOS_SMTP_HOST": "",
+ "CARLOS_SMTP_FROM": "", "CARLOS_SMTP_PASS": ""}
+
+// switched is smtpGone plus the overrides.
+func switched(overrides map[string]string) map[string]string {
+ out := map[string]string{}
+ for k, v := range smtpGone {
+ out[k] = v
+ }
+ for k, v := range overrides {
+ out[k] = v
+ }
+ return out
+}
+
+// mailVerb stands in for the agent's control socket, answering POST
+// /v1/mail and reporting each request's method and path.
+func mailVerb(t *testing.T) (string, chan string) {
+ t.Helper()
+ // A short directory: a unix socket path has a 104-byte limit.
+ dir, err := os.MkdirTemp("/tmp", "home-mail")
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Cleanup(func() { os.RemoveAll(dir) })
+ socket := filepath.Join(dir, "control.sock")
+ listener, err := net.Listen("unix", socket)
+ if err != nil {
+ t.Fatal(err)
+ }
+ paths := make(chan string, 1)
+ server := &http.Server{Handler: http.HandlerFunc(
+ func(w http.ResponseWriter, r *http.Request) {
+ paths <- r.Method + " " + r.URL.Path
+ w.Write([]byte(`{"message_id":"m-1"}`))
+ })}
+ go server.Serve(listener)
+ t.Cleanup(func() { server.Close() })
+ return socket, paths
+}
+
+// A switched Home boots with no SMTP variable at all, CARLOS_SMTP_PASS
+// included, and its sign-in goes to the agent's mail verb.
+func TestLoadSecretsBootsOnMailSubmission(t *testing.T) {
+ socket, paths := mailVerb(t)
+ setSecretEnv(t, switched(map[string]string{
+ "CARLOS_MAIL": "submit", "CARLOS_CONTROL_SOCKET": socket,
+ "CARLOS_ADMIN_TOKEN": "token",
+ "CARLOS_MAIL_FROM": "noreply@oficina.works"}))
+ got, err := LoadSecrets("/tmp/home.db", quietLogger())
+ if err != nil {
+ t.Fatalf("a switched Home refused to boot: %v", err)
+ }
+ if err := got.Mailer.Send(context.Background(), "ana@example.com",
+ "Sign in", "link"); err != nil {
+ t.Fatal(err)
+ }
+ if path := <-paths; path != "POST /v1/mail" {
+ t.Fatalf("the sign-in went to %s, not the mail verb", path)
+ }
+}
+
+// SMTP alone is what Home has always booted on, unchanged.
+func TestLoadSecretsBootsOnSMTPAlone(t *testing.T) {
+ setSecretEnv(t, nil)
+ got, err := LoadSecrets("/tmp/home.db", quietLogger())
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !mail.IsConfigured(got.Mailer) {
+ t.Fatal("SMTP is configured but the sender only logs")
+ }
+}
+
+// With neither channel Home refuses, naming both ways out.
+func TestLoadSecretsRefusesWithNeitherChannel(t *testing.T) {
+ setSecretEnv(t, smtpGone)
+ _, err := LoadSecrets("/tmp/home.db", quietLogger())
+ if err == nil {
+ t.Fatal("booted with no mail channel, so links would be logged")
+ }
+ for _, want := range []string{"CARLOS_MAIL", "CARLOS_SMTP_HOST"} {
+ if !strings.Contains(err.Error(), want) {
+ t.Errorf("refusal %q does not name %s", err, want)
+ }
+ }
+}
+
+// A submission missing any part the agent delivers is a boot refusal,
+// never SMTP or logged mail in its place: not even with the SMTP five
+// still in the bundle.
+func TestLoadSecretsRefusesHalfASubmission(t *testing.T) {
+ socket, _ := mailVerb(t)
+ whole := map[string]string{"CARLOS_MAIL": "submit",
+ "CARLOS_CONTROL_SOCKET": socket, "CARLOS_ADMIN_TOKEN": "token",
+ "CARLOS_MAIL_FROM": "noreply@oficina.works"}
+ for _, missing := range []string{"CARLOS_CONTROL_SOCKET",
+ "CARLOS_ADMIN_TOKEN", "CARLOS_MAIL_FROM"} {
+ t.Run(missing, func(t *testing.T) {
+ env := map[string]string{}
+ for k, v := range whole {
+ env[k] = v
+ }
+ env[missing] = ""
+ setSecretEnv(t, env)
+ _, err := LoadSecrets("/tmp/home.db", quietLogger())
+ if err == nil {
+ t.Fatalf("booted on submission with no %s", missing)
+ }
+ if !strings.Contains(err.Error(), missing) {
+ t.Errorf("refusal %q does not name %s", err, missing)
+ }
+ })
+ }
+}