Skip to content

check:generated fails on dev: ScheduleValidationError missing literal discriminator #245

Description

@alltomatos

What happened

bun run check:generated (part of the unit (linux)/unit (windows) CI jobs) fails with:

error: Promise error must have a literal discriminator: server.schedule.schedule.create
    at assertPromiseEndpoint (packages/httpapi-codegen/src/index.ts:296:13)

This was masked on dev until now because CI was failing earlier, at the formatMinutes unit-test step (see #236/#237), so check:generated never ran far enough to reach this. Once that's fixed, this surfaces on every PR.

Root cause

ScheduleValidationError in packages/protocol/src/groups/schedule.ts is missing the literal discriminator field (name or _tag) that httpapi-codegen's declaredErrorFields() requires on every HttpApi error class:

export class ScheduleValidationError extends Schema.ErrorClass<ScheduleValidationError>("ScheduleValidationError")(
  { message: Schema.String },
  { httpApiStatus: 400 },
) {}

Every sibling error class (e.g. ProjectCopyError in packages/protocol/src/groups/project-copy.ts) declares name: Schema.Literal("<ClassName>") as a field. ScheduleValidationError is the one outlier.

Fix

Add the name literal field to ScheduleValidationError, and pass name: "ScheduleValidationError" at both construction sites in packages/server/src/handlers/schedule.ts (matches the ProjectCopyError pattern exactly).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions