fix(protocol): add literal discriminator to ScheduleValidationError - #247
Open
alltomatos wants to merge 6 commits into
Open
alltomatos wants to merge 6 commits into
alltomatos wants to merge 6 commits into
Conversation
httpapi-codegen requires every HttpApi error class to declare a literal `name`/`_tag` field (see declaredErrorFields in packages/httpapi-codegen). ScheduleValidationError was the one error class missing it, which fails bun run check:generated with "Promise error must have a literal discriminator: server.schedule.schedule.create". Matches the existing ProjectCopyError pattern. Closes #245
Companion change for the protocol-side fix: both construction sites now supply the newly-required `name` literal field. Closes #245
3 tasks
Owner
Author
|
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #245
Type of change
What does this PR do?
bun run check:generated(part ofunit (linux)/unit (windows)CI) fails with:This was masked on
devuntil now — CI was failing earlier, at theformatMinuteslocale unit-test step (#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.tswas missing the literal discriminator field (name/_tag) thathttpapi-codegen'sdeclaredErrorFields()requires on every HttpApi error class. Every sibling error class (e.g.ProjectCopyError) declaresname: Schema.Literal("<ClassName>");ScheduleValidationErrorwas the one outlier.Fix:
name: Schema.Literal("ScheduleValidationError")to the error class's fields.packages/server/src/handlers/schedule.tsto passname: "ScheduleValidationError", matching theProjectCopyErrorpattern exactly.How did you verify your code works?
tsgo --noEmitonpackages/protocolandpackages/server: clean, 0 errors.oxlinton both changed files: 0 warnings, 0 errors.bun@1.3.14(pinned version) by runningbun run script/build.tsfrompackages/clienton a clean checkout — confirmed error, then confirmed it's gone after this fix (theschedule.schedule.creatediscriminator error no longer occurs).Note:
bun run check:generatedstill doesn't fully pass ondevafter this fix alone — fixing this uncovers a further masked issue (HttpApiError.BadRequestinsystem.tsproduces an invalid TS identifier), filed separately as #246 since it's an unrelated root cause in a different file. This PR is scoped to theScheduleValidationErrorfix only.Screenshots / recordings
N/A — server/protocol-only change, no UI.
Checklist
This PR was opened by an unattended scheduled sync run — please review before merging.
🤖 Generated with Claude Code
https://claude.ai/code/session_01SHQKcGH7ayRe8UHJ9CAPQJ
Generated by Claude Code