Skip to content

Show refused fields and failed SMTP tests in the setup summary, and prefill the sign-in - #646

Merged
pierre-b merged 2 commits into
devfrom
fix/setup-wizard-polish
Nov 18, 2026
Merged

pierre-b merged 2 commits into
devfrom
fix/setup-wizard-polish

Conversation

@pierre-b

@pierre-b pierre-b commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Four defects found by running the setup page on a fresh instance (empty databases, no configuration in the environment, local Mailpit as SMTP).

What changes

  1. A refused field is not « Complete ». With admin@ as root email the field showed « Invalid email: admin@ » while the panel and the summary said « Complete » (the submit was refused). A panel whose rules refuse a filled field now reads « N fields to fix » (danger), in its header and in the summary. The errors are read from the form at each render, so a field that unmounts drops its errors with it.
  2. A failed SMTP test shows in the summary. The panel said « Test failed » while the summary said « Email delivery: Complete ». Both now say « Test failed » (it wins over a field to fix, as the panel's alert does), until a tested value changes. Still not blocking: an operator may complete the setup with a server the test cannot reach yet.
  3. The sign-in page prefills the root email. « Notifuse is ready — Sign in with admin@… » led to an empty sign-in form. The setup page hands the first root email to the sign-in page in session storage (not in the URL: an address in a query string reaches server logs, and ?email= sends a code at once). The page prefills it without sending a code; ?email= and demo mode still win.
  4. The reload is not a « Server error ». When setup or the system settings stop the server to load a new configuration, runServer logged "level":"error" … "Server error" … "http: Server closed". It now logs it as information and still returns the error, so the process exits with code 1 and a restart policy that restarts on failure only starts it again.

Not handled here (pre-existing, flagged for a decision)

When the app closes its own server (setup, system settings), ListenAndServe returns as soon as App.Shutdown reaches server.Shutdown, and main exits while App.Shutdown still waits for requests in flight, the automation scheduler and email queue worker (startLongStops), the background goroutines and cleanupResources. A settings restart during sends cuts that tail short. Unchanged by this PR; it touches the shutdown flow documented in the architecture repository.

Checks

  • tsc, eslint src, go vet ./cmd/api and go test ./cmd/api pass; the console suite passes (two untouched files hit the 5 s timeout once under load and pass on their own).
  • New tests checked by mutation; the runServer test fails without the fix.
  • Browser pass in Chrome on a fresh instance (http://localhost:4100, its own databases): invalid root email → « 1 field to fix »; STARTTLS refused by Mailpit → « Test failed » in the summary, cleared by switching TLS off; setup completed, server restarted, sign-in page prefilled with no code sent; log line at info level.

…refill the sign-in

The setup page marked a panel « Complete » while its rules refused a filled
field (an invalid root email), and the summary said « Complete » for email
delivery after a failed connection test. A panel with a refused field now
reads « N fields to fix », and a failed test reads « Test failed » in the
summary too, until a tested value changes.

After the setup, the sign-in page prefills the root email it was told to
sign in with, without sending a code (handed over in session storage, not
in the URL).

The server stopping itself to load a new configuration (setup, system
settings) is logged as information, not as « Server error »; it still exits
with a failure code so that any restart policy starts it again.
@pierre-b
pierre-b merged commit 759df47 into dev Nov 18, 2026
13 checks passed
@codecov

codecov Bot commented Nov 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.46%. Comparing base (182137b) to head (42b7bb2).
⚠️ Report is 3 commits behind head on dev.

Additional details and impacted files
@@           Coverage Diff           @@
##              dev     #646   +/-   ##
=======================================
  Coverage   90.46%   90.46%           
=======================================
  Files         391      391           
  Lines       76560    76560           
=======================================
  Hits        69261    69261           
  Misses       4740     4740           
  Partials     2559     2559           
Flag Coverage Δ
unit 90.46% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pierre-b
pierre-b deleted the fix/setup-wizard-polish branch November 18, 2026 20:09
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.

1 participant