Skip to content

docs(plans): site offline mode with opening countdown - #925

Merged
aXenDeveloper merged 1 commit into
canaryfrom
claude/fervent-hawking-d0xea5
Nov 23, 2026
Merged

aXenDeveloper merged 1 commit into
canaryfrom
claude/fervent-hawking-d0xea5

Conversation

@aXenDeveloper

Copy link
Copy Markdown
Owner

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01CnAiFaUoKTFF6q9AB82BVD

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T20:56:47.611640Z 07c67be New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added the 📖 Documentation Documentation changes label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 07c67be.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f150134ed9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +71 to +73
throw new HTTPException(400, {
message: "The opening time must be in the future.",
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Return translation keys for site-status validation errors

When server-side validation rejects a save, these English messages reach the user unchanged: runAdminApiMutation reads the response text, and SiteStatusContent displays result.error.message directly in its toast. For example, an opening time that expires between client validation and the API request produces an English error even in the Polish AdminCP. Return stable error keys and translate them in the form instead, as required by AGENTS.md for API output shown in the UI.

AGENTS.md reference: AGENTS.md:L115-L115

Useful? React with 👍 / 👎.

Comment on lines +33 to +34
if (isSiteClosedTo({ pathname, status })) {
markSiteOfflineResponse(status.opensAt);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Apply the offline screen to the existing docs layout

While the site is offline, a guest requesting /docs still receives the documentation rather than the offline screen. The existing apps/web/src/routes/_docs.tsx calls loadMainShell, so this code marks its response as 503, but that route renders DocsShellContent, which uses neither ThemeLayoutContent nor SiteOfflineGate. A repository-wide search confirms there is no other offline gate around the docs shell. Wire the gate into that custom layout so public documentation is actually hidden and does not remain fully readable with an erroneous failure status.

Useful? React with 👍 / 👎.

Comment on lines +79 to +81
const serverNowMs = Date.parse(serverNow);
const offsetMs = fetchedAt ? serverNowMs - fetchedAt : 0;
const now = useServerClock(serverNowMs, offsetMs);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Account for client clock skew after hydrating SSR data

For an SSR-rendered offline page, fetchedAt is TanStack Query's server-generated dataUpdatedAt, so both operands here use the server clock and the calculated offset is approximately zero. After hydration, useServerClock switches to the browser's Date.now(), making the countdown jump by any client clock skew and potentially show “Opening soon” prematurely. The initial query remains fresh for a minute, so this persists until a browser refetch supplies a client-side receipt timestamp. Establish a client/server clock offset during hydration rather than treating the server's query-update timestamp as the browser's receipt time.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5b6ff885ad

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/lib/route.ts Outdated
Comment on lines +195 to +196
if (!allowWhenOffline && !adminStaffPermission) {
middleware.push(siteOfflineGuard());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Exempt password-reset completion from the offline guard

When the site is offline, a signed-out user can request a password-reset email, but cannot complete the reset: changePasswordRoute in packages/api/src/modules/users/routes/change-password.route.ts has neither allowWhenOffline nor adminStaffPermission, so this newly installed guard returns 503 before validating the reset token. The recovery form calls that exact /users/change-password endpoint through changePasswordFromReset. This also prevents an administrator who forgot their password from recovering access during maintenance. Set allowWhenOffline: true on the completion route as well as the email-request route.

Useful? React with 👍 / 👎.

Comment on lines +86 to +89
return (
<SiteStatusContent
canManage={canManage}
data={query.data}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Show a warning when the site-status refetch fails

After the initial status loads, a failed background refetch leaves query.data populated, so this branch silently renders the old settings without indicating that refresh failed or offering a retry. This is particularly misleading after a successful save whose invalidation refetch fails: the mutation reports success while the screen still presents the previous online/offline state. Keep the existing content, but render a warning alert with an in-place retry when query.isError is true, as required by the refetch-error guidance in AGENTS.md.

AGENTS.md reference: AGENTS.md:L80-L80

Useful? React with 👍 / 👎.

@aXenDeveloper
aXenDeveloper force-pushed the claude/fervent-hawking-d0xea5 branch from 5b6ff88 to 065452a Compare November 21, 2026 19:07

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 065452a2a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/lib/route.ts Outdated
Comment on lines +195 to +196
if (!allowWhenOffline && !adminStaffPermission) {
middleware.push(siteOfflineGuard());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exempt deletion-cancellation sign-in from the offline guard

When a signed-out user with a pending account deletion signs in during maintenance, the exempted sign-in endpoint returns an account_deletion_pending token, but completing that flow through /users/sign_in/cancel-deletion now returns 503: cancelDeletionSignInRoute declares neither allowWhenOffline nor an admin permission. This prevents the user from cancelling their scheduled deletion or completing sign-in, even though the login pages remain available. Add allowWhenOffline: true to that completion route so its existing token validation and releaseAccountDeletionHold handler can run.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a7113cd1b5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/api/src/lib/route.ts Outdated
Comment on lines +195 to +196
if (!allowWhenOffline && !adminStaffPermission) {
middleware.push(siteOfflineGuard());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exempt the SSO account-linking step from the offline guard

When a signed-out visitor uses an SSO identity whose email matches an existing account, the exempted callback returns a linkToken, but completing sign-in fails during maintenance. linkRoute in packages/api/src/modules/users/sso/routes/link.route.ts has neither allowWhenOffline nor an admin permission, so this guard returns 503 before its password/token validation can run. Both the browser transport's linkSso and the server auth transport call that endpoint. Add allowWhenOffline: true to the linking route so the SSO flow remains completable, including for administrators linking an identity.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d390eb667a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +183 to +185
await invalidatePageCacheTags([SITE_STATUS_PAGE_CACHE_TAG], {
mode: "hard",
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Invalidate page caches outside the API process

When the frontend runs separately from the API, or web replicas use the default per-process memory page cache, switching the site offline leaves other processes serving cached online HTML with HTTP 200. In the inspected packages/api/src/page-cache/store.server.ts, invalidatePageCacheTags only accesses a store registered on that process's globalThis and returns not-configured when none exists; deleting the domain-cache entry does not invalidate those HTML responses. Propagate the hard invalidation to the frontend cache owners rather than relying solely on this local call. This is the cross-process cache limitation documented in AGENTS.md.

AGENTS.md reference: AGENTS.md:L103-L103

Useful? React with 👍 / 👎.

- Site offline mode: the public site shows a status notice card with an
  optional opening countdown while admins and moderators with the new
  permission keep using it, marked by a staff chip in the header.
- AdminCP: edit the site status inline with a live preview and see the
  offline state in the debug panel.
- API: site offline middleware gates public routes; auth, session and
  passkey routes stay reachable so staff can still sign in.
- Settings: grouped side nav (Account / Preferences / Privacy & safety),
  privacy switches moved to /settings/privacy, settings breadcrumb removed.
- Plan: plans/site-offline-mode.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aXenDeveloper
aXenDeveloper force-pushed the claude/fervent-hawking-d0xea5 branch from 0a6b037 to 07c67be Compare November 22, 2026 20:53

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 07c67bed2c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

return;
}

formApi.reset(formApi.state.values);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve edits made while the site-status save is pending

If an administrator changes a field while onSave is pending, this reset marks the newer, unsent values as saved. The fields remain enabled during submission, while the request contains the earlier values snapshot. For example, changing the maintenance message during a slow save can leave that message displayed with the save footer hidden even though visitors receive the previous message. Disable editing during submission, or reconcile against the submitted values while preserving subsequent edits as dirty.

Useful? React with 👍 / 👎.

@aXenDeveloper
aXenDeveloper merged commit a4c5f05 into canary Nov 23, 2026
7 checks passed
@aXenDeveloper
aXenDeveloper deleted the claude/fervent-hawking-d0xea5 branch November 23, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 Documentation Documentation changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant