docs/plans/2026-04-18-slate-v2-slate-accessor-batch-wave-plan.md
Recover the next highest-leverage slate API seam that is actually backed by
the real draft in .tmp/slate-v2-draft:
getChildrensetChildrenEditor.getSnapshot(...)Editor.replace(...)Editor.reset(...)Editor.subscribe(...)Editor.withTransaction(...)Transforms.applyBatch(...)Primary truth, in order:
../slate/packages/slate/** and
../slate/docs/**.tmp/slate-v2/packages/slate/**.tmp/slate-v2-draft/packages/slate/**Hard rule:
The source-first audit for:
Editor.before(...)Editor.after(...)Editor.positions(...)showed those runtime files were already effectively same-path close to legacy.
By contrast, the accessor/transaction surface was still a real shipped narrowing:
slate-v2 had dropped getChildren / setChildrenslate-v2 had no public snapshot/listener seamslate-v2 had no public transaction seamslate-v2 had no Transforms.applyBatch(...)getChildrensetChildrenEditor.withTransaction(...)Transforms.applyBatch(...)Use $tdd.
Execution shape:
Draft-backed RED slices pulled first:
surface-contract.tstransaction-contract.tstransaction-contract.tsapplyBatch(...) parity with manual withTransaction(...)Current tests kept alive:
Recovered in interfaces/editor.ts:
getChildrensetChildrengetSnapshotreplaceresetsubscribewithTransactionAdded lightweight public transaction/accessor state in public-state.ts instead of importing the whole draft batching subsystem.
Recovered in create-editor.ts:
children accessor routed through those methodsRecovered in general.ts:
Transforms.applyBatch(...) as thin sugar over
Editor.withTransaction(...)Updated apply.ts to suppress ordinary flush scheduling inside an active transaction and publish once at commit.
Added focused public-seam coverage in accessor-transaction.test.ts:
getChildren / setChildrenEditor.setChildren(...) routes through the overrideable instance methodEditor.withTransaction(...) keeps replacement state visible and publishes
once on exitTransforms.applyBatch(...) matches manual
Editor.withTransaction(...) for:
set_nodewithTransaction(...) rolls back staged changes on throwAlso restored 108 same-path legacy JSX fixture files under
packages/slate/test/** so the current index.spec.ts harness was honest
again instead of failing on broken fixture imports.
The real draft transaction seam is Editor.withTransaction(...).
Editor.withBatch(...) is not in the real draft source of truth.
This wave therefore does not claim withBatch(...) is recovered. If we
want that legacy compatibility name later, it should be a separate explicit
decision.
Exact legacy partial-commit-on-throw batch semantics remain cut.
cd /Users/zbeyens/git/slate-v2 && bun installcd /Users/zbeyens/git/slate-v2 && bunx turbo build --filter=./packages/slatecd /Users/zbeyens/git/slate-v2 && bunx turbo typecheck --filter=./packages/slatecd /Users/zbeyens/git/slate-v2 && bun run lint:fixcd /Users/zbeyens/git/slate-v2/packages/slate && bun test ./test/accessor-transaction.test.tscd /Users/zbeyens/git/slate-v2/packages/slate && bun test ./test/index.spec.tsThe draft-backed accessor/transaction/applyBatch wave is green.
The next tranche-3 move should be chosen by rereading the ledgers against this landed seam, not by reusing the stale pre-wave queue.