Skip to content

Complete the README Future checklist (CLI, trace, ARN/handler binding, Retry/Catch, timing)#7

Open
jamoy wants to merge 4 commits into
claude/gifted-cannon-gfy802-pnpmfrom
claude/gifted-cannon-gfy802-checklist
Open

Complete the README Future checklist (CLI, trace, ARN/handler binding, Retry/Catch, timing)#7
jamoy wants to merge 4 commits into
claude/gifted-cannon-gfy802-pnpmfrom
claude/gifted-cannon-gfy802-checklist

Conversation

@jamoy

@jamoy jamoy commented Jun 22, 2026

Copy link
Copy Markdown
Owner

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:

Checklist item Implementation
Bind by ARN in bindTaskResource resolveResource matches the state name or the Resource ARN
Run real handlers instead of resolvers a bound resource may be a Serverless-style ref ('path/file.export' or { handler }), loaded via handlerBasePath
Run via CLI new stepfunctions bin: stepfunctions run def.json --input '{...}' [--report]
Remove experimental label on Retry/Catch fixed the ErrorState.AllErrorState.ALL typo and a real bug where Parallel/Map Catch never ran (step() returned the promise without await); added a Parallel-catch test; updated the README
More accurate timing fixed elapsed() (it multiplied milliseconds by 100) to report real wall-clock ms
Use jest.fakeTimers() rewrote the Wait tests with fake timers — instant and deterministic (no more real sleeping)
Generator-style stepping new trace() async iterator (for await (const step of sm.trace(input))) via a generic transition event; returns the final output
TypeScript typings / JSONata + Variables already done in earlier PRs

Also updated index.d.ts / index.d.mts (new trace(), ResourceReference, Transition, handlerBasePath) — verified with tsc under node16 resolution for both CJS and ESM.

Verified

  • pnpm test96 passing, 5 skipped (8 new tests) ✓
  • pnpm lint (ESLint + Prettier) ✓
  • pnpm test:smoke
  • pnpm audit → no known vulnerabilities ✓
  • CLI + dual type-check confirmed manually ✓

Notably, two of these items surfaced real latent bugs (Parallel/Map Catch not firing; the ErrorState.ALL typo), now fixed with tests.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QznGWnSQuwvNRAcYinsZiG


Generated by Claude Code

jamoy and others added 4 commits June 22, 2026 08:24
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
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.

1 participant