Bug
Tasks created with an invalid type value (e.g. feature) are accepted and written to project.tasks.yaml, but silently dropped when read back. This causes tasks to "disappear" with no error or warning.
Steps to Reproduce
- Create a task with
type: feature (via daemon API or CLI)
- Verify the task exists in
project.tasks.yaml (it does)
- Run
kspec task list — the task is missing from output
- The daemon API
GET /api/tasks also omits it
Root Cause
loadTasksFromFile() in dist/parser/yaml.js uses TaskSchema.safeParse() for individual task validation. When safeParse fails, the task is silently skipped:
for (const taskData of taskList) {
const result = TaskSchema.safeParse(taskData);
if (result.success) {
tasks.push({ ...result.data, _sourceFile: filePath });
}
// ← no else branch — invalid tasks silently dropped
}
TaskTypeSchema only allows: epic | task | bug | spike | infra. The value feature fails Zod validation:
Invalid enum value. Expected 'epic' | 'task' | 'bug' | 'spike' | 'infra', received 'feature'
Two Issues
1. No write-time validation
The daemon API POST /api/tasks and createTask() do not validate against TaskSchema before writing. Invalid data is accepted and persisted.
2. Silent data loss on read
When safeParse fails, the task is dropped with no warning, no log, no error. The user sees N-1 tasks and has no idea one is missing or why.
Expected Behavior
- Write time: Reject invalid types with a clear error (400 response or CLI error)
- Read time: At minimum, warn about tasks that fail validation. Ideally, still include them with a warning flag rather than silently dropping them.
Environment
- kspec v0.12.0 (
@kynetic-ai/spec)
- Also reproduced on v0.10.0 and v0.11.0
- Bun v1.3.10, Linux x64
Workaround
Manually edit the YAML to change the invalid type to a valid one (e.g. feature → task).
Bug
Tasks created with an invalid
typevalue (e.g.feature) are accepted and written toproject.tasks.yaml, but silently dropped when read back. This causes tasks to "disappear" with no error or warning.Steps to Reproduce
type: feature(via daemon API or CLI)project.tasks.yaml(it does)kspec task list— the task is missing from outputGET /api/tasksalso omits itRoot Cause
loadTasksFromFile()indist/parser/yaml.jsusesTaskSchema.safeParse()for individual task validation. WhensafeParsefails, the task is silently skipped:TaskTypeSchemaonly allows:epic | task | bug | spike | infra. The valuefeaturefails Zod validation:Two Issues
1. No write-time validation
The daemon API
POST /api/tasksandcreateTask()do not validate againstTaskSchemabefore writing. Invalid data is accepted and persisted.2. Silent data loss on read
When
safeParsefails, the task is dropped with no warning, no log, no error. The user sees N-1 tasks and has no idea one is missing or why.Expected Behavior
Environment
@kynetic-ai/spec)Workaround
Manually edit the YAML to change the invalid type to a valid one (e.g.
feature→task).