fix(web): degrade server status when the /health probe fails
`resolveServerStatus` only degraded on `healthOk === false`, so a /health request that errored outright (network error, 5xx) left the console claiming "online" off a cached /info. Add `healthError` as its own step, ahead of the subsystem check, and feed `health.isError` from the shell, the status page and the workspaces page so all three derive a single verdict.
This commit is contained in:
1 parent
5139adf915
commit
f549045ed2
5 files changed
+50
-10
No files matched your search
@@ -19,7 +19,7 @@ const realisticInfo: InfoResponse = {
|
||||
};
|
||||
|
||||
describe("resolveServerStatus", () => {
|
||||
it("resolves unpaired client to offline", () => {
|
||||
it("resolves unpaired client to offline even when info is present", () => {
|
||||
const input: ServerStatusInput = {
|
||||
paired: false,
|
||||
info: realisticInfo,
|
||||
@@ -27,15 +27,33 @@ describe("resolveServerStatus", () => {
|
||||
};
|
||||
expect(resolveServerStatus(input)).toBe("offline");
|
||||
expect(resolveServerStatus({ paired: false })).toBe("offline");
|
||||
expect(resolveServerStatus({ paired: false, info: realisticInfo })).toBe("offline");
|
||||
});
|
||||
|
||||
it("resolves infoError to offline", () => {
|
||||
it("resolves infoError to offline, even with stale cached info", () => {
|
||||
const input: ServerStatusInput = {
|
||||
paired: true,
|
||||
infoError: true,
|
||||
healthOk: true,
|
||||
};
|
||||
expect(resolveServerStatus(input)).toBe("offline");
|
||||
expect(
|
||||
resolveServerStatus({
|
||||
paired: true,
|
||||
info: realisticInfo,
|
||||
infoError: true,
|
||||
}),
|
||||
).toBe("offline");
|
||||
});
|
||||
|
||||
it("resolves healthError to degraded even when info is present", () => {
|
||||
expect(
|
||||
resolveServerStatus({
|
||||
paired: true,
|
||||
info: realisticInfo,
|
||||
healthError: true,
|
||||
}),
|
||||
).toBe("degraded");
|
||||
});
|
||||
|
||||
it("resolves info present + healthOk === false to degraded", () => {
|
||||
|
||||
Reference in new issue
Block a user