State machines, statecharts, and actors for complex logic
This report summarizes scanner evidence for statelyai/xstate, a TypeScript project with 30,381 GitHub stars. SynthScan examined 200,972 lines of code across 817 source files, recording 49 pattern matches distributed across 4 syntactic categories. The legacy adjusted pattern signal is 0.3 (Low pattern signal); it is not an authorship estimate.
Use the findings to ask whether maintainers can explain intent, verify dependencies, simplify unnecessary scaffolding, and focus review effort. Risk Payload v1 adds ownership, supply-chain, over-engineering, and review-effort vectors when available. These are prompts for human verification, not probabilities, security findings, or measured maintenance costs.
Use each vector to guide manual verification of the underlying findings.
Payload schema: 1.0.0 · Engine: 2.0.0 · Scoring: heuristic-density-v1 · Scan date: 2026-10-31.
Can maintainers explain intent, assumptions, and trade-offs? 45 finding(s).
Are imports declared and package/API names verified? 4 finding(s).
Are wrappers, guards, and repeated structures necessary? 27 finding(s).
Which changes need focused human review? 49 finding(s).
This chart tracks the legacy adjusted pattern score across scan runs. Changes can reflect source changes, scan coverage, or detector/scoring versions; they do not measure AI adoption or prove that a team refactored code. Compare runs only when their scoring versions are compatible. The dashed line tracks the raw pattern-hit count.
Groups findings by configured severity weight. Severity is not a confidence estimate, security rating, or proof that a package is missing. Verify imports against the project's manifests and inspect each finding in its local design context.
This horizontal bar chart shows where configured pattern scores accumulate across directories. Treat the bars as locations to inspect, not as evidence of authorship or code quality. Use the file-level findings to decide whether a directory needs a focused ownership, dependency, complexity, or review check.
The scanner identified 49 distinct pattern matches across 4 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a detector match to inspect in context. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the configured finding weight (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — legacy comment-context matches receive a ×1.5 score weight. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier under the legacy scoring model.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | packages/core/test/errors.test.ts | 30 | function installGlobalOnErrorHandler(handler: (ev: ErrorEvent) => void) { | CODE |
| LOW | packages/core/test/errors.test.ts | 495 | error: function preventUnhandledErrorListener() {} | CODE |
| LOW | packages/core/test/errors.test.ts | 531 | error: function preventUnhandledErrorListener() {} | CODE |
| LOW | packages/core/test/errors.test.ts | 534 | error: function preventUnhandledErrorListener() {} | CODE |
| LOW | packages/core/test/errors.test.ts | 567 | error: function preventUnhandledErrorListener() {} | CODE |
| LOW | packages/core/test/errors.test.ts | 811 | error: function preventUnhandledErrorListener() {} | CODE |
| LOW | packages/core/test/errors.test.ts | 985 | actorRef.subscribe({ error: function preventUnhandledErrorListener() {} }); | CODE |
| LOW | packages/core/test/errors.test.ts | 1014 | actorRef.subscribe({ error: function preventUnhandledErrorListener() {} }); | CODE |
| LOW | packages/core/test/rehydration.test.ts | 374 | actorRef.subscribe({ error: function preventUnhandledErrorListener() {} }); | CODE |
| LOW | packages/core/test/utils.ts | 96 | function addTrackingActionsRecursively(state: StateNode<any, any>) { | CODE |
| LOW | packages/core/test/actorLogic.test.ts | 198 | actorRef.subscribe({ error: function preventUnhandledErrorListener() {} }); | CODE |
| LOW | packages/core/test/actorLogic.test.ts | 217 | actorRef2.subscribe({ error: function preventUnhandledErrorListener() {} }); | CODE |
| LOW | packages/core/src/StateMachine.ts | 628 | function resolveHistoryReferencedState( | CODE |
| LOW | packages/core/src/utils.ts | 281 | export function getAllOwnEventDescriptors(snapshot: AnyMachineSnapshot) { | CODE |
| LOW | packages/core/src/stateUtils.ts | 550 | function getInitialStateNodesWithTheirAncestors(stateNode: AnyStateNode) { | CODE |
| LOW | packages/core/src/stateUtils.ts | 847 | function removeConflictingTransitions( | CODE |
| LOW | packages/core/src/stateUtils.ts | 986 | function areStateNodeCollectionsEqual( | CODE |
| LOW | packages/core/src/stateUtils.ts | 1462 | function addProperAncestorStatesToEnter( | CODE |
| LOW | packages/core/src/stateUtils.ts | 1557 | function resolveAndExecuteActionsWithContext( | CODE |
| LOW | packages/core/src/stateUtils.ts | 1834 | function selectEventlessTransitions( | CODE |
| LOW | packages/core/src/graph/TestModel.ts | 346 | function serializeMachineTransition( | CODE |
| LOW | packages/core/src/graph/graph.ts | 110 | export function createDefaultLogicOptions(): TraversalOptions<any, any, any> { | CODE |
| LOW | packages/xstate-store-react/src/index.ts | 58 | function createStoreFromDefinition(definition: AnyStoreConfig) { | CODE |
| LOW | packages/xstate-store/src/validate.ts | 67 | function getStoreValidationErrorMessage(options: StoreValidationErrorOptions) { | CODE |
| LOW | packages/xstate-store/src/persist.ts | 1046 | function assertBroadcastChannelAvailable(): void { | CODE |
| LOW | packages/xstate-store/src/persist.ts | 1093 | export function subscribeToBroadcastStorage(store: { | CODE |
| LOW | packages/xstate-store/src/store.ts | 118 | export function assertNoInternalEventTypeCollisions( | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | README.md | 481 | }); | COMMENT |
| LOW | examples/tiles/src/App.tsx | 21 | backgroundSize: '600% center' | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 161 | 'test192.txml', | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 181 | // 'test230.txml', // autoForward not supported in v5 | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 201 | // 'test278.txml', // non-root datamodel with early binding not implemented yet | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 221 | // 'test319.txml', // SCXML has no init event, so _event stays unbound in onentry of initial state | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 281 | 'test445.txml', | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 301 | // 'test506.txml', // `reenter` semantics in v5 are different from SCXML type="internal"/"external" transitions, we | COMMENT |
| LOW | packages/core/test/scxml.test.ts | 321 | // 'test553.txml', // namelist not implemented yet + errored send not dispatching an event | COMMENT |
| LOW | packages/core/test/types.test.ts | 4421 | it('should reject a start callback that is an async function', () => { | COMMENT |
| LOW | packages/core/src/createActor.ts | 701 | } | COMMENT |
| LOW | packages/core/src/graph/deduplicatePaths.ts | 41 | for (const i in pathWithEventSequence.eventSequence) { | COMMENT |
| LOW | packages/xstate-store/CHANGELOG.md | 1121 | ## 3.0.1 | COMMENT |
| LOW | packages/xstate-store/CHANGELOG.md | 1301 | // DEPRECATED API | COMMENT |
| LOW | packages/xstate-store/CHANGELOG.md | 1681 | // count: 1, | COMMENT |
| LOW | templates/svelte-ts/src/vite-env.d.ts | 1 | /// <reference types="svelte" /> | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | README.md | 41 | - **[`xstate`](#super-quick-start)**: state machines, statecharts, actors, effects, and orchestration for complex app lo | CODE |
| MEDIUM | examples/readme.md | 5 | 1. In the CLI, navigate to the `/examples` folder. Start a [new Vite project](https://vitejs.dev/guide/#scaffolding-your | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/workflow-credit-check/main.ts | 141 | name: 'John Doe', | CODE |
| LOW | examples/workflow-reusing-functions/main.ts | 211 | name: 'John Doe' | CODE |
| LOW | examples/workflow-new-patient-onboarding/main.ts | 146 | name: 'John Doe', | CODE |
| LOW | examples/workflow-book-lending/main.ts | 278 | name: 'John Doe', | CODE |