docs/solutions/developer-experience/2026-04-01-slate-batch-engine-should-separate-planning-and-execution.md
The batch engine worked, but the structure was drifting toward “everything important lives in apply.ts”.
That made the code harder to review for the wrong reason:
apply entrypoint had to coexist with batch planner and executor detailsThe result was not semantic confusion. It was file-organization confusion.
Split the engine by role:
packages/slate/src/core/apply.ts
packages/slate/src/core/batching/planner.ts
packages/slate/src/core/batching/executor.ts
That keeps the runtime model readable:
apply.ts answers “which mode are we in?”batching/planner.ts answers “what shape of batch is this?”batching/executor.ts answers “how do we execute that shape?”The useful rule is simple:
For this engine, the planner is not trivial anymore:
Once those rules exist, burying them inside apply.ts just turns the file into a junk drawer.
The runtime behavior stayed the same, but the call graph got easier to follow:
apply.ts is small againKeep the split.
If the batch engine grows again:
apply.tsapply.ts should stay boring. That is the point.