fix: harden maintenance recovery handling - #323
Open
Tiancheng-Xu wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The changes are small, align with the stated maintenance-mode boundaries, and include focused regression coverage for the adjusted SSR vs browser behavior.
Pull request overview
This PR hardens the “maintenance mode” recovery flow so that the app only enters maintenance mode for browser-side HTTP 503 responses, while SSR and non-503 failures continue through the regular error handling path. It also improves recovery polling behavior and adds targeted regression tests to lock these boundaries in.
Changes:
- Narrow maintenance-mode triggering to 503 responses only when a real browser
windowis present (avoids SSR triggering). - Preserve polling errors for diagnostics during maintenance by logging failures, while still reloading only on a healthy status response.
- Add a regression test ensuring SSR-like 503 handling stays on the normal error path.
File summaries
| File | Description |
|---|---|
src/services/base-api.service.ts |
Restricts maintenance triggering to browser runtime by checking globalThis.window for non-null/defined. |
src/components/maintenance.tsx |
Logs polling failures for diagnostics and adjusts overlay layout width. |
src/__tests__/maintenance.spec.tsx |
Adds coverage to ensure server-side 503 responses do not trigger maintenance mode behavior. |
Review details
- Files reviewed: 3/3 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 to #314 after rebasing the maintenance fixes onto the current
devbranch.Changes
Validation
pnpm test --run src/__tests__/maintenance.spec.tsx— 11 passedpnpm format:check— passedpnpm typecheck— passed after the repository build generated Next typesnext build --webpackwith non-secret local validation placeholders — passedgit diff --check origin/dev...HEAD— passed