Skip to content

fix: done_criteria .min(1) conflicts with .optional().default([])#554

Merged
itskai-dev merged 1 commit intomainfrom
link/fix-onboarding-schema-tests
Mar 1, 2026
Merged

fix: done_criteria .min(1) conflicts with .optional().default([])#554
itskai-dev merged 1 commit intomainfrom
link/fix-onboarding-schema-tests

Conversation

@itskai-dev
Copy link
Collaborator

Problem

PR #549 made done_criteria optional with .optional().default([]), but left .min(1) on the array. Zod runs .min(1) after .default([]), so the default empty array immediately fails validation. Result: POST /tasks {"title": "My first task"} still returns 400.

This means the onboarding fix from #549 doesn't actually work — new users still can't create tasks with just a title.

Fix

  • Remove .min(1) from done_criteria — the definition-of-ready check already validates criteria quality for non-todo tasks
  • Update reflection-origin-gate.test.ts: rejection tests use status: 'doing' since todo tasks skip quality checks via early return
  • Update modules.test.ts: schema tests match relaxed onboarding behavior

Testing

  • tsc --noEmit: 0 errors
  • reflection-origin-gate tests: 6/6 pass
  • Full suite needs CI (live server tests hit deployed code)

Related

The .min(1) check on done_criteria ran after .default([]) provided
an empty array, causing all minimal task creation to fail with
'Array must contain at least 1 element(s)' even after PR #549
relaxed the schema.

Also updates tests:
- reflection-origin-gate: use status=doing to test gate (todo
  tasks skip quality checks via early return)
- modules: update schema enforcement tests to match relaxed
  onboarding behavior
@itskai-dev itskai-dev requested a review from ryancampbell as a code owner March 1, 2026 00:45
@itskai-dev itskai-dev merged commit 59735c8 into main Mar 1, 2026
9 of 10 checks passed
@itskai-dev itskai-dev deleted the link/fix-onboarding-schema-tests branch March 1, 2026 00:45
@itskai-dev itskai-dev restored the link/fix-onboarding-schema-tests branch March 1, 2026 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant