0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00

fix(factory): report a missing schedule cron as null (#30098)

Schedules can now be one-off runs with no cron expression (#25131), so
`schedule.cron` is optional. The Factory environment build schedule view
still assigned it to a `string | null` field, which fails the
`@mastra/factory` typecheck on `main`.

The view now reports a missing cron as `null`, the same as when there is
no schedule.

## Test plan
- [x] `tsc --noEmit` in `mastracode/factory` passes (fails on `main` at
`build-schedule.ts:68`)
- [x] `vitest run src/environment`: 61 passed

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

When a schedule has no cron expression, Factory now returns `null`
instead of an invalid missing value. This supports one-off schedules and
matches the declared output type.

## Changes

- Updated `toView` to map an undefined `schedule.cron` to `null`.
- Added a patch changeset for `@mastra/factory`.

## Testing

Not available.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: CalebBarnes <CalebBarnes@users.noreply.github.com>
Co-authored-by: mastracode <284800079+mastra-platform[bot]@users.noreply.github.com>
This commit is contained in:
Caleb Barnes 2026-11-11 13:37:55 -07:00 • committed by GitHub
commit 9efd1ea8df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 1 deletions