Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

CoS schedule route tests validate against a hand-rolled copy of the Zod schemas

Open Beginner friendly
#11,998 0 comments 0 reactions 0 assignees View on GitHub

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
Domain
backend, testing

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

effort:low model:light plan planner:fable-5-1 test-quality tests

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 cosScheduleTargetBodySchema in server/lib/validation.js fails the trigger/reset 400 cases.
  • The test file no longer defines its own safeParse or validateRequest.
  • No production code change.
Dominant language
JavaScript
Stars
38
Forks
32
Avg merge
40m
Merged PRs (30d)
996

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from atomantic/PortOS

All issues in atomantic/PortOS

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.