refactor(gateway): reuse shared validators + baseHash

This commit is contained in:
Peter Steinberger
2026-02-16 01:19:01 +00:00
parent 71cee673b2
commit b743e652c0
4 changed files with 40 additions and 118 deletions

View File

@@ -9,24 +9,12 @@ import {
import { scheduleGatewaySigusr1Restart } from "../../infra/restart.js";
import { normalizeUpdateChannel } from "../../infra/update-channels.js";
import { runGatewayUpdate } from "../../infra/update-runner.js";
import {
ErrorCodes,
errorShape,
formatValidationErrors,
validateUpdateRunParams,
} from "../protocol/index.js";
import { validateUpdateRunParams } from "../protocol/index.js";
import { assertValidParams } from "./validation.js";
export const updateHandlers: GatewayRequestHandlers = {
"update.run": async ({ params, respond }) => {
if (!validateUpdateRunParams(params)) {
respond(
false,
undefined,
errorShape(
ErrorCodes.INVALID_REQUEST,
`invalid update.run params: ${formatValidationErrors(validateUpdateRunParams.errors)}`,
),
);
if (!assertValidParams(params, validateUpdateRunParams, "update.run", respond)) {
return;
}
const sessionKey =