Skip to content

Schedule update search attributes #1625

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 19, 2025
Merged

Conversation

THardy98
Copy link
Contributor

@THardy98 THardy98 commented Feb 8, 2025

What was changed

Allow schedules to update their search attributes.

  1. Closes [Feature Request] Support schedule search attribute update #1475

  2. How was this tested:
    Added integration test.

  3. Any docs updates needed?
    Unsure

@THardy98 THardy98 requested a review from mjameswh February 8, 2025 00:40
@THardy98 THardy98 requested a review from a team as a code owner February 8, 2025 00:40
@THardy98 THardy98 force-pushed the schedule-update-search-attributes branch 3 times, most recently from bf1eae3 to d8ee220 Compare February 8, 2025 09:35
@THardy98 THardy98 force-pushed the schedule-update-search-attributes branch 2 times, most recently from 2594115 to f18d46c Compare March 14, 2025 17:23
@THardy98 THardy98 force-pushed the schedule-update-search-attributes branch from f18d46c to d05f00c Compare March 14, 2025 20:02
@@ -142,7 +142,7 @@ export type CompiledScheduleOptions = Replace<
* The specification of an updated Schedule, as expected by {@link ScheduleHandle.update}.
*/
export type ScheduleUpdateOptions<A extends ScheduleOptionsAction = ScheduleOptionsAction> = Replace<
Omit<ScheduleOptions, 'scheduleId' | 'memo' | 'searchAttributes' | 'typedSearchAttributes'>,
Omit<ScheduleOptions, 'scheduleId' | 'memo'>,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we might be better not add support for legacy (non-typed) SA on Schedule Update. I mean, we supported those elsewhere because those APIs existed before, but Schedule Update didn't had that, so why add an API here that would be immediately considered as deprecated? WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think that's fair, no sense in permitting something that's deprecated. I'll continue to omit searchAttributes.

Copy link
Contributor Author

@THardy98 THardy98 Mar 18, 2025

Choose a reason for hiding this comment

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

Ah - this is why, the update handler:

  /**
   * Update the Schedule
   *
   * This function calls `.describe()`, provides the `Schedule` to the provided `updateFn`, and
   * sends the returned `UpdatedSchedule` to the Server to update the Schedule definition. Note that,
   * in the future, `updateFn` might be invoked multiple time, with identical or different input.
   */
  update<W extends Workflow = Workflow>(
    updateFn: (previous: ScheduleDescription) => ScheduleUpdateOptions<ScheduleOptionsStartWorkflowAction<W>>
  ): Promise<void>;

To update, the user supplies a function that takes a ScheduleDescription and returns ScheduleUpdateOptions. ScheduleDescription already has a searchAttributes field.

I forgot about this.

We can have this discrepancy to force users to use typed search attributes, but I don't think this will be obvious to users until they run into unexpected behavior (i.e. update searchAttributes from description but it doesn't actually do anything because it doesn't exist in update options).

I think I would prefer to have consistency between ScheduleDescription and the ScheduleUpdateOptions but am not fussy either way.

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense. Let's keep it.

@THardy98 THardy98 requested a review from mjameswh March 18, 2025 21:02
@THardy98 THardy98 force-pushed the schedule-update-search-attributes branch 2 times, most recently from 3221c0f to d05f00c Compare March 19, 2025 15:05
@THardy98 THardy98 merged commit c6e7c88 into main Mar 19, 2025
23 checks passed
@THardy98 THardy98 deleted the schedule-update-search-attributes branch March 19, 2025 17:59
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.

[Feature Request] Support schedule search attribute update
2 participants