CoS schedule route tests validate against a hand-rolled copy of the Zod schemas
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 77/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
Research direction
Read server/routes/cosScheduleRoutes.test.js:27-50 and compare its validation mock with the real schemas in server/lib/validation.js:2800 and server/lib/cosValidation.js:477. Replace or remove the mock, then adjust fixtures if the real schemas reject them. Run the route tests and confirm loosening cosScheduleTargetBodySchema makes the trigger and reset 400 cases fail; keep the change within the test file.
Written by the indexing model from the issue text.
Description
Slice audited: scheduled-work and route tests (test-quality audit, 2026-10-18).
Problem
server/routes/cosScheduleRoutes.test.js:27-50 mocks ../lib/validation.js with a factory that re-implements taskDataInputsSchema.safeParse, cosScheduleTargetBodySchema.safeParse and validateRequest by hand. The 400 assertions in POST /schedule/trigger ("should return 400 if taskType is missing"), POST /schedule/reset, and PUT /schedule/task/:taskType ("rejects unknown data input ids") therefore test the copy, not server/lib/validation.js:2800 (cosScheduleTargetBodySchema) or server/lib/cosValidation.js:477.
Mutation probe (scratch worktree): loosened the real cosScheduleTargetBodySchema to taskType: nullishString and the real taskDataInputsSchema to z.array(z.string()).
Tests 55 passed (55)
cosScheduleTargetBodySchema has no other test anywhere (rg finds it only in this test file's mock).
Impact
A loosened target schema lets POST /api/cos/schedule/trigger and /reset reach triggerOnDemandTask(undefined, …) / resetExecutionHistory(undefined, …) (server/routes/cosScheduleRoutes.js:283, :355), queueing an on-demand agent run with no task type, an unrequested provider dispatch path, with the suite green.
Fix (decided)
In cosScheduleRoutes.test.js, replace the factory with vi.mock('../lib/validation.js', async (importOriginal) => ({ ...(await importOriginal()), sanitizeTaskMetadata: vi.fn((m) => m) })), or drop the mock entirely if sanitizeTaskMetadata need not be doubled. Delete the duplicated safeParse/validateRequest/parsePagination copies and adjust fixtures the real schema rejects. No production code change.
Scope: small
Acceptance criteria
- Loosening
cosScheduleTargetBodySchemainserver/lib/validation.jsfails the trigger/reset 400 cases. - The test file no longer defines its own
safeParseorvalidateRequest. - No production code change.
- Dominant language
- JavaScript
- Stars
- 38
- Forks
- 32
- Avg merge
- 40m
- Merged PRs (30d)
- 996
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from atomantic/PortOS
-
effort:low model:light plan planner:fable-5-1 test-quality tests
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Series autopilot "skips when disabled" test passes through the crash catch-all, not the skip guardOpeneffort:low model:light plan planner:fable-5-1 test-quality tests
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Maintainers usually reply within 1 day
-
effort:low model:light plan planner:fable-5-1 test-quality tests
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
effort:low model:light plan planner:fable-5-1 test-quality tests
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Always-public API path check has no refusal test, so a prefix-match regression opens gated routesOpeneffort:low model:light plan planner:fable-5-1 test-quality tests
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
Maintainers usually reply within 1 day
All issues in atomantic/PortOS
Similar issues
-
area:plugins enhancement platform:vscode
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
anthropics/claude-code#103166 ·
Maintainers usually reply within 1 day
-
Add: Kids Zone LogoOpencheck:failed logos:add
Difficulty 1/5 Under an hour Newbie friendliness 78/100
-
[workshop-sim] Improve: Add verifiable checkpoint and bridge to Step 5 (What Are Agentic Workflows?)Openfeedback simulation workshop
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
githubnext/gh-aw-workshop#4715 ·
Maintainers usually reply within 1 day
-
getComputedStyle ignores a rule whose selector list contains a pseudo-element (regression in 30.x)Possibly taken @chiragjangiir claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
-
external-plugin external-plugin-canvas needs-review:MEDIUM ready-for-review
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
github/awesome-copilot#5153 · 2 comments ·
Maintainers usually reply within 1 day