Skip to content

refactor(universal): extract hook owner scheduling seam (issue-66 A2) - #68

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

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

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #67; Phase A2 of #66. This is the first behavioral-risk kernel extraction slice:

  • universal-kernel.ts now owns the minimal committed/draft hook-owner contracts: hook storage, update queues, disposed lifetime, and speculative needsRender
  • scheduleOwner is bound once through an injected callback; profiling and root.scheduleOwned remain universal-core policy
  • the universal owner records inherit those contracts instead of redeclaring them
  • a public universal-root guard drives captured state and reducer updates in one synchronous event boundary, checks the single batched commit, and proves stale setters are inert after unmount
  • patch changeset and living-spec §8 status

Transition globals/root services and owner claiming are intentionally untouched; those remain the ordered A3 seams.

Red-green / differential evidence

  • Baseline guard set before editing: 10 files / 334 tests green.
  • New render-through-root test is green in dev and prod.
  • Deliberate break: replacing the injected callback invocation with a no-op left the rendered host at {state:1,reduced:2} instead of {state:3,reduced:6}; both dev/prod copies failed. Restoring the callback returned the guard to green.
  • Final issue-prescribed guard set (universal-scheduling, universal-event-scope, universal-retained-suspense, universal-activity, universal-renderer, kernel guard): 12 files / 340 tests green.

Same-window performance evidence

node benchmarks/universal-leaf-update/run.mjs 5, B/A/B/A, A1 base vs this slice:

scenario base windows candidate windows
scoped leaf, 4k clean siblings 0.038 / 0.037 ms 0.040 / 0.040 ms
root state, 4k clean siblings 6.764 / 6.571 ms 6.927 / 6.615 ms
root state, 4k dirty control 34.417 / 34.815 ms 33.013 / 33.553 ms

No systematic regression or performance improvement is claimed; the small changes are within cross-window noise and the semantic controls stayed correct.

Validation

  • pnpm sync
  • scoped format + tsgo for all changed files
  • issue-prescribed universal guard set — 12 files / 340 tests
  • isolated broad-run failures: hmr.test.ts + deferred-hydration.test.ts in octane-prod — 2 files / 50 tests green
  • isolated react-hosted/web3-island.test.ts assertions — 2 project files / 4 tests pass
  • octane + octane-prod full projects: 833/837 files and 12,418 tests passed, but the run is not green: SG1 Vite fixtures exhausted inotify watches (EMFILE, 55,190 repeated watcher errors), causing 2 suite/test timeouts and one hydration wait failure. The latter two pass isolated; web3 assertions pass but its dev-server watcher still reports the same environment error.
  • pnpm test (full repository)

Risk / follow-ups

  • One extra monomorphic callback layer now sits on owner scheduling. B/A/B/A did not show a systematic regression; later kernel slices should keep this benchmark in their same-window set.
  • Transition batch globals and root services are still universal-core-owned and are next in A3.
  • No fresh-core fallback is indicated: all relevant universal behavior guards remain green.

Provenance

  • An agent produced this diff (agent-authored)

Move the minimal committed/draft hook-owner contracts into the host-neutral kernel and bind scheduleOwner through one injected core callback. Preserve profiling and root scheduling as renderer policy, with a render-through-public-root state/reducer guard and disposed-owner coverage.

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

Trae-Session: 01a015c8-dc52-71b3-b929-2b5d818926bf
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