Repository navigation
Wait for the restarted server after setup, and store the setup with one precedence rule - #643
Merged
Merged
Conversation
…ne precedence rule - setup.status and setup.initialize return a boot_id, random and drawn once per process. The setup page waits for setup.status to answer another one than the process that handled setup.initialize: that process still answers 200 while it drains, which showed "Notifuse is ready" before the restart. - Initialize stores the request with the environment applied field by field for every group, where it took a group set by the environment from the environment only. A field the environment leaves empty is now stored from the request, as the runtime fills it from the database. Validation checks that merged value for every group, so an incomplete SSO or a half-filled SMTP login sent for an env-set group is refused instead of being stored.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #643 +/- ##
==========================================
- Coverage 90.46% 90.46% -0.01%
==========================================
Files 390 390
Lines 76569 76506 -63
==========================================
- Hits 69271 69211 -60
+ Misses 4740 4738 -2
+ Partials 2558 2557 -1
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.
Follow-up of #638 (plan: Notifuse/architecture,
plans/notifuse/setup-wizard-followups-plan.md, decisions D2 and D3).Restart wait (D2)
After
setup.initialize, the process that handled it shuts down 500 ms later and keeps answeringsetup.statuswith 200 while it drains; the page took the first 200 as « Notifuse is ready ».setup.statusandsetup.initializereturnboot_id, a random UUID drawn once per process (nothing about the host or the time).setup.statusto answer anotherboot_idthan the onesetup.initializereturned. It compares against the process that handled the request, not the status read on opening the page: a restart while the form is being filled would otherwise end the wait at once.boot_idto compare (an older server), it keeps the former 2 s pause.One precedence rule in
Initialize(D3)Initializetook a group set by the environment from the environment only, beside the field-by-field merge #638 added for validation. It now stores the merged request for every group: a non-empty variable wins, the request fills the rest, as the runtime fills it from the database.SMTP_HOST,SMTP_PORT,SMTP_FROM_EMAILset, noSMTP_FROM_NAME, a script sendssmtp_from_name: "Acme": « Acme » is stored and used, where it was ignored. The same holds forsmtp_use_tlswhenSMTP_USE_TLSis unset.OIDC_CLIENT_IDis set (which the boot would refuse), is refused at setup.TestSetupServiceCoverage_ValidateSetupConfig_ExactErrorspinned the former skip and is updated.Not changed (review notes)
boot_idis also returned after install, by the publicsetup.status: the page needs it from the restarted, installed server. It shows when the process restarts, nothing else.Tests
go test ./internal/service/ ./internal/http/ ./config/, with tests that fail on the former code (checked by running them against it).INTEGRATION_TESTS=true go test -tags integration,licdev ./tests/integration/ -run TestSetupWizard:setup.initializeanswers theboot_idits process gave insetup.status; the app started after the simulated restart answers another.cd console && npx vitest run src/pages/SetupWizard.test.tsx src/components/setup: the wait ignores the oldboot_idand stops on a new one (fake timers).