Repository navigation
FE-1947: Add groundwork for the Wait flow action - #10021
kostandinang wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PR SummaryLow Risk Overview New Reviewed by Cursor Bugbot for commit 440a77a. Bugbot is set up for automated code reviews on this repo. Configure here. |
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.
ba0ca3e to
440a77a
Compare
🌟 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
flows/wait.tsresolveResumeAtworks out when a Wait step resumes.checkWaitInputschecks its inputs when the flow is defined. Start here.flows/types.ts,flow-definition-schema.tsDuration({ amount, unit }) andDateTime(ISO 8601 withZor an offset) payload kinds.run-flow-modal/types.tsHow the resume time is worked out:
durationanduntilmust be set.untiltime in the past resumes straight away.Decisions to review:
parseDateTimeuses a strict pattern instead ofDate.parse, which reads a value without a timezone as local time.checkWaitInputsonly checks constants. It skips the 30-day limit onuntil, because "now" isn't known when the flow is defined.checkWaitInputsyet.DurationorDateTimeinput.🛡 Tests
wait.test.tscovers unit lengths, invalid and over-limit durations,untiltimes (future, past, boundaries, malformed, offsets), neither or both inputs, eachcheckWaitInputsrule, and the schema accepting both constants.