fix: distinguish skipped restarts from successful restarts in user message
formatRestartSentinelUserMessage now returns a distinct message for status=skipped instead of falling through to the success message. Previously, skipped updates (e.g. update.run with nothing to update) would be reported as 'Gateway restarted successfully.' — misleading operators into thinking a restart occurred when it did not. Adds two new tests for the skipped status case.
This commit is contained in:
parent
3163756e10
commit
b588f04a02
@ -210,6 +210,29 @@ describe("formatRestartSentinelUserMessage", () => {
|
||||
expect(formatRestartSentinelUserMessage(payload)).toBe("Gateway restart failed.");
|
||||
});
|
||||
|
||||
it("returns skipped message for skipped status", () => {
|
||||
const payload = {
|
||||
kind: "update" as const,
|
||||
status: "skipped" as const,
|
||||
ts: Date.now(),
|
||||
};
|
||||
expect(formatRestartSentinelUserMessage(payload)).toBe(
|
||||
"Gateway restart skipped (no restart was performed).",
|
||||
);
|
||||
});
|
||||
|
||||
it("returns skipped message for skipped status even with a note", () => {
|
||||
const payload = {
|
||||
kind: "update" as const,
|
||||
status: "skipped" as const,
|
||||
ts: Date.now(),
|
||||
message: "update already up to date",
|
||||
};
|
||||
const result = formatRestartSentinelUserMessage(payload);
|
||||
expect(result).toBe("Gateway restart skipped (no restart was performed).");
|
||||
expect(result).not.toContain("already up to date");
|
||||
});
|
||||
|
||||
it("never includes doctorHint", () => {
|
||||
const payload = {
|
||||
kind: "config-patch" as const,
|
||||
|
||||
@ -137,6 +137,9 @@ export function formatRestartSentinelUserMessage(payload: RestartSentinelPayload
|
||||
if (payload.status === "error") {
|
||||
return "Gateway restart failed.";
|
||||
}
|
||||
if (payload.status === "skipped") {
|
||||
return "Gateway restart skipped (no restart was performed).";
|
||||
}
|
||||
return "Gateway restarted successfully.";
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user