Skip to content

FE-1947: Add groundwork for the Wait flow action - #10021

Open
kostandinang wants to merge 6 commits into
kostandin/fe-1926-if-filter-listfrom
kostandin/fe-1947-add-wait-flow-action
Open

kostandinang wants to merge 6 commits into
kostandin/fe-1926-if-filter-listfrom
kostandin/fe-1947-add-wait-flow-action

Conversation

@kostandinang

@kostandinang kostandinang commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🌟 Purpose

A Wait flow action will pause a run, then pass its input on unchanged. It will run as a child workflow that sleeps until the resume time, once flow actions can run as child workflows (FE-1935). This PR adds only the parts that don't depend on the engine.

🔍 Changes

Where What it does
flows/wait.ts resolveResumeAt works out when a Wait step resumes. checkWaitInputs checks its inputs when the flow is defined. Start here.
flows/types.ts, flow-definition-schema.ts Adds the Duration ({ amount, unit }) and DateTime (ISO 8601 with Z or an offset) payload kinds.
run-flow-modal/types.ts Marks both kinds as unsupported flow inputs.

How the resume time is worked out:

  • Exactly one of duration and until must be set.
  • An until time in the past resumes straight away.
  • A wait over 30 days is an error, not shortened.

Decisions to review:

  • parseDateTime uses a strict pattern instead of Date.parse, which reads a value without a timezone as local time.
  • checkWaitInputs only checks constants. It skips the 30-day limit on until, because "now" isn't known when the flow is defined.
  • Wait isn't an action definition yet, because it would then need an activity. The validator doesn't call checkWaitInputs yet.

⚠️ Known issues

  • Nothing runs a Wait step yet. The action definition and the child workflow that runs it are FE-1954.
  • The run flow modal can't take a Duration or DateTime input.

🛡 Tests

  • wait.test.ts covers unit lengths, invalid and over-limit durations, until times (future, past, boundaries, malformed, offsets), neither or both inputs, each checkWaitInputs rule, and the schema accepting both constants.

@vercel

vercel Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
hash Ready Ready Preview Oct 13, 2026 3:45pm UTC
3 Skipped Deployments
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 13, 2026 3:45pm UTC
petrinaut Skipped Skipped Oct 13, 2026 3:45pm UTC
petrinaut-docs Skipped Skipped Oct 13, 2026 3:45pm UTC

Request Review

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (kostandin/fe-1926-if-filter-list@a5247a5). Learn more about missing BASE report.

Additional details and impacted files
@@                         Coverage Diff                         @@
##             kostandin/fe-1926-if-filter-list   #10021   +/-   ##
===================================================================
  Coverage                                    ?   68.07%           
===================================================================
  Files                                       ?     1962           
  Lines                                       ?   203325           
  Branches                                    ?     8555           
===================================================================
  Hits                                        ?   138410           
  Misses                                      ?    63262           
  Partials                                    ?     1653           
Flag Coverage Δ
apps.hash-ai-worker-ts 4.39% <ø> (?)
apps.hash-api 15.32% <ø> (?)
local.hash-backend-utils 6.46% <ø> (?)
local.hash-isomorphic-utils 29.80% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 11:24 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 11:24 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 11:39 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 11:39 Inactive
@kostandinang kostandinang changed the title FE-1947: Add Wait payload kinds, resume time and input checks FE-1947: Add Wait flow action Oct 13, 2026
@kostandinang
kostandinang marked this pull request as ready for review October 13, 2026 12:05
@cursor

cursor Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Isolated shared utilities and types with no workflow execution path yet; behavior is covered by unit tests.

Overview
Adds engine-agnostic building blocks for a future Wait flow step: new Duration ({ amount, unit }) and DateTime (strict ISO 8601 with Z or offset) payload kinds, wired into flow types/schema JSON typing, and marked unsupported in the run-flow modal until UI exists.

New wait.ts implements resolveResumeAt (exactly one of duration or until; 30-day max; past until resumes immediately) with strict parseDateTime / duration parsing, plus checkWaitInputs for define-time validation of constant inputs. wait.test.ts covers parsing, limits, and schema acceptance. No Wait action definition or runtime/timer in this PR—follow-up work.

Reviewed by Cursor Bugbot for commit 440a77a. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 12:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 12:38 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 12:47 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 12:47 Inactive
@CiaranMn
CiaranMn requested a review from a team as a code owner October 13, 2026 13:52
kostandinang and others added 6 commits October 13, 2026 17:32
A Duration is an amount of seconds, minutes, hours, days or weeks. A DateTime is an ISO 8601 instant with Z or an offset; the Date kind stays date-only. Both are small JSON values that pass inline. The run flow modal can't take either as a flow input yet.

Co-authored-by: Amp <amp@ampcode.com>
resolveResumeAt takes either a duration or an until time and the time the step started, and returns the instant to resume at. An until time in the past resumes straight away, and a wait longer than 30 days is an error rather than being shortened. It reads no clock, so the engine can call it wherever the timer ends up.

checkWaitInputs reports what's known when the flow is defined: that exactly one of duration and until is connected, and that a constant duration or until time is valid. The 30-day limit on until, and inputs from a flow input or an earlier step, are left to when the step starts. Wait isn't an action definition yet, so the validator doesn't call it.

Co-authored-by: Amp <amp@ampcode.com>
The pattern now rejects out-of-range hours, minutes, seconds and offsets, so the parser only checks that the date exists. The resolveResumeAt cases already cover each unit's length, so the separate durationToMs table is gone.
…il tests

The parseDateTime cases already cover empty, malformed and timezone-less values and offsets, so resolveResumeAt and checkWaitInputs keep one malformed case each.
… inputs

parseDateTime now rejects a value that isn't a string. RegExp.exec turned an array of one date-time string into that string, so resolveResumeAt accepted it as an until time.

Tests cover fractional durations, malformed durations and until times reaching resolveResumeAt from a flow input or an earlier step, and malformed constants that pass the flow definition schema and are reported by checkWaitInputs.
resolveResumeAt is given values from flow inputs and earlier steps that nothing has checked, so its inputs are typed unknown and the tests no longer cast. parseDuration returns milliseconds or an error, like parseDateTime, so a duration is converted once.
@kostandinang
kostandinang force-pushed the kostandin/fe-1947-add-wait-flow-action branch from ba0ca3e to 440a77a Compare October 13, 2026 15:34
@vercel
vercel Bot temporarily deployed to Preview – petrinaut October 13, 2026 15:34 Inactive
@vercel
vercel Bot temporarily deployed to Preview – petrinaut-docs October 13, 2026 15:34 Inactive
@kostandinang
kostandinang requested a review from CiaranMn October 13, 2026 16:08
@kostandinang
kostandinang added this pull request to stack #9970 October 13, 2026 16:08
@kostandinang kostandinang changed the title FE-1947: Add Wait flow action FE-1947: Add groundwork for the Wait flow action Oct 13, 2026

This branch was successfully deployed

2 active and 2 inactive deployments
Preview – hash — 440a77ae Deployed Oct 13, 2026 by vercel[bot]
pull-request — 440a77ae Deployed Oct 13, 2026 by kostandinang via Sourcemaps (@apps/hash-ai-worker-ts) #39746
Preview – petrinaut-docs — 440a77ae Deployed Oct 13, 2026 by vercel[bot]
Preview – petrinaut — 440a77ae Deployed Oct 13, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash* Affects HASH (a `hash-*` app) area/apps area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant