Skip to content

feat: [Cadence Schedules] Add schedule API request/response types#7748

Closed
abhishekj720 wants to merge 5 commits intomasterfrom
schedule2
Closed

feat: [Cadence Schedules] Add schedule API request/response types#7748
abhishekj720 wants to merge 5 commits intomasterfrom
schedule2

Conversation

@abhishekj720
Copy link
Contributor

What changed?

  • Add request/response types for all Schedule CRUD and lifecycle APIs (Create, Describe, Update, Delete, Pause, Unpause, List, Backfill) in common/types/schedule_service.go
  • Add ScheduleListEntry for paginated list responses
  • Include nil-safe getters for every field on every type, consistent
    with existing patterns in common/types/shared.go
  • Add schedule_service_test.go with nil-receiver and value getter tests

Why?
To support the new Cadence Schedules feature (pause/resume, catch-up, backfill), we need internal Go types to represent schedule entities within the server codebase. These types mirror the IDL definitions. This serves as the foundation for the scheduler workflow and API implementation.

Builds on #7745 which introduced the core schedule types and enums.

How did you test it?
Added unit tests and ran go test ./.. on the added files

Potential risks
N/A

Release notes
Added request/response types for cadence schedules

Documentation Changes
N/A


Reviewer Validation

PR Description Quality (check these before reviewing code):

  • "What changed" provides a clear 1-2 line summary
    • Project Issue is linked
  • "Why" explains the full motivation with sufficient context
  • Testing is documented:
    • Unit test commands are included (with exact go test invocation)
    • Integration test setup/commands included (if integration tests were run)
    • Canary testing details included (if canary was mentioned)
  • Potential risks section is thoughtfully filled out (or legitimately N/A)
  • Release notes included if this completes a user-facing feature
  • Documentation needs are addressed (or noted if uncertain)

gitar-bot and others added 2 commits February 25, 2026 21:53
Co-authored-by: abhishekj720 <abhishekj720@users.noreply.github.com>
Co-authored-by: abhishekj720 <abhishekj720@users.noreply.github.com>
@gitar-bot
Copy link

gitar-bot bot commented Feb 25, 2026

🔍 CI failure analysis for f53578a: Fixed compilation error causing all 44 CI jobs to fail. Type mismatch in GetSchedules() return type.

All CI Failures Fixed - Single Compilation Error

Issue

All 44 CI job failures were caused by a compilation error at common/types/schedule_service.go:366:

cannot use v.Schedules (variable of type []*ScheduleListEntry) as []ScheduleListEntry value in return statement

Root Cause

Type mismatch in the GetSchedules() getter method:

  • Field declared as: Schedules []*ScheduleListEntry (slice of pointers)
  • Return type was: []ScheduleListEntry (slice of values)

This prevented the entire codebase from compiling, causing all CI jobs to fail:

  • ✗ Unit tests
  • ✗ Integration tests (sqlite, etcd)
  • ✗ All 19 replication simulation variants
  • ✗ Code coverage
  • ✗ Linting
  • ✗ Docker image builds

Fix Applied

Corrected the return type at line 364:

// Before (WRONG):
func (v *ListSchedulesResponse) GetSchedules() (o []ScheduleListEntry) {

// After (CORRECT):
func (v *ListSchedulesResponse) GetSchedules() (o []*ScheduleListEntry) {

Verification

✅ Syntax validation passed
✅ Return type now matches field type
✅ Consistent with codebase patterns

All CI jobs should pass once this fix is pushed.

Code Review ✅ Approved 2 resolved / 2 findings

Clean, well-structured type definitions following established codebase patterns. The previous finding about value vs pointer slice has been resolved — ListSchedulesResponse.Schedules now correctly uses []*ScheduleListEntry.

✅ 2 resolved
Quality: Missing PII-filtering comments on json:"-" fields

📄 common/types/schedule_service.go:70 📄 common/types/schedule_service.go:71
In CreateScheduleRequest, the Memo and SearchAttributes fields use json:"-" without any comment explaining why. In shared.go, the same pattern includes // Filtering PII comments to document the intent. Adding these comments would maintain consistency and help future maintainers understand why these fields are excluded from JSON serialization.

// shared.go pattern:
Memo                                *Memo                         `json:"-"` // Filtering PII
SearchAttributes                    *SearchAttributes             `json:"-"` // Filtering PII
Quality: ListSchedulesResponse uses value slice, not pointer slice

📄 common/types/schedule_service.go:360
ListSchedulesResponse.Schedules is typed as []ScheduleListEntry (value slice), while every other list response in the codebase consistently uses pointer slices (e.g., []*WorkflowExecutionInfo, []*DescribeDomainResponse, []*TaskListPartitionMetadata).

Using a value slice means each ScheduleListEntry will be copied on iteration and cannot be nil to represent missing entries. While this works functionally, it deviates from the established pattern and may cause friction when writing generic code that handles list responses, or when the entry type grows larger with additional fields.

Consider using []*ScheduleListEntry for consistency with the rest of the codebase.

Rules ❌ No requirements met

Repository Rules

GitHub Issue Linking Requirement: Add a GitHub issue link using format 'Fixes #NNNN' or full issue URL to the PR description
PR Description Quality Standards: Add exact, copyable test command such as 'go test -v ./common/types -run TestSchedule' to the PR description
Assign Maintainer Reviewer for External Contributors: Maintainer reviewers including @natemort and rotation list members already assigned

Hide rules that don't apply by commenting gitar display:compact.

Options ✅ Auto-apply

✅ Auto-apply is on → Gitar will commit updates to this branch.
Display: verbose → Showing more information.

Comment with these commands to change:

✅ Auto-apply Verbose
gitar auto-apply:off         
gitar display:compact         

Was this helpful? React with 👍 / 👎 | Gitar

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