Skip to content

feat(schedule): support creating schedule in paused state - #1081

Closed
abhishekj720 wants to merge 4 commits into
masterfrom
feat/schedule-ergonomics
Closed

feat(schedule): support creating schedule in paused state#1081
abhishekj720 wants to merge 4 commits into
masterfrom
feat/schedule-ergonomics

Conversation

@abhishekj720

@abhishekj720 abhishekj720 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds ScheduleInitialState, an input-side type capturing paused, pauseReason, and pausedBy (pausedAt is excluded as it is server-populated)
  • Adds a five-arg createSchedule() overload accepting ScheduleInitialState; the existing four-arg overload delegates to it with null, preserving backward compatibility
  • Adds toThriftInitialState() helper in ScheduleClientImpl mapping ScheduleInitialStatecom.uber.cadence.ScheduleState
  • Updates src/main/idls submodule to d6d4d81 which adds the state field to CreateScheduleRequest in shared.thrift
  • Adds the corresponding state field to the generated CreateScheduleRequest Java class
  • Adds four unit tests covering paused-with-info, paused-no-info, null-state, and four-arg-falls-through
  • Companion changes: cadence server #8431 (landed), go-client #1521, python-client #164

Test plan

  • ./gradlew compileJava -x generateProto: compiles cleanly
  • ./gradlew test --tests "com.uber.cadence.internal.sync.ScheduleClientImplTest": all tests pass (including four new initialState tests)

@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 76.31579% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.24%. Comparing base (e341161) to head (0317561).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ternal/compatibility/proto/mappers/TypeMapper.java 54.54% 2 Missing and 3 partials ⚠️
.../cadence/client/schedule/ScheduleInitialState.java 87.50% 0 Missing and 2 partials ⚠️
...nal/compatibility/proto/mappers/RequestMapper.java 0.00% 0 Missing and 1 partial ⚠️
...uber/cadence/internal/sync/ScheduleClientImpl.java 90.00% 0 Missing and 1 partial ⚠️

❌ Your patch status has failed because the patch coverage (76.31%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Files with missing lines Coverage Δ Complexity Δ
...nal/compatibility/proto/mappers/RequestMapper.java 61.10% <0.00%> (+0.55%) 81.00 <0.00> (+1.00)
...uber/cadence/internal/sync/ScheduleClientImpl.java 34.23% <90.00%> (+2.23%) 34.00 <6.00> (+7.00)
.../cadence/client/schedule/ScheduleInitialState.java 87.50% <87.50%> (ø) 10.00 <10.00> (?)
...ternal/compatibility/proto/mappers/TypeMapper.java 22.47% <54.54%> (+0.50%) 64.00 <2.00> (+2.00)

... and 12 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e341161...0317561. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add ScheduleInitialState input type and a five-arg createSchedule()
overload that accepts it. Passing ScheduleInitialState with paused=true
creates the schedule already paused, removing the need for a subsequent
PauseSchedule call. pausedAt is server-populated and intentionally
excluded from this type.

Also updates the src/main/idls submodule to d6d4d81 (adds state field
to CreateScheduleRequest in shared.thrift) and adds the corresponding
state field to the generated CreateScheduleRequest Java class.

Signed-off-by: abhishek.jha <abhishek.jha@uber.com>
@abhishekj720
abhishekj720 force-pushed the feat/schedule-ergonomics branch from d981c5f to 7089f29 Compare August 20, 2026 11:12
…e, toString and partial pause-info branches

Signed-off-by: abhishek.jha <abhishek.jha@uber.com>
.setAction(toThriftAction(action))
.setPolicies(toThriftPolicies(policies));
if (initialState != null) {
request.setState(toThriftInitialState(initialState));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We set state on the request here, but it never gets serialized. On the gRPC path, WorkflowServiceGrpc.CreateSchedule sends the request via RequestMapper.createScheduleRequest(request), there's no setState(...) and t.getState() is never read. So state is dropped and the schedule comes back un-paused, no error.

// --- initialState ---

@Test
public void createSchedule_initialState_pausedWithReasonAndPausedBy() throws Exception {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

These assert ARE before RequestMapper runs — that's why they stay green even though state gets dropped on the way to the proto. Could we add one that runs createScheduleRequest and checks the resulting api.v1.CreateScheduleRequest (getState().getPaused() etc.)? That would've caught this.

…t proto

RequestMapper.createScheduleRequest was missing the state field, causing
initialState to be silently dropped on the gRPC path. Add TypeMapper
overloads for the thrift→proto direction (schedulePauseInfo and scheduleState)
and wire state into the proto builder. Add a RequestMapper-level test that
verifies state and pauseInfo survive the full thrift→proto conversion.

Signed-off-by: abhishek.jha <abhishek.jha@uber.com>
…eduleRequest)

The IDL commit adds ScheduleState state = 8 to CreateScheduleRequest proto,
which the gRPC mapper now relies on to serialize initial pause state.

Signed-off-by: abhishek.jha <abhishek.jha@uber.com>
@gitar-bot

gitar-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Adds ScheduleInitialState and an overloaded createSchedule method to support creating schedules in a paused state, along with comprehensive unit tests and IDL submodule updates. No issues found.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@abhishekj720

Copy link
Copy Markdown
Contributor Author

Superseded by #1083 (IDL bump) and #1082 (feature), split per review feedback.

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.

2 participants