Skip to content

Conversation

@billrich2001
Copy link
Contributor

@billrich2001 billrich2001 commented Feb 2, 2026

What was changed

  • Describe before update: Fetch current schedule via Describe and merge CLI options with existing spec.
  • Preserve when not provided:
    • Cron/calendar: Preserve CronExpressions and Calendars when --cron and --calendar are not passed.
    • Intervals: Preserve Intervals when --interval is not passed.
    • Jitter, TimeZoneName, StartAt, EndAt: Preserve when the corresponding flags are not set (using FlagSet.Changed for fully incremental update).
  • toScheduleSpecForUpdate(spec, existing): New merge logic; create path still uses toScheduleSpec (existing == nil).

Why?

temporal schedule update was building a new schedule from scratch and sending it as a full replacement, so omitting --cron (or other spec flags) wiped existing values.

Checklist

  1. Closes [Bug] schedule update removing cron if not explicitly included #927

  2. How was this tested:

  • TestSchedule_Update (existing): still passes.
  • TestSchedule_Update_PreservesCronWhenNotProvided: create with --cron "0 9 * * *", update without --cron, assert cron preserved.
  • TestSchedule_Update_PreservesJitterWhenNotProvided: create with --jitter 1m, update without --jitter, assert jitter preserved.
  1. Any docs updates needed?
    I don't think so?

###Note:
I used AI to do most of the grunt work on this one, I reviewed all pushed code, but please call out if you notice anything I missed, or if anything doesn't follow project conventions, etc.

- Describe current schedule before building update and merge CLI with existing spec
- Preserve CronExpressions/Calendars when --cron and --calendar not passed
- Preserve Intervals when --interval not passed
- Preserve Jitter, TimeZoneName, StartAt, EndAt when corresponding flags not set
  (fully incremental update using FlagSet.Changed)
- Add toScheduleSpecForUpdate(spec, existing); create path still uses toScheduleSpec
- Add tests: TestSchedule_Update_PreservesCronWhenNotProvided,
  TestSchedule_Update_PreservesJitterWhenNotProvided
@billrich2001 billrich2001 marked this pull request as ready for review February 2, 2026 17:04
@billrich2001 billrich2001 requested review from a team as code owners February 2, 2026 17:04
// toScheduleSpecForUpdate applies CLI options to spec, preserving existing spec
// fields when the user did not pass the corresponding flags (fully incremental update).
// If existing is nil, behaves like toScheduleSpec (no preservation).
func (c *ScheduleConfigurationOptions) toScheduleSpecForUpdate(spec *client.ScheduleSpec, existing *client.ScheduleSpec) error {
Copy link
Member

@cretz cretz Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will let CLI reviewers review this, but I wanted to clarify...

The way this CLI works is not a bug, it is very much by intention. It's a backwards incompatible alteration to change this CLI command from being full update to be partial update. For example, users have been able to remove jitter by simply not providing the --jitter flag, but now they can't. Not only is that an incompatible alteration, there are likely a lot of users using it in this declarative form (i.e. they make update calls that are effectively no-ops because they have the same CLI args as what's already on server).

There is an inherent desire for declarative schedules so a user can partial update what they know to be the spec in some separate file. In the meantime, to remain compatible, we need to split off the concept of "partial update" and "full update" (and therefore if the former is needed as a new feature, it should be opted into either via flag or separate command).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, this might make more sense as a separate patch command or something where it is intended to keep everything except for updated fields.

Will wait for feedback from CLI team

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Chad on not making a backwards incompatible change. I'm not sure off the top of my head how we'd want to address this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can make whatever "patch" update you want with UpdateSchedule and the conflict token guard. This is built into the SDK as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(but keep in mind that cron strings are canonicalized to structured calendar specs)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] schedule update removing cron if not explicitly included

5 participants