Skip to content

Wait for the restarted server after setup, and store the setup with one precedence rule - #643

Merged
pierre-b merged 1 commit into
devfrom
fix/setup-wizard-followups
Nov 18, 2026
Merged

pierre-b merged 1 commit into
devfrom
fix/setup-wizard-followups

Conversation

@pierre-b

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

Copy link
Copy Markdown
Contributor

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 answering setup.status with 200 while it drains; the page took the first 200 as « Notifuse is ready ».

  • setup.status and setup.initialize return boot_id, a random UUID drawn once per process (nothing about the host or the time).
  • The page waits for setup.status to answer another boot_id than the one setup.initialize returned. 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.
  • Without a boot_id to compare (an older server), it keeps the former 2 s pause.

One precedence rule in Initialize (D3)

Initialize took 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.

  • Changes the result for API clients only: the console sends no field of a group the environment sets. Example: SMTP_HOST, SMTP_PORT, SMTP_FROM_EMAIL set, no SMTP_FROM_NAME, a script sends smtp_from_name: "Acme": « Acme » is stored and used, where it was ignored. The same holds for smtp_use_tls when SMTP_USE_TLS is unset.
  • Validation now checks the merged values of every group, so what the request adds to an env-set group is checked too: a half-filled SMTP login, or SSO switched on without an issuer while only OIDC_CLIENT_ID is set (which the boot would refuse), is refused at setup. TestSetupServiceCoverage_ValidateSetupConfig_ExactErrors pinned the former skip and is updated.

Not changed (review notes)

  • boot_id is also returned after install, by the public setup.status: the page needs it from the restarted, installed server. It shows when the process restarts, nothing else.
  • With several replicas behind a load balancer before install, a poll reaching another replica ends the wait early. Not handled here.
  • The wizard still locks a whole panel when the environment sets the group, so the per-field rule is reachable from the API only.

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.initialize answers the boot_id its process gave in setup.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 old boot_id and stops on a new one (fake timers).

…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

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 (32b8bf6) to head (8e01c18).
⚠️ Report is 3 commits behind head on dev.

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     
Flag Coverage Δ
unit 90.46% <100.00%> (-0.01%) ⬇️

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 merged commit c59fdd8 into dev Nov 18, 2026
14 checks passed
@pierre-b
pierre-b deleted the fix/setup-wizard-followups branch November 18, 2026 18:29
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