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).
What happened
bun run check:generated(part of theunit (linux)/unit (windows)CI jobs) fails with:This was masked on
devuntil now because CI was failing earlier, at theformatMinutesunit-test step (see #236/#237), socheck:generatednever ran far enough to reach this. Once that's fixed, this surfaces on every PR.Root cause
ScheduleValidationErrorinpackages/protocol/src/groups/schedule.tsis missing the literal discriminator field (nameor_tag) thathttpapi-codegen'sdeclaredErrorFields()requires on every HttpApi error class:Every sibling error class (e.g.
ProjectCopyErrorinpackages/protocol/src/groups/project-copy.ts) declaresname: Schema.Literal("<ClassName>")as a field.ScheduleValidationErroris the one outlier.Fix
Add the
nameliteral field toScheduleValidationError, and passname: "ScheduleValidationError"at both construction sites inpackages/server/src/handlers/schedule.ts(matches theProjectCopyErrorpattern exactly).