Skip to content

Allow active states to omit schemas - #105

Merged
SandroMaglione merged 2 commits into
mainfrom
codex/schema-less-states
Aug 14, 2026
Merged

Allow active states to omit schemas#105
SandroMaglione merged 2 commits into
mainfrom
codex/schema-less-states

Conversation

@SandroMaglione

Copy link
Copy Markdown
Member

Summary

  • allow atomic, compound, parallel, and final active states to omit schema when they own no data
  • preserve typed builders, handler contexts, snapshots, history, serialization, and selectors for structural states
  • keep optimized execution fail-closed to the generic planner until indexed absent-value semantics are explicit
  • migrate eight example machines and teach MachineTest.verify to validate structural configurations and history

Changeset

  • Added or updated for a library or package-metadata change
  • Not required because this PR does not change src/ or package.json

Validation

  • pnpm check
  • Relevant example checks, when examples changed
  • Automated type-performance measurement passed or was not required
  • Automated runtime- and memory-performance measurement passed or was not required

Local validation included pnpm check, pnpm perf:types, pnpm perf:runtime, and pnpm check in the platformer, playground, and Pokémon example packages.

@github-actions

Copy link
Copy Markdown
Contributor

Type performance

Measured with TypeScript 6.0.3 and skipLibCheck=true.

Scenario Base PR Difference
Effect only 55 55 0 (0.0%)
Import effect-machine 55 55 0 (0.0%)
Machine.defineStates (3 states) 2,965 3,039 +74 (+2.5%)
Machine.make (3 states, 2 events) 8,715 9,192 +477 (+5.5%)
machine.handle (3 states, 2 transitions) 23,492 25,009 +1,517 (+6.5%)
machine.handle (depth 24) 183,851 179,772 -4,079 (-2.2%)
machine.handle (wide depth 16) 214,189 209,566 -4,623 (-2.2%)
machine.handle (parallel/history/choice) 132,667 120,540 -12,127 (-9.1%)
machine.handle (4 successive calls) 128,674 118,189 -10,485 (-8.1%)
machine exact input/output/error/services 110,584 94,029 -16,555 (-15.0%)
execution adapter readiness 127,854 112,013 -15,841 (-12.4%)

Marginal instantiations are measured against the matching setup without that API call:

Scenario Base PR Difference
Import effect-machine 0 0 0
Machine.defineStates (3 states) 2,910 2,984 +74 (+2.5%)
Machine.make (3 states, 2 events) 5,742 6,145 +403 (+7.0%)
machine.handle (3 states, 2 transitions) 14,777 15,817 +1,040 (+7.0%)
machine.handle (depth 24) 171,577 163,541 -8,036 (-4.7%)
machine.handle (wide depth 16) 202,224 194,396 -7,828 (-3.9%)
machine.handle (parallel/history/choice) 114,331 98,780 -15,551 (-13.6%)
machine.handle (4 successive calls) 113,703 101,001 -12,702 (-11.2%)
machine exact input/output/error/services 100,670 82,906 -17,764 (-17.6%)
execution adapter readiness 102,092 83,380 -18,712 (-18.3%)
Check times (informational)
Scenario Base PR
Effect only 0.03s 0.03s
Import effect-machine 0.03s 0.03s
Machine.defineStates (3 states) 0.09s 0.09s
Machine.make (3 states, 2 events) 0.15s 0.15s
machine.handle (3 states, 2 transitions) 0.23s 0.22s
machine.handle (depth 24) 0.63s 0.63s
machine.handle (wide depth 16) 0.70s 0.66s
machine.handle (parallel/history/choice) 0.57s 0.51s
machine.handle (4 successive calls) 0.55s 0.49s
machine exact input/output/error/services 0.47s 0.41s
execution adapter readiness 0.53s 0.48s

Type instantiations are the comparison metric. Check time varies with runner load and is informational only.

@github-actions

Copy link
Copy Markdown
Contributor

Runtime performance

Median of 5 independent benchmark processes on INTEL(R) XEON(R) PLATINUM 8573C with Node v24.19.0.

Pull request baseline

Scenario Effect Machine
Plan counter transitions 149,827 transitions/s
Drain burst with terminal fence 614,808 increments/s
Drain burst with a change observer 571,842 increments/s
Lookup and send to one child 506,050 increments/s
Start and stop a machine 202,388 machines/s
Start and stop a parent with one child 52,458 families/s
Plan transitions through a compound state 137,748 transitions/s
Plan transitions through parallel regions 105,362 transitions/s
Drain burst through a compound state 507,182 events/s
Drain burst through two parallel regions 487,666 events/s
Drain a compound-state burst with a change observer 488,340 events/s

Process runtime reference points

Scenario Effect Machine
Start and stop a raw generic process 33,038 processes/s
Start and stop a raw compiled process 84,360 processes/s
Memory profile Effect Machine
Idle machine 1.5 KiB
Raw generic managed process 12.7 KiB
Raw compiled process 2.8 KiB
Two independent idle machines 3.0 KiB
Idle parent with one child 4.8 KiB
Parent with observed child registry 9.0 KiB
Parent with observed invoked child snapshots 5.0 KiB

Effect Machine change from base

Metric Base Base variability PR PR variability Difference
Plan counter transitions 148,717 transitions/s 1.2% MAD 149,827 transitions/s 1.6% MAD +0.7%
Drain burst with terminal fence 584,286 increments/s 3.1% MAD 614,808 increments/s 2.5% MAD +5.2%
Drain burst with a change observer 545,429 increments/s 3.1% MAD 571,842 increments/s 2.6% MAD +4.8%
Lookup and send to one child 486,751 increments/s 3.8% MAD 506,050 increments/s 1.9% MAD +4.0%
Start and stop a machine 202,511 machines/s 0.4% MAD 202,388 machines/s 0.9% MAD -0.1%
Start and stop a parent with one child 54,532 families/s 0.8% MAD 52,458 families/s 0.5% MAD -3.8%
Plan transitions through a compound state 135,423 transitions/s 1.4% MAD 137,748 transitions/s 0.3% MAD +1.7%
Plan transitions through parallel regions 104,849 transitions/s 1.3% MAD 105,362 transitions/s 1.7% MAD +0.5%
Drain burst through a compound state 509,092 events/s 0.9% MAD 507,182 events/s 2.1% MAD -0.4%
Drain burst through two parallel regions 480,511 events/s 3.5% MAD 487,666 events/s 0.3% MAD +1.5%
Drain a compound-state burst with a change observer 479,707 events/s 0.6% MAD 488,340 events/s 1.8% MAD +1.8%
Idle machine heap per unit 1.5 KiB 0.1% MAD 1.5 KiB 0.1% MAD -0.0%
Raw generic managed process heap per unit 12.7 KiB 0.0% MAD 12.7 KiB 0.0% MAD -0.0%
Raw compiled process heap per unit 2.8 KiB 0.2% MAD 2.8 KiB 0.0% MAD -0.5%
Two independent idle machines heap per unit 3.0 KiB 0.0% MAD 3.0 KiB 0.0% MAD +0.0%
Idle parent with one child heap per unit 4.8 KiB 0.0% MAD 4.8 KiB 0.0% MAD -0.0%
Parent with observed child registry heap per unit 9.0 KiB 0.0% MAD 9.0 KiB 0.0% MAD +0.0%
Parent with observed invoked child snapshots heap per unit 5.0 KiB 0.1% MAD 5.0 KiB 0.1% MAD +0.1%

Process runtime reference change from base

Metric Base Base variability PR PR variability Difference
Start and stop a raw generic process 32,822 processes/s 1.3% MAD 33,038 processes/s 2.2% MAD +0.7%
Start and stop a raw compiled process 83,850 processes/s 0.9% MAD 84,360 processes/s 0.8% MAD +0.6%

Regression guard

No large, noise-adjusted throughput or heap regressions detected.

Versions and interpretation
  • Effect Machine: 0.7.0

Higher throughput is better; lower heap is better. Variability is the median absolute deviation across independent processes, relative to their median. Small differences on shared GitHub-hosted hardware remain informational; the required guard rejects only large changes beyond the measured noise allowance.

@SandroMaglione
SandroMaglione merged commit e02dba3 into main Aug 14, 2026
13 checks passed
@SandroMaglione
SandroMaglione deleted the codex/schema-less-states branch August 14, 2026 13:45
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