fix: clarify todo-note route misses

This commit is contained in:
AgentRun Artificer
2026-06-11 16:42:53 +08:00
parent 6d80bfec94
commit 08a46a22c7
4 changed files with 247 additions and 8 deletions
+5 -2
View File
@@ -1780,6 +1780,9 @@ function runTodoNoteRouteDiagnosticChecks(): { ok: boolean; detail: unknown } {
// 1) Bad path: CLI must rewrite the misleading 404 to the structured diagnostic.
const badPathRewrite = runTodoNoteCliProbe(["/api/instances/instance_probe_bad/todos", "--method", "POST", "--body-json", JSON.stringify({ title: "e2e-route-diagnostic" })]);
const badPathBody = (badPathRewrite.payload as { data?: { body?: Record<string, unknown> } } | null)?.data?.body ?? null;
const badPathData = (badPathRewrite.payload as { data?: Record<string, unknown> } | null)?.data ?? null;
const badPathBodyRewritten = badPathBody?.bodyRewritten === true || badPathData?.bodyRewritten === true;
const badPathUpstreamError = (badPathBody?.upstreamBody as { error?: string } | undefined)?.error ?? (badPathData?.upstreamBody as { error?: string } | undefined)?.error;
const rewriteOk = (
badPathRewrite.exitCode === 1
&& badPathBody !== null
@@ -1791,8 +1794,8 @@ function runTodoNoteRouteDiagnosticChecks(): { ok: boolean; detail: unknown } {
&& (badPathBody.writableApiEndpoints as Array<{ path?: string }>).some((endpoint) => endpoint.path === "/api/instances/:instanceId/actions")
&& Array.isArray(badPathBody.actionTypes)
&& (badPathBody.actionTypes as string[]).includes("addTodo")
&& (badPathRewrite.payload as { data?: { bodyRewritten?: boolean } } | null)?.data?.bodyRewritten === true
&& (badPathRewrite.payload as { data?: { upstreamBody?: { error?: string } } } | null)?.data?.upstreamBody?.error === "Todo Note is running in backend-only mode"
&& badPathBodyRewritten
&& badPathUpstreamError === "Todo Note is running in backend-only mode"
);
if (!rewriteOk) issues.push("bad-path-rewrite");
// 2) --check-path matched: POST /api/instances must succeed and return matched=true.