WIP: schedules updates#3405
Draft
tegan-temporal wants to merge 11 commits into
Draft
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Eliminate 3-layer field destructuring by having store functions accept ScheduleFormData directly. Move preset into the Zod schema so all form state flows through SuperForms. Modernize form.svelte to Svelte 5 patterns and simplify page components to thin wrappers.
…olumn layout Add support for multiple schedule specs (cron, week, month, interval) with add/remove capability. Introduce new form sections: Schedule Details (start/end dates, timezone, jitter), Schedule Policies (overlap, catchup, pause on failure), and a live Schedule Summary sidebar. Replace single tab-based spec selector with composable spec cards.
Use DatePicker for start/end dates, RadioGroup for end date type, Combobox with search for timezone, DurationInput for jitter and catchup window, Select for overlap policy. Add collapsible spec items that show a compact summary row when collapsed. Fix overlap policy enum mapping for edit mode and show validation errors above form buttons.
Migrate schedule-view.svelte to Svelte 5 runes ($state, $derived, $effect, $app/state). Update schedule components to match new designs with refactored advanced settings, search attributes, and workflow runs.
* refactor: replace PayloadDecoder and MetadataDecoder with unified Payload component Consolidates two divergent payload display components into a single `<Payload />` component at `src/lib/components/payload.svelte`. Previously, `payload-decoder.svelte` (Svelte 5 runes, required a `children` snippet, always decoded full attribute trees) and `metadata-decoder.svelte` (Svelte 4 options API with slot syntax, decoded single payloads to truncated summary strings) served different display purposes but used inconsistent APIs and decoding paths across 65+ call sites. The new component unifies both under a single `mode` prop: - `code-block` (default): renders a CodeBlock with the decoded value, replacing all PayloadDecoder + CodeBlock snippet patterns - `summary`: truncates to 120 chars and renders a Badge, replacing all MetadataDecoder usages - `inline-truncated`: renders the compact .payload pre block used in event detail rows - `children` snippet: escape hatch for callers that need custom rendering (schedule input, timeline SVG text elements) Both old components used a single decoding path internally (cloneAllPotentialPayloadsWithCodec -> decodePayloadAttributes -> stringifyWithBigInt). MetadataDecoder previously used a separate decodeSingleReadablePayloadWithCodec path; the new component uses the same unified path for consistency. The component is written in Svelte 5 runes throughout and imports from $app/state instead of $app/stores, matching the newer direction of the codebase. Migrated files: - src/lib/components/event/event-card.svelte - src/lib/components/event/event-details-row.svelte (+ moved .payload CSS) - src/lib/components/event/event-metadata-expanded.svelte - src/lib/components/event/event-summary-row.svelte - src/lib/components/lines-and-dots/svg/group-details-text.svelte - src/lib/components/lines-and-dots/svg/timeline-graph-row.svelte - src/lib/components/schedule/schedule-form/schedule-input-payload.svelte - src/lib/components/standalone-activities/activity-input-and-outcome.svelte - src/lib/components/workflow/client-actions/update-confirmation-modal.svelte - src/lib/components/workflow/input-and-results-payload.svelte - src/lib/components/workflow/metadata/metadata-events.svelte - src/lib/components/workflow/pending-activity/pending-activity-card.svelte - src/lib/components/workflow/workflow-json-navigator.svelte - src/lib/pages/standalone-activity-details.svelte - src/lib/pages/standalone-activity-search-attributes.svelte - src/lib/pages/workflow-memo.svelte - src/lib/pages/workflow-metadata.svelte - src/lib/pages/workflow-search-attributes.svelte All 1730 tests pass. * remove unused component, fix css * refactor: move Payload component into payload/ directory Moves payload.svelte into src/lib/components/payload/ and adds a USAGE.md report documenting all 31 call sites grouped by feature area. Updates all 17 import paths accordingly. * docs: add Payload component improvement suggestions * docs: add decode-payload usage report and refactoring recommendations * refactor(payload): split Payload component into focused mode-specific components Replace the 14-prop multi-mode payload.svelte with four single-purpose components: PayloadCodeBlock, PayloadSummary, PayloadDecoder, and PayloadInline. Each component carries only the props relevant to its render mode, eliminating dead props at call sites. Also updates the decode paths to use the renamed decode-payload.ts API (decodeEventAttributes, parsePayloadAttributes) following the #3302 cleanup. * fix(payload-summary): use decodeUserMetadata and add onDecode prop Replace decodeEventAttributes with decodeUserMetadata — the correct decode path for a single raw Payload (Phase 2 codec only, no attribute tree walking). Also add onDecode callback prop, called after a successful decode, consistent with PayloadCodeBlock. * refactor(payload): extract shared decode logic into decode-payload-value utility Remove 3-way duplication of getInitialValue/onMount decode logic from payload-code-block, payload-decoder, and payload-inline by extracting getInitialPayloadValue and decodePayloadValue into src/lib/utilities/decode-payload-value.ts. * fix(payload): replace onMount with \$effect for reactive value updates Components now re-decode when value or fieldName props change after mount, fixing the reactivity gap that caused stale decoded content when parent components updated their payload bindings. * add workflow with user metadata * remove unnecessary props from payload code block * fix summary display * add improvements * fix heading levels * add multi input workflow * get rid of fieldName prop and fix most of the call sites * fix remaining type errors * fix tests * rm inspect * rm console.log * WIP - download external payloads * add support for downloading externally stored payloads * add some error handling to downloads * add support for filename * fix CR feedback * remove bad key * fix export * remove unused type * cleanup unused stuff * fix possibly duplicate key * add language prop to PayloadCodeBlock * add copyIconTitle and copySuccessIconTitle to codeblock instance * refactor(payload): fix reactivity and race condition in payload-summary Replace $effect+$state async pattern with $derived promise + $effect cleanup to ensure all reactive deps (value, fallback, prefix, maxSummaryLength) are tracked synchronously. Use $effect cleanup function to cancel stale promise callbacks on re-run, preventing race conditions when value changes rapidly. Remove unused onDecode prop. * early return if no payloads in decode utils * add type guards * support inline external payloads * fix download error and payload codeblock types * fix schedule input * rm console.log * fix tests and strict mode * fix spec * fix typo * add some optional chaining
43fa679 to
23923a6
Compare
| spec?.jitter ?? translate('common.none'), | ||
| )} | ||
| {@render Info( | ||
| translate('schedules.overlap-policy'), |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'string | ScheduleOverlapPolicy' is not assignable to parameter of type 'string | ITimestamp'.
| {@render Info( | ||
| translate('schedules.exclusion-calendar'), | ||
| spec?.excludeCalendar | ||
| ? (getScheduleSpecLabel({ |
Contributor
There was a problem hiding this comment.
⚠️ Type 'ICalendarSpec[]' is not assignable to type 'IStructuredCalendarSpec[]'.
| structuredCalendar: spec.excludeCalendar, | ||
| }) ?? translate('common.none')) | ||
| : translate('common.none'), | ||
| )} |
Contributor
There was a problem hiding this comment.
⚠️ 'state' is possibly 'null' or 'undefined'.
| )} | ||
| {#if state.limitedActions} | ||
| {@render Info( | ||
| translate('schedules.remaining-actions'), |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'string | Long' is not assignable to parameter of type 'string | ITimestamp'.
|
|
||
| const timezoneComboboxOptions = $derived.by(() => { | ||
| const opts = [{ label: 'UTC', value: 'UTC' }]; | ||
| for (const tz of TimezoneOptions) { |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'number | undefined' is not assignable to parameter of type 'number'.
| <Loading /> | ||
| {:then { schedule, searchAttributes }} | ||
| <ScheduleFormView onConfirm={handleEdit} {schedule} {searchAttributes} /> | ||
| <ScheduleFormView |
Contributor
There was a problem hiding this comment.
⚠️ Argument of type 'ISchedule | undefined' is not assignable to parameter of type 'ISchedule'.
| <ScheduleFormView onConfirm={handleEdit} {schedule} {searchAttributes} /> | ||
| <ScheduleFormView | ||
| onSubmit={handleEdit(schedule)} | ||
| {schedule} |
Contributor
There was a problem hiding this comment.
⚠️ Type 'ISearchAttributes | null | undefined' is not assignable to type 'ISearchAttributes | undefined'.
| </h1> | ||
| <div class="flex flex-wrap items-center gap-2 text-lg"> | ||
| <div class="mt-2 flex flex-wrap items-center gap-2"> | ||
| <WorkflowStatus |
Contributor
There was a problem hiding this comment.
⚠️ 'schedule.schedule' is possibly 'undefined'.⚠️ 'schedule.schedule.state' is possibly 'null' or 'undefined'.
| encoding: formData.encoding, | ||
| messageType: formData.messageType, | ||
| }); | ||
| } catch (e) { |
Contributor
There was a problem hiding this comment.
⚠️ Property 'message' does not exist on type '{}'.
| encoding: formData.encoding, | ||
| messageType: formData.messageType, | ||
| }); | ||
| } catch (e) { |
Contributor
There was a problem hiding this comment.
⚠️ Property 'message' does not exist on type '{}'.
Contributor
|
23923a6 to
f6459bf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.