Use sanitized Zod wire errors

This commit is contained in:
Timothy J. Aveni
2026-06-26 08:20:34 -07:00
parent f039e91a0d
commit 2551acf90d
7 changed files with 33 additions and 28 deletions
+19 -19
View File
@@ -29,13 +29,13 @@ const RAW_RUNTIME_STATE =
"packageLocation": "./",\
"packageDependencies": [\
["@quixos/control-plane-protocol", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/control-plane-protocol.git#commit=6b5dfb37f4e0bf1d3e3f4b8809ef8ebec17edcb2"],\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f"],\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e"],\
["@types/node", "npm:24.12.4"],\
["@types/ws", "npm:8.18.1"],\
["dotenv", "npm:17.4.2"],\
["quixos-orchestrator", "workspace:."],\
["typescript", "patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"],\
["ws", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:8.21.0"]\
["ws", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:8.21.0"]\
],\
"linkType": "SOFT"\
}]\
@@ -51,18 +51,18 @@ const RAW_RUNTIME_STATE =
}]\
]],\
["@quixos/package-runtime", [\
["https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f", {\
"packageLocation": "../../.yarn/berry/cache/@quixos-package-runtime-https-57d3827343-10c0.zip/node_modules/@quixos/package-runtime/",\
["https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e", {\
"packageLocation": "../../.yarn/berry/cache/@quixos-package-runtime-https-785b69fdc1-10c0.zip/node_modules/@quixos/package-runtime/",\
"packageDependencies": [\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f"],\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e"],\
["@types/node", "npm:24.12.4"],\
["@types/react", "npm:18.3.29"],\
["@types/react-dom", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.7"],\
["@types/react-dom", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.7"],\
["@types/ws", "npm:8.18.1"],\
["react", "npm:18.3.1"],\
["react-dom", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.1"],\
["react-dom", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.1"],\
["typescript", "patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"],\
["ws", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:8.21.0"],\
["ws", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:8.21.0"],\
["zod", "npm:4.4.3"]\
],\
"linkType": "HARD"\
@@ -114,11 +114,11 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "SOFT"\
}],\
["virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.7", {\
"packageLocation": "./.yarn/__virtual__/@types-react-dom-virtual-04781dd9ac/3/.yarn/berry/cache/@types-react-dom-npm-18.3.7-c71f2ee61f-10c0.zip/node_modules/@types/react-dom/",\
["virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.7", {\
"packageLocation": "./.yarn/__virtual__/@types-react-dom-virtual-4060e5890a/3/.yarn/berry/cache/@types-react-dom-npm-18.3.7-c71f2ee61f-10c0.zip/node_modules/@types/react-dom/",\
"packageDependencies": [\
["@types/react", "npm:18.3.29"],\
["@types/react-dom", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.7"]\
["@types/react-dom", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.7"]\
],\
"packagePeers": [\
"@types/react"\
@@ -178,13 +178,13 @@ const RAW_RUNTIME_STATE =
"packageLocation": "./",\
"packageDependencies": [\
["@quixos/control-plane-protocol", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/control-plane-protocol.git#commit=6b5dfb37f4e0bf1d3e3f4b8809ef8ebec17edcb2"],\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f"],\
["@quixos/package-runtime", "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e"],\
["@types/node", "npm:24.12.4"],\
["@types/ws", "npm:8.18.1"],\
["dotenv", "npm:17.4.2"],\
["quixos-orchestrator", "workspace:."],\
["typescript", "patch:typescript@npm%3A5.9.3#optional!builtin<compat/typescript>::version=5.9.3&hash=5786d5"],\
["ws", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:8.21.0"]\
["ws", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:8.21.0"]\
],\
"linkType": "SOFT"\
}]\
@@ -207,13 +207,13 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "SOFT"\
}],\
["virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.1", {\
"packageLocation": "./.yarn/__virtual__/react-dom-virtual-b5927728d8/3/.yarn/berry/cache/react-dom-npm-18.3.1-a805663f38-10c0.zip/node_modules/react-dom/",\
["virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.1", {\
"packageLocation": "./.yarn/__virtual__/react-dom-virtual-a30716769a/3/.yarn/berry/cache/react-dom-npm-18.3.1-a805663f38-10c0.zip/node_modules/react-dom/",\
"packageDependencies": [\
["@types/react", "npm:18.3.29"],\
["loose-envify", "npm:1.4.0"],\
["react", "npm:18.3.1"],\
["react-dom", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:18.3.1"],\
["react-dom", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:18.3.1"],\
["scheduler", "npm:0.23.2"]\
],\
"packagePeers": [\
@@ -266,14 +266,14 @@ const RAW_RUNTIME_STATE =
],\
"linkType": "SOFT"\
}],\
["virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:8.21.0", {\
"packageLocation": "./.yarn/__virtual__/ws-virtual-31719efd05/3/.yarn/berry/cache/ws-npm-8.21.0-7629fe02dd-10c0.zip/node_modules/ws/",\
["virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:8.21.0", {\
"packageLocation": "./.yarn/__virtual__/ws-virtual-e62a7c8e63/3/.yarn/berry/cache/ws-npm-8.21.0-7629fe02dd-10c0.zip/node_modules/ws/",\
"packageDependencies": [\
["@types/bufferutil", null],\
["@types/utf-8-validate", null],\
["bufferutil", null],\
["utf-8-validate", null],\
["ws", "virtual:57d382734314f10d7986511ee301cb33a4527eabd3a2f5b958a046cfcda8f470cf7e413898aa35652283e5a16046ab5c8240c47a220fea8a66ee3c1fc4cb3706#npm:8.21.0"]\
["ws", "virtual:785b69fdc1ba1f7b5aaa662721cbf4f2114e72a1efa4bbd29283542b73651041f1f92da6068a755154f503a4f56f5340cfecd11a3dcc02fb2523a3dd30d76ed5#npm:8.21.0"]\
],\
"packagePeers": [\
"@types/bufferutil",\
Binary file not shown.
+1 -1
View File
@@ -13,7 +13,7 @@
},
"dependencies": {
"@quixos/control-plane-protocol": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/control-plane-protocol.git#commit=6b5dfb37f4e0bf1d3e3f4b8809ef8ebec17edcb2",
"@quixos/package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f",
"@quixos/package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e",
"dotenv": "^17.4.2",
"ws": "^8.18.3"
},
+7 -2
View File
@@ -6,6 +6,7 @@ import {
makeJsonRpcSuccessResponse,
type JsonRpcRequest,
} from "@quixos/control-plane-protocol";
import { summarizeZodErrorForWire } from "@quixos/package-runtime";
import { createControlRpcDispatcher } from "./dispatcher.js";
import type { ControlRpcError } from "./errors.js";
import { jsonRpcError } from "./errors.js";
@@ -69,11 +70,15 @@ export const attachControlRpcSocketHandlers = (services: ControlRpcServices) =>
const parsed = JsonRpcRequestSchema.safeParse(value);
if (!parsed.success) {
const summary = summarizeZodErrorForWire(parsed.error, {
label: "JSON-RPC request",
});
console.warn(summary.debugMessage);
sendMalformedRequestError(
socket,
-32600,
"Invalid request",
parsed.error.flatten(),
summary.publicMessage,
{ fields: summary.fields },
);
return;
}
+1 -1
View File
@@ -154,7 +154,7 @@ let
cacheEntries = {
"@quixos/control-plane-protocol@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/control-plane-protocol.git#commit=6b5dfb37f4e0bf1d3e3f4b8809ef8ebec17edcb2" = { filename = "@quixos-control-plane-protocol-https-2769e95fc0-6096389e66.zip"; hash = "sha512-YJY4nmbq8/dFMMj4Y1kjN7m1p1Lpni/A+An6XGSnyAhD5D9AYd/5jVoRYeD8GBzVUSENFUYGclyTSyOtIIO/jg=="; };
"@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f" = { filename = "@quixos-package-runtime-https-57d3827343-055125ea58.zip"; hash = "sha512-BVEl6lj6sPLGbVnBHybdi76XSs7J1wLCS8b53tjymBIgc8ohMJSp9ByktBQJq/oCTqxPOFYlEJ+kghmXfBol/g=="; };
"@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e" = { filename = "@quixos-package-runtime-https-785b69fdc1-ea916ae9e3.zip"; hash = "sha512-6pFq6eOfUeAVhXCJ4hLK+sfy/RVE/wr77HnkotEO5e7M+kcUn7GDCFf5Gml6mf9pgn6TX8iEVbqI1N5ditCLug=="; };
"@types/node@npm:24.12.4" = { filename = "@types-node-npm-24.12.4-fb0c00261b-d2c36b78b6.zip"; hash = "sha512-0sNreLYFDYZ3dp+gWjIkMGFnXoHdwrtDlV2RpnGvNGVQbvJzGiTAyatCtrZ5vVwVE95Fu+nqJ4wsB+5jtWS2Gw=="; };
"@types/node@npm:25.9.1" = { filename = "@types-node-npm-25.9.1-fa3ebe64ec-9a04682842.zip"; hash = "sha512-mgRoKEK+u88hoXed/quapzPXvXu8Cg7bZBqzqaPUPqxUMiWs9mnDNPRY8ZVkQ+vAcrw8coQMVDuLNWyrXILUVg=="; };
"@types/prop-types@npm:15.7.15" = { filename = "@types-prop-types-npm-15.7.15-cefe16a1fa-b59aad1ad1.zip"; hash = "sha512-tZqtGtGb8XM89ST9TmGBlsbHaQ9I7nCjJ+tFCkKquOigY/vlnKClcBrr4tktWCKSwPuEXqV0dPahX2mUsOJgsg=="; };
+4 -4
View File
@@ -14,9 +14,9 @@ __metadata:
languageName: node
linkType: hard
"@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f":
"@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e":
version: 1.0.0
resolution: "@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f"
resolution: "@quixos/package-runtime@https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e"
dependencies:
"@types/node": "npm:^24"
"@types/react": "npm:^18.3.12"
@@ -27,7 +27,7 @@ __metadata:
typescript: "npm:^5.9.3"
ws: "npm:^8.18.3"
zod: "npm:^4.3.6"
checksum: 10c0/055125ea58fab0f2c66d59c11f26dd8bbe974acec9d702c24bc6f9ded8f298122073ca213094a9f41ca4b41409abfa024eac4f385625109fa48219977c1a25fe
checksum: 10c0/ea916ae9e39f51e015857089e212cafac7f2fd1544ff0afbec79e4a2d10ee5eeccfa47149fb1830857f91a697a99ff69827e935fc88455ba88d4de5d8ad08bba
languageName: node
linkType: hard
@@ -121,7 +121,7 @@ __metadata:
resolution: "quixos-orchestrator@workspace:."
dependencies:
"@quixos/control-plane-protocol": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/control-plane-protocol.git#commit=6b5dfb37f4e0bf1d3e3f4b8809ef8ebec17edcb2"
"@quixos/package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=990c18f00b082e7f5d823b31d3c06173cec1eb1f"
"@quixos/package-runtime": "https://gitea-external.egads.tutti.syntaxblitz.net/quixos/quixos-ts-package-runtime.git#commit=242aa28d5ec3f058f605dca18fd00d35ab5c440e"
"@types/node": "npm:^24"
"@types/ws": "npm:^8.18.1"
dotenv: "npm:^17.4.2"