Skip to content

Fix schedule edit double-encoding header fields#3287

Merged
laurakwhit merged 2 commits intomainfrom
fix/schedule-edit-header-double-encoding
Apr 10, 2026
Merged

Fix schedule edit double-encoding header fields#3287
laurakwhit merged 2 commits intomainfrom
fix/schedule-edit-header-double-encoding

Conversation

@laurakwhit
Copy link
Copy Markdown
Collaborator

@laurakwhit laurakwhit commented Apr 9, 2026

Description & motivation 💭

Header fields from the server are already base64-encoded Payloads. Editing a schedule was unconditionally re-encoding them, wrapping each Payload inside a new Payload. Each subsequent edit/save compounded the encoding, which could lead to Workflow Task Failures.

This PR adds an isBase64EncodedPayload check to skip encoding for already-encoded inputs in encodePayloads.

Screenshots (if applicable) 📸

Design Considerations 🎨

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added
  • Unit tests added

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

  1. Modify this Go sample to create a schedule with headers

In schedule/starter/main.go, register a context propagator and set the header value in the context:

func main() {
	[...]
	ctx = context.WithValue(ctx, ctxpropagation.PropagateKey, &ctxpropagation.Values{Key: "x-custom-header", Value: "header-value"})
	c, err := client.Dial(client.Options{
		[...]
		ContextPropagators: []workflow.ContextPropagator{ctxpropagation.NewContextPropagator()},
	})
    [...]
  }    

Remove the deferred delete so the schedule sticks around for UI testing.

  1. Run the sample

Terminal 1: run the worker
go run schedule/worker/main.go

Terminal 2: create the schedule
go run schedule/starter/main.go

  1. Test in the UI

    • Open the schedule in the UI
    • Open browser DevTools Network tab
    • Edit and save without changing anything and inspect the request payload
      • Verify the header fields are NOT double-wrapped in a new Payload
    • Verify the schedule still triggers successfully after the edit
    • Edit and save a second time
      • Verify the request payload looks identical to step 3
    • Verify the triggered workflow completes without a Workflow Task Failure

Checklists

Draft Checklist

Merge Checklist

Issue(s) closed

DT-3821

Docs

Any docs updates needed?

@laurakwhit laurakwhit requested a review from a team as a code owner April 9, 2026 18:19
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment Apr 9, 2026 9:07pm

Request Review

@temporal-cicd
Copy link
Copy Markdown
Contributor

temporal-cicd Bot commented Apr 9, 2026

Warnings
⚠️

📊 Strict Mode: 35 errors in 2 files (3.2% of 1085 total)

src/lib/utilities/encode-payload.ts (1)
  • L69:14: Type 'null' is not assignable to type 'IPayload[]'.
src/lib/stores/schedules.ts (34)
  • L47:4: 'body.schedule' is possibly 'undefined'.
  • L47:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L48:4: 'body.schedule' is possibly 'undefined'.
  • L48:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L49:4: 'body.schedule' is possibly 'undefined'.
  • L49:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L51:42: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  • L53:4: 'body.schedule' is possibly 'undefined'.
  • L53:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L56:4: 'body.schedule' is possibly 'undefined'.
  • L56:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L57:4: 'body.schedule' is possibly 'undefined'.
  • L57:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L64:4: 'body.schedule' is possibly 'undefined'.
  • L64:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L75:4: 'body.schedule' is possibly 'undefined'.
  • L75:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L76:4: 'body.schedule' is possibly 'undefined'.
  • L76:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.
  • L108:65: Property 'message' does not exist on type '{}'.
  • L115:4: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L135:10: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L136:12: 'workflowSearchAttributes' is possibly 'undefined'.
  • L140:43: Argument of type '{ type: "Unspecified" | "Keyword" | "Text" | "Int" | "Double" | "Bool" | "KeywordList" | "Datetime"; label: string; value?: any; }[] | undefined' is not assignable to parameter of type '{ type: "Unspecified" | "Keyword" | "Text" | "Int" | "Double" | "Bool" | "KeywordList" | "Datetime"; label: string; value?: any; }[]'.
  • L197:65: Property 'message' does not exist on type '{}'.
  • L205:4: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L210:13: 'schedule.action' is possibly 'null' or 'undefined'.
  • L215:10: Type '{ indexedFields: { indexedFields?: { [k: string]: IPayload; } | null | undefined; }; } | null' is not assignable to type 'ISearchAttributes | null | undefined'.
  • L221:17: 'body.schedule' is possibly 'undefined'.
  • L221:17: 'body.schedule.action' is possibly 'null' or 'undefined'.
  • L232:65: Property 'message' does not exist on type '{}'.
  • L238:4: 'body.schedule' is possibly 'undefined'.
  • L241:4: 'body.schedule' is possibly 'undefined'.
  • L241:4: 'body.schedule.spec' is possibly 'null' or 'undefined'.

Generated by 🚫 dangerJS against cc42ff4

@@ -58,18 +67,22 @@ export const encodePayloads = async ({
messageType = '',
encodeWithCodec = true,
}: EncodePayloads): Promise<Payload[]> => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • ⚠️ Type 'null' is not assignable to type 'IPayload[]'.

encoding,
messageType,
) as unknown as Payload,
];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Not a fan of ternaries

@laurakwhit laurakwhit merged commit ae3a184 into main Apr 10, 2026
19 checks passed
@laurakwhit laurakwhit deleted the fix/schedule-edit-header-double-encoding branch April 10, 2026 17:13
temporal-cicd Bot pushed a commit that referenced this pull request Apr 10, 2026
Auto-generated version bump from 2.48.1 to 2.48.2

Specific version: 2.48.2

Changes included:
- [`92cd681e`](92cd681) Re-wire auth to use a provider pattern. Lots of tests remove cloud references (#3230)
- [`3d92202b`](3d92202) Use --top-nav-height CSS variable for sticky element positioning (#3250)
- [`16295986`](1629598) Bump saved view limits from 20 to 50 (#3254)
- [`a9fa0e91`](a9fa0e9) Display cron string instead of calendar spec when schedule has a cron string in comment field (#3241)
- [`f1811715`](f181171) use full for 100% instead of 100vh (#3256)
- [`0dfadd74`](0dfadd7) Add samples-ruby to workflows table empty state (#3259)
- [`d85d61a3`](d85d61a) Display human-readable schedule spec labels (#3261)
- [`b63049c5`](b63049c) Add invite icon to Holocene design system (#3262)
- [`00c6418c`](00c6418) Bump google.golang.org/grpc from 1.66.1 to 1.79.3 in /server (#3232)
- [`b04a3676`](b04a367) Add back animation (#3251)
- [`7b651524`](7b65152) Bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 in /server (#3268)
- [`45f4fdea`](45f4fde) use snippets for nexus CTAs (#3266)
- [`420f5c9d`](420f5c9) min-h-full instead of screen (#3270)
- [`f5b2fab6`](f5b2fab) feat(navigation): add NavSection Holocene component (#3263)
- [`657b2728`](657b272) Adds requested design changes to breadcrumb items (#3267)
- [`6763cc4d`](6763cc4) Remove serena (#3273)
- [`dfff353e`](dfff353) Display Principal fields in Event History (#3272)
- [`2d289bce`](2d289bc) Update CODEOWNERS to wildcard for temporalio/frontend-engineering (#3275)
- [`a2eaf16e`](a2eaf16) Persist workflow view and sort order preferences across navigation (#3260)
- [`c5d4c996`](c5d4c99) Add link from Event Card to jump to event id page from Timeline. Remove unnecessary padding (#3277)
- [`e5b3ea55`](e5b3ea5) fix(deps): upgrade lodash, svelte, kit, storybook, tar-fs for security (#3269)
- [`b44afbe6`](b44afbe) fix(deps): upgrade vite and add picomatch/svgo overrides for security (#3279)
- [`4e8cb4e9`](4e8cb4e) Fix unpause confirmation modal title (#3280)
- [`740b3529`](740b352) Add Slack notification when DESIGN FEEDBACK REQUESTED label is added to a PR (#3282)
- [`7e8170e4`](7e8170e) Add check for COLLABORATOR (#3283)
- [`dc27109d`](dc27109) fix: update nav item margin from mb-1 to mb-2 (#3290)
- [`3e6416d2`](3e6416d) Pass execution runId in workflow request for schedule recent run (#3289)
- [`ae3a1844`](ae3a184) Fix schedule edit double-encoding header fields (#3287)
- [`09c083e0`](09c083e) fix: prevent reset modal from closing on authorization error (#3291)
- [`0aa3b72b`](0aa3b72) Sort namespace picker alphabetically (#3286)
- [`4c3d0057`](4c3d005) Sort alphabetically utility (#3293)
- [`67a988b9`](67a988b) Bump @sveltejs/kit from 2.55.0 to 2.57.1 (#3294)
laurakwhit added a commit that referenced this pull request Apr 10, 2026
Auto-generated version bump from 2.48.1 to 2.48.2

Specific version: 2.48.2

Changes included:
- [`92cd681e`](92cd681) Re-wire auth to use a provider pattern. Lots of tests remove cloud references (#3230)
- [`3d92202b`](3d92202) Use --top-nav-height CSS variable for sticky element positioning (#3250)
- [`16295986`](1629598) Bump saved view limits from 20 to 50 (#3254)
- [`a9fa0e91`](a9fa0e9) Display cron string instead of calendar spec when schedule has a cron string in comment field (#3241)
- [`f1811715`](f181171) use full for 100% instead of 100vh (#3256)
- [`0dfadd74`](0dfadd7) Add samples-ruby to workflows table empty state (#3259)
- [`d85d61a3`](d85d61a) Display human-readable schedule spec labels (#3261)
- [`b63049c5`](b63049c) Add invite icon to Holocene design system (#3262)
- [`00c6418c`](00c6418) Bump google.golang.org/grpc from 1.66.1 to 1.79.3 in /server (#3232)
- [`b04a3676`](b04a367) Add back animation (#3251)
- [`7b651524`](7b65152) Bump github.com/go-jose/go-jose/v4 from 4.1.3 to 4.1.4 in /server (#3268)
- [`45f4fdea`](45f4fde) use snippets for nexus CTAs (#3266)
- [`420f5c9d`](420f5c9) min-h-full instead of screen (#3270)
- [`f5b2fab6`](f5b2fab) feat(navigation): add NavSection Holocene component (#3263)
- [`657b2728`](657b272) Adds requested design changes to breadcrumb items (#3267)
- [`6763cc4d`](6763cc4) Remove serena (#3273)
- [`dfff353e`](dfff353) Display Principal fields in Event History (#3272)
- [`2d289bce`](2d289bc) Update CODEOWNERS to wildcard for temporalio/frontend-engineering (#3275)
- [`a2eaf16e`](a2eaf16) Persist workflow view and sort order preferences across navigation (#3260)
- [`c5d4c996`](c5d4c99) Add link from Event Card to jump to event id page from Timeline. Remove unnecessary padding (#3277)
- [`e5b3ea55`](e5b3ea5) fix(deps): upgrade lodash, svelte, kit, storybook, tar-fs for security (#3269)
- [`b44afbe6`](b44afbe) fix(deps): upgrade vite and add picomatch/svgo overrides for security (#3279)
- [`4e8cb4e9`](4e8cb4e) Fix unpause confirmation modal title (#3280)
- [`740b3529`](740b352) Add Slack notification when DESIGN FEEDBACK REQUESTED label is added to a PR (#3282)
- [`7e8170e4`](7e8170e) Add check for COLLABORATOR (#3283)
- [`dc27109d`](dc27109) fix: update nav item margin from mb-1 to mb-2 (#3290)
- [`3e6416d2`](3e6416d) Pass execution runId in workflow request for schedule recent run (#3289)
- [`ae3a1844`](ae3a184) Fix schedule edit double-encoding header fields (#3287)
- [`09c083e0`](09c083e) fix: prevent reset modal from closing on authorization error (#3291)
- [`0aa3b72b`](0aa3b72) Sort namespace picker alphabetically (#3286)
- [`4c3d0057`](4c3d005) Sort alphabetically utility (#3293)
- [`67a988b9`](67a988b) Bump @sveltejs/kit from 2.55.0 to 2.57.1 (#3294)

Co-authored-by: laurakwhit <15069288+laurakwhit@users.noreply.github.com>
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