@connextar/house 0.22.2 → 0.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -1643,8 +1643,10 @@ cronPrefix?, apiPrefix? })` → the response to send during a window, or
|
|
|
1643
1643
|
- `<MaintenanceBanner appName="AltEd" />` — at the top of the root layout. Drawn
|
|
1644
1644
|
after load from the state route, so a page built ahead of time shows it without
|
|
1645
1645
|
a rebuild. Dismissal is remembered per window (a moved window shows again);
|
|
1646
|
-
under way it says until when and can't be dismissed.
|
|
1647
|
-
every
|
|
1646
|
+
under way it says until when and can't be dismissed. It asks again every 15 s
|
|
1647
|
+
during a window (so it goes as soon as the work finishes early), every 30 s in
|
|
1648
|
+
the quarter hour before one, every five minutes otherwise. Tailwind token
|
|
1649
|
+
classes, as every house component.
|
|
1648
1650
|
- `useServiceCheck()` → `"checking" | "up" | "down" | "maintenance" | "unknown"`,
|
|
1649
1651
|
for `error.tsx`. In production an error page gets a digest, never the message,
|
|
1650
1652
|
so it asks the state route to probe instead: `maintenance` and `down` deserve
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type { MaintenanceStateBody } from "./route.js";
|
|
3
|
+
/**
|
|
4
|
+
* When to ask again: every 15 seconds during a window, so the notice goes as soon
|
|
5
|
+
* as the work finishes early (a reboot is often over in under a minute); every 30
|
|
6
|
+
* seconds in the quarter hour before one, so it turns into "under way" on time;
|
|
7
|
+
* otherwise every five minutes.
|
|
8
|
+
*/
|
|
9
|
+
export declare function nextCheckMs(state: MaintenanceStateBody | null, now?: number): number;
|
|
3
10
|
/**
|
|
4
11
|
* The app's maintenance state, read on mount, when the tab comes back into view,
|
|
5
|
-
* and
|
|
6
|
-
*
|
|
12
|
+
* and on the schedule in `nextCheckMs`. Null until the first answer (and when the
|
|
13
|
+
* route can't be reached).
|
|
7
14
|
*/
|
|
8
15
|
export declare function useMaintenanceState({ statePath, }?: {
|
|
9
16
|
statePath?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/maintenance/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAA2B,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../src/maintenance/react.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,oBAAoB,EAA2B,MAAM,YAAY,CAAC;AAgBhF;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI,EAAE,GAAG,SAAa,GAAG,MAAM,CAIxF;AAoBD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAA8B,GAC/B,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,oBAAoB,GAAG,IAAI,CA0B3D;AAoBD,MAAM,WAAW,sBAAsB;IACrC,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,EAAE,sBAAsB,4BA6CpG;AAED,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,aAAa,GAAG,SAAS,CAAC;AAElF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAA8B,EAAE,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,YAAY,CAe7G"}
|
|
@@ -14,6 +14,18 @@ import { describeWindow } from "./core.js";
|
|
|
14
14
|
*/
|
|
15
15
|
const DEFAULT_STATE_PATH = "/api/house/maintenance";
|
|
16
16
|
const NEAR_MS = 15 * 60_000;
|
|
17
|
+
/**
|
|
18
|
+
* When to ask again: every 15 seconds during a window, so the notice goes as soon
|
|
19
|
+
* as the work finishes early (a reboot is often over in under a minute); every 30
|
|
20
|
+
* seconds in the quarter hour before one, so it turns into "under way" on time;
|
|
21
|
+
* otherwise every five minutes.
|
|
22
|
+
*/
|
|
23
|
+
export function nextCheckMs(state, now = Date.now()) {
|
|
24
|
+
if (state?.phase === "active")
|
|
25
|
+
return 15_000;
|
|
26
|
+
const startsIn = state?.window ? Date.parse(state.window.startsAt) - now : Infinity;
|
|
27
|
+
return state?.phase === "upcoming" && startsIn < NEAR_MS ? 30_000 : 300_000;
|
|
28
|
+
}
|
|
17
29
|
function asWindow(w) {
|
|
18
30
|
return { ...w, endedAt: null, cancelled: false, affects: [], server: "" };
|
|
19
31
|
}
|
|
@@ -34,8 +46,8 @@ async function readState(statePath, probe = false) {
|
|
|
34
46
|
}
|
|
35
47
|
/**
|
|
36
48
|
* The app's maintenance state, read on mount, when the tab comes back into view,
|
|
37
|
-
* and
|
|
38
|
-
*
|
|
49
|
+
* and on the schedule in `nextCheckMs`. Null until the first answer (and when the
|
|
50
|
+
* route can't be reached).
|
|
39
51
|
*/
|
|
40
52
|
export function useMaintenanceState({ statePath = DEFAULT_STATE_PATH, } = {}) {
|
|
41
53
|
const [state, setState] = React.useState(null);
|
|
@@ -48,8 +60,7 @@ export function useMaintenanceState({ statePath = DEFAULT_STATE_PATH, } = {}) {
|
|
|
48
60
|
if (cancelled)
|
|
49
61
|
return;
|
|
50
62
|
setState(next);
|
|
51
|
-
|
|
52
|
-
timer = setTimeout(load, next?.phase === "upcoming" && startsIn < NEAR_MS ? 30_000 : 300_000);
|
|
63
|
+
timer = setTimeout(load, nextCheckMs(next));
|
|
53
64
|
};
|
|
54
65
|
const onVisible = () => {
|
|
55
66
|
if (document.visibilityState === "visible")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../src/maintenance/react.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,cAAc,EAA0B,MAAM,WAAW,CAAC;AAGnE;;;;;;;;;GASG;AAEH,MAAM,kBAAkB,GAAG,wBAAwB,CAAC;AACpD,MAAM,OAAO,GAAG,EAAE,GAAG,MAAM,CAAC;AAE5B,SAAS,QAAQ,CAAC,CAA0B;IAC1C,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAC5E,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,SAAiB,EAAE,KAAK,GAAG,KAAK;IACvD,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,UAAU,CAAC,CAAC,CAAC,SAAS,EAAE;YAClE,KAAK,EAAE,UAAU;YACjB,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;SACxC,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;YAAE,OAAO,IAAI,CAAC;QAC/C,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAyB,CAAC;QACxD,OAAO,IAAI,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,SAAS,G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CAAC"}
|
package/docs/Maintenance.md
CHANGED
|
@@ -96,7 +96,7 @@ Two entry points. The README has the API and the adoption steps.
|
|
|
96
96
|
| **proxy helper** | `maintenanceResponse` for the app's `proxy.ts`. During a window pages get the **maintenance page** itself with `503`, `Retry-After` and `no-store`; APIs get a JSON `503`; crons get `200 { skipped: "maintenance" }`. The state route, `/_next/`, static files and each app's `keepUp` paths pass. |
|
|
97
97
|
| **the maintenance page** | `maintenancePageHtml`: a whole HTML document returned by the proxy, not an app route. While the database is down an app's own layouts can't be trusted to render, and an App Router page can't answer `503`. No script (it reloads with a meta refresh every 30 s, so no CSP exception), no stylesheet, no font; light and dark. When the window ends, the next reload is the real page. |
|
|
98
98
|
| **state route** | `createMaintenanceRoute`: `/api/house/maintenance`, the gate's state as JSON, without touching the database. With `?probe=1`, also the app's `SELECT 1` (1.5 s timeout, one probe per 5 s whoever asks). |
|
|
99
|
-
| `<MaintenanceBanner>` (`/maintenance/react`) | Drawn in the browser from the state route, so pages built ahead of time show it without a rebuild. Dismissal remembered per window id; not dismissible once under way.
|
|
99
|
+
| `<MaintenanceBanner>` (`/maintenance/react`) | Drawn in the browser from the state route, so pages built ahead of time show it without a rebuild. Dismissal remembered per window id; not dismissible once under way. Re-read every 15 s during a window, 30 s in the quarter hour before, five minutes otherwise. |
|
|
100
100
|
| `useServiceCheck()` (`/maintenance/react`) | For `error.tsx`. In production the App Router hands an error page only a digest, never the message, so it can't tell a connection error from any other: it asks the state route's probe instead. |
|
|
101
101
|
| `isUnavailableError` | For an API route's catch: an unreachable database or file store is a `503`, not a `500`. |
|
|
102
102
|
|
|
@@ -107,7 +107,7 @@ Two entry points. The README has the API and the adoption steps.
|
|
|
107
107
|
1. **Requests in flight at the start.** Postgres terminates their connections ("terminating connection due to administrator command"). The gate starts one minute early.
|
|
108
108
|
2. **A fresh instance started mid-reboot, with no copy of the feed.** It can't know about the window, so it falls through to the error page's unavailable check, which also covers unplanned outages. Mirroring the feed off the server (Vercel Edge Config) would close this completely but puts a Vercel API token on the database server; kept as a later upgrade.
|
|
109
109
|
3. **No connect timeout.** pg's default is to wait for ever; against a host that drops packets a request hangs until the platform kills it. Each app sets a connect timeout of about five seconds.
|
|
110
|
-
4. **Webhooks.**
|
|
110
|
+
4. **Webhooks.** An app answers `503` during a window, so the sender retries later instead of the event being half-handled. Stripe events reach the apps through cx-stripe-gateway, whose database is on Neon: it stays up, queues a failed delivery and retries after 5, 10, 20 and 40 minutes, which outlasts any window.
|
|
111
111
|
5. **Service workers.** An offline-capable app shows the `503` maintenance page as it is — never caches it, never swaps it for the offline page.
|
|
112
112
|
6. **Search engines and AI crawlers.** `503` with `Retry-After` keeps the maintenance page out of every index.
|
|
113
113
|
|
|
@@ -119,3 +119,8 @@ Two entry points. The README has the API and the adoption steps.
|
|
|
119
119
|
2. **cx-house:** the module in §3, with tests. Publishing needs the owner's npm 2FA.
|
|
120
120
|
3. **AltEd first:** a `proxy.ts` (it has none yet), the banner in the root layout, `/maintenance`, the `error.tsx` check, the connect timeout, the service-worker rule. Then a release.
|
|
121
121
|
4. **Every other app whose database or files are on the server:** the feed URL and the same few files.
|
|
122
|
+
|
|
123
|
+
## 6. Where it stands (4 November 2026)
|
|
124
|
+
|
|
125
|
+
- **First real window, the 23:00 UTC reboot:** the server was back and the window ended at 23:00:35. AltEd's proxy answered `503` with the maintenance page from 22:59:07 to 23:00:19 (the last request seen before the end), its crons were skipped at 22:59, 23:00 and 23:00:32, ordinary pages were served again from 23:00:44, and no error was logged between 22:50 and 23:15. Instances whose feed fetch failed during the reboot kept their copy as designed (logged as a warning). The one fault: an open tab's banner re-read the state only every five minutes once a window was under way, so after an early finish it could keep saying "under way"; fixed in 0.22.3.
|
|
126
|
+
- **Step 4:** AltEd is the only app with a database (`config/databases/`) or a bucket (`config/objects/`) on CX_PGSQL_Node_1. The other house apps are on Neon, and an app subscribes only to the feeds of servers it uses, so none of them adopts the module yet. An app moving to the server adds `HOUSE_MAINTENANCE_FEEDS` and the files AltEd added in v0.173.0: `proxy.ts`, the state route, the banner in the root layout, the `error.tsx` check, `isUnavailableError` in its API error handler and a connect timeout.
|