Skip to content

DT-4051: pre-populate input when starting standalone activity like this one#3469

Merged
rossnelson merged 6 commits into
mainfrom
DT-4051
May 29, 2026
Merged

DT-4051: pre-populate input when starting standalone activity like this one#3469
rossnelson merged 6 commits into
mainfrom
DT-4051

Conversation

@rossnelson
Copy link
Copy Markdown
Collaborator

@rossnelson rossnelson commented May 28, 2026

Summary

  • Start a standalone activity like this one now copies the input payload, encoding, message type, user metadata (summary/details), and search attributes from the source execution — matching the existing behaviour of Start a workflow like this one
  • Added runId to StartActivityExecutionQueryParams and routeForStartStandaloneActivity so the start form knows which execution to copy from
  • Added fetchInitialValuesForStartActivity in standalone-activities.ts with two focused private helpers (extractInputValues, extractMetadataString) to decode the source activity's payload and metadata
  • On mount, the start form fetches initial values when both activityId and runId are present in the URL, then pre-populates all fields and auto-expands advanced options if needed

Test plan

Prerequisites

  1. Start a local Temporal server: temporal server start-dev
  2. Start the worker (e.g. from frontend-shared-workflows): pnpm dev
  3. Start the UI from this branch: pnpm dev

Steps

  1. Navigate to the Start Standalone Activity form: http://localhost:8080/namespaces/default/standalone-activities/start
  2. Fill in:
    • Task Queue: unversioned.default.Rosss-MacBook-Pro.local
    • Activity Type: greet
    • Input: {"name": "test-input-123"}
    • Start-to-Close Timeout: 30s
  3. Submit the form
  4. Navigate to Standalone Activities, find the execution, open its details
  5. Click More Actions → Start a standalone activity like this one

Expected (this branch)

  • Input field is pre-populated with {"name": "test-input-123"}
  • Task queue, activity type, and timeouts are carried over
  • Summary/details pre-populate and advanced options auto-expand when present
  • Search attributes pre-populate when the source activity has custom search attributes
  • Form works normally when navigated to directly (no runId param — fields are empty)

Regression check

  • Starting a standalone activity from the form directly (not via "like this one") still works

Closes DT-4051

…is one

'Start a standalone activity like this one' now copies the input payload,
encoding, message type, user metadata (summary/details), and search
attributes from the source execution, matching the existing workflow behavior.
@vercel
Copy link
Copy Markdown

vercel Bot commented May 28, 2026

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

Project Deployment Actions Updated (UTC)
holocene Ready Ready Preview, Comment May 28, 2026 7:49pm

Request Review

Comment thread src/lib/components/standalone-activities/activity-actions.svelte Outdated
@temporal-cicd
Copy link
Copy Markdown
Contributor

temporal-cicd Bot commented May 28, 2026

Warnings
⚠️

📊 Strict Mode: 8 errors in 3 files (0.9% of 905 total)

src/lib/services/standalone-activities.ts (2)
  • L127:6: Type '{ indexedFields?: ({ [k: string]: temporal.api.common.v1.IPayload; } | null); }' is not assignable to type '{ [k: string]: IPayload; }'.
  • L133:2: Type '{ retryPolicy: { backoffCoefficient?: number | undefined; maximumAttempts?: number | undefined; maximumInterval?: string | undefined; initialInterval?: string | undefined; }; scheduleToStartTimeout?: string | undefined; ... 10 more ...; userMetadata: { ...; }; }' is not assignable to type 'StartActivityExecutionRequest'.
src/lib/components/standalone-activities/activity-actions.svelte (1)
  • L72:14: Type 'string | null | undefined' is not assignable to type 'string | undefined'.
src/lib/components/standalone-activities/start-standalone-activity-form/form.svelte (5)
  • L143:6: Type 'ClientValidationAdapter<{ encoding: "json/plain" | "json/protobuf"; namespace: string; identity: string; activityId: string; taskQueue: string; activityType: string; initialInterval: string; maximumInterval: string; ... 11 more ...; idConflictPolicy?: string | undefined; }, { ...; }>' is not assignable to type 'ClientValidationAdapter<Partial<{ input: string; messageType: string; scheduleToStartTimeout: string; summary: string; details: string; heartbeatTimeout: string; initialInterval: string; backoffCoefficient: null; ... 11 more ...; scheduleToCloseTimeout: string | undefined; }>, Record<...>> | ValidatorsOption<...> | ...'.
  • L317:11: Type 'string | undefined' is not assignable to type 'string'.
  • L329:11: Type 'string | undefined' is not assignable to type 'string'.
  • L395:13: Type 'null' is not assignable to type 'string'.
  • L397:13: Type 'null' is not assignable to type 'string'.

Generated by 🚫 dangerJS against 4f66d97

- Remove duplicate handleError/onError in fetchPaginatedActivities
- Use undefined instead of null for searchAttributes variable
- Use Partial<RetryPolicy> in StartActivityExecutionRequest
- Use SearchAttributesSchema instead of SearchAttributeInput[] in form data type
- Coalesce runId null to undefined in activity-actions navigation
- Use z.string().default('') for initialInterval/maximumInterval schema fields
- Initialize backoffCoefficient/maximumAttempts as null to match schema type
- Cast form.data and search attribute arrays to their correct types
- Change backoffCoefficient/maximumAttempts in StandaloneActivityFormData
  to number | null | undefined to match Zod schema inference
- Change all z.string().optional() fields to .default('') so superForm
  infers string instead of string | undefined, matching the interface
- Change encoding schema field to .default('json/plain')
- Remove both 'as' casts — types now align structurally
Revert .default('') to .optional() for intentionally optional string
fields; update StandaloneActivityFormData to string | undefined to match.
Keep .default('json/plain') for encoding (always set via store) and
.default('') for initialInterval/maximumInterval (RetryPolicyInput binds
require non-nullable strings).
@rossnelson rossnelson marked this pull request as ready for review May 28, 2026 19:52
@rossnelson rossnelson requested a review from a team as a code owner May 28, 2026 19:52
backoffCoefficient: number | null | undefined;
maximumInterval: string;
maximumAttempts: string;
maximumAttempts: number | null | undefined;
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

making zod generated types happy.

@rossnelson rossnelson requested a review from rossedfort May 29, 2026 16:02
@rossnelson rossnelson merged commit 33ec1b3 into main May 29, 2026
23 checks passed
@rossnelson rossnelson deleted the DT-4051 branch May 29, 2026 16:32
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