Complete the README Future checklist (CLI, trace, ARN/handler binding, Retry/Catch, timing)#7
Open
jamoy wants to merge 4 commits into
Conversation
Checklist items from the README "Future" list:
- bindTaskResource can bind by the Resource ARN (not just the state name), and
a bound resource may be a Serverless-style handler reference
('path/to/file.export' or { handler }) which is required and invoked, so you
can run real handlers instead of inline resolvers (handlerBasePath option)
- fix `ErrorState.All` -> `ErrorState.ALL` (the constant was misspelled, so
Map/Parallel/Choice/Wait failures were tagged with `undefined`)
- fix Parallel/Map Catch: `step()` returned the map/parallel promise without
awaiting it, so its rejection bypassed the surrounding try/catch and the
state's `Catch` never ran; also wire `Catch` for Map
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG
…tests
More README "Future" checklist items:
- add a `stepfunctions` CLI (bin/cli.js): `stepfunctions run def.json --input
'{...}' [--report]`
- add `trace()`, an async iterator that yields each transition so a machine can
be walked generator-style (`for await (const step of sm.trace(input))`), via a
new generic `transition` event; returns the final output
- fix the elapsed-time calculation (was multiplying milliseconds by 100) so the
reported timing is real wall-clock ms
- rewrite the Wait tests with jest fake timers so they're instant and
deterministic (no more real sleeping)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG
- README: drop the experimental label on Retry/Catch, document bind-by-ARN / handler refs, trace(), and the CLI; mark every checklist item done - index.d.ts / index.d.mts: add trace(), the ResourceReference handler-ref union, the Transition type, and the handlerBasePath option (verified with tsc under node16 resolution for both CJS and ESM) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG
On Node 26, jest's useRealTimers() did not cleanly restore the global setTimeout, so the Wait describe's fake timers leaked and a later test hit "setTimeout is not defined". Move the Wait tests to test/wait.test.js, which jest runs in its own sandboxed environment, and drive them entirely with fake timers (no useRealTimers) so nothing leaks into the rest of the suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG
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.
Stacked on #5 (which is stacked on #4 → #3) — review/merge those first; this PR's diff is only the checklist work on top.
Closes out the entire Future checklist in the README. Each item, and how it's implemented/tested:
bindTaskResourceresolveResourcematches the state name or the Resource ARN'path/file.export'or{ handler }), loaded viahandlerBasePathstepfunctionsbin:stepfunctions run def.json --input '{...}' [--report]ErrorState.All→ErrorState.ALLtypo and a real bug where Parallel/MapCatchnever ran (step()returned the promise withoutawait); added a Parallel-catch test; updated the READMEelapsed()(it multiplied milliseconds by 100) to report real wall-clock msjest.fakeTimers()trace()async iterator (for await (const step of sm.trace(input))) via a generictransitionevent; returns the final outputAlso updated
index.d.ts/index.d.mts(newtrace(),ResourceReference,Transition,handlerBasePath) — verified withtscundernode16resolution for both CJS and ESM.Verified
pnpm test→ 96 passing, 5 skipped (8 new tests) ✓pnpm lint(ESLint + Prettier) ✓pnpm test:smoke✓pnpm audit→ no known vulnerabilities ✓Notably, two of these items surfaced real latent bugs (Parallel/Map
Catchnot firing; theErrorState.ALLtypo), now fixed with tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG
Generated by Claude Code