Repository navigation
Show refused fields and failed SMTP tests in the setup summary, and prefill the sign-in - #646
Merged
Merged
Conversation
…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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
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
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.?email=sends a code at once). The page prefills it without sending a code;?email=and demo mode still win.runServerlogged"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),
ListenAndServereturns as soon asApp.Shutdownreachesserver.Shutdown, andmainexits whileApp.Shutdownstill waits for requests in flight, the automation scheduler and email queue worker (startLongStops), the background goroutines andcleanupResources. 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/apiandgo test ./cmd/apipass; the console suite passes (two untouched files hit the 5 s timeout once under load and pass on their own).runServertest fails without the fix.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.