Skip to content

Add createFlow name and run the node:test files - #7

Merged
javaquasar merged 2 commits into
mainfrom
claude/flow-names
Dec 2, 2026
Merged

javaquasar merged 2 commits into
mainfrom
claude/flow-names

Conversation

@javaquasar

Copy link
Copy Markdown
Owner

Summary

Two small fixes found while reviewing the project's remaining weak spots.

createFlow({ name })

flowName used to be derived from the adapter name or from action.name. That name now ends up in:

  • events;
  • devtools;
  • OpenTelemetry span names (mutaflow <flowName>);
  • Sentry tags.

Function names are fragile:

  • minifiers can rename them in production builds;
  • an arrow function written inline as action: (input) => ... is named just "action".

The new test confirms the second case.

export const createTodoFlow = createFlow({ name: "createTodo", action: createTodoAction });

name takes precedence over the adapter name and the function name. Without it, the old fallback order still applies. Both examples now set it. The next-app example keeps the same name createTodoAction, so useFlowState(events, "createTodoAction") is unchanged.

Test files that never ran

tests/core.test.mjs and tests/next.test.mjs are written for node:test, but npm test only ran scripts/run-tests.mjs. Neither file ran locally or in CI. All 5 tests in them pass.

npm test now runs node --test tests/core.test.mjs tests/next.test.mjs after the main suite. The files are listed explicitly because Node 20 in the CI matrix does not support glob patterns in --test.

Test plan

  • npm run typecheck from a clean build
  • npm test: 54/54 in the main suite, including a new flow-name precedence test, plus 5/5 node:test
  • examples/next-app: typecheck and next build

This branch is based on main and is independent of #6. Both touch types.ts and CHANGELOG.md, in different places.

🤖 Generated with Claude Code

createFlow({ name }) sets a stable flowName for events, devtools,
OpenTelemetry spans and Sentry tags. It takes precedence over the
adapter name and the action function name, which minifiers can rename
in production builds (an arrow function in `action:` is just "action").
Both examples set it.

tests/core.test.mjs and tests/next.test.mjs were written for node:test
but never ran. npm test, and so CI, now runs them after the main suite.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@javaquasar javaquasar mentioned this pull request Dec 2, 2026
4 tasks done
…aude/flow-names

# Conflicts:
#	CHANGELOG.md
#	scripts/run-tests.mjs
@javaquasar
javaquasar merged commit 6f05616 into main Dec 2, 2026
3 checks passed
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