fix(tasks): treat blank JSON filters as absent (#103981)

* fix(tasks): normalize blank JSON filters

* fix(tasks): reuse optional string normalization

* fix(tasks): share blank filter normalization

---------

Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
This commit is contained in:
soldforaloss
2026-07-10 17:40:11 -07:00
committed by GitHub
parent 0120cacf9e
commit 0e05973657
7 changed files with 155 additions and 9 deletions
+36
View File
@@ -520,6 +520,24 @@ describe("program routes", () => {
{ json: true, runtime: "cron", status: undefined },
defaultRuntime,
);
await expect(
listRoute.run([
"node",
"openclaw",
"tasks",
"list",
"--json",
"--runtime",
" ",
"--status",
"\t",
]),
).resolves.toBe(true);
expect(tasksListJsonCommandMock).toHaveBeenLastCalledWith(
{ json: true, runtime: " ", status: "\t" },
defaultRuntime,
);
});
it("routes parent task filter values that command-path discovery sees as positionals", async () => {
@@ -584,6 +602,24 @@ describe("program routes", () => {
{ json: true, severity: "error", code: "stale_running", limit: 5 },
defaultRuntime,
);
await expect(
route.run([
"node",
"openclaw",
"tasks",
"audit",
"--json",
"--severity",
" ",
"--code",
"\t",
]),
).resolves.toBe(true);
expect(tasksAuditJsonCommandMock).toHaveBeenLastCalledWith(
{ json: true, severity: " ", code: "\t", limit: undefined },
defaultRuntime,
);
});
it("returns false for task JSON routes when option values are missing or unknown", async () => {