Skip to content

refactor(universal): extract transition batch controller (issue-66 A3) - #69

Merged
Huxpro merged 1 commit into
new-lynxfrom
refactor/universal-kernel-transitions
Aug 19, 2026
Merged

Huxpro merged 1 commit into
new-lynxfrom
refactor/universal-kernel-transitions

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #68; Phase A3 transition-batch slice of #66.

  • moves active/in-flight transition state, pending listeners, nested/async entanglement, promotion, cross-root settlement, and promotion re-homing into one host-neutral kernel controller
  • universal core injects owner→root lookup, queue membership/enqueueing, scheduleTransition, discardTransitionBatch, root/fallback microtasks, and discrete notification scope
  • keeps root implementation, hook queue replay/rebase, and renderer policy in universal-core.ts
  • adds a public-root guard for pending false → true → false around staged state 0 → 1
  • patch changeset and living-spec §8 status

The next A3 slice still owns formatUniversalId, warm memo tokenization, and readBridgeContext; owner claiming remains last.

Red-green / differential evidence

  • Before extraction, the issue-prescribed guard set was green.
  • Final guard set (kernel + scheduling/event-scope/retained-Suspense/Activity/renderer) is 12 files / 342 tests green in dev/prod.
  • Deliberate break: replacing injected root microtask scheduling with a no-op left the public-root guard stuck at pending=true,count=0 instead of final false,1; dev and prod both failed. Restoring the service returned it to green.
  • Existing scheduling coverage includes nested/async transitions, urgent rebases, hidden Activity, retained Suspense, pre/post-ACK transport failures, root unmount before/after promotion, and cross-root promotion re-homing.

Same-window performance evidence

Temporary public-runtime harness, B/A/B/A, each window 7 samples × 200 startTransition updates with final count=200 semantic control:

base (#68) candidate
window 1 median 0.0559 ms 0.0591 ms
window 2 median 0.0576 ms 0.0579 ms

The first-window ~0.003 ms difference did not reproduce; this is equivalence evidence, not a performance claim. One pre-existing two-day Vite preview process was present on the host and left untouched.

Validation

  • pnpm sync
  • scoped format + tsgo for all changed files
  • issue-prescribed universal guard set — 12 files / 342 tests
  • transition B/A/B/A with semantic control
  • octane + octane-prod full projects were not re-run after A3; A2's broad run was environment-failed by SG1 inotify EMFILE, while its relevant isolated failures and all universal guards passed
  • pnpm test (full repository)

Risk / follow-ups

  • This is a state-machine move, not a semantic redesign. The service callbacks are monomorphic and controller-allocated once per core; batches retain the previous per-transition allocation shape.
  • Root service methods are still universal-specific implementations behind the injected table. A3 root-service extraction and owner claiming remain ordered follow-ups.
  • No fresh-core fallback is indicated: all universal behavior guards remain green.

Provenance

  • An agent produced this diff (agent-authored)

Move active and in-flight transition state, pending listeners, nested and async entanglement, promotion, cross-root settlement, and re-homing into the host-neutral kernel. Inject root scheduling, discard, microtask, and owner-queue services from universal-core; preserve the public transition lifecycle with a render-through-root guard.

Agent-Authored-By: TraeCode <[email protected]>

Trae-Session: 01a015c8-dc52-71b3-b929-2b5d818926bf
@Huxpro
Huxpro changed the base branch from refactor/universal-kernel-owner to new-lynx August 19, 2026 18:28
@Huxpro
Huxpro marked this pull request as ready for review August 19, 2026 18:28
@Huxpro
Huxpro merged commit 88af4dc into new-lynx Aug 19, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant