Skip to content

refactor(universal): inject hook root services (issue-66 A3) - #74

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

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

Conversation

@Huxpro

@Huxpro Huxpro commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

Stacked on #69; Phase A3 hook-root-service slice of #66.

  • defines the narrow host-neutral root capabilities hooks consume: ID formatting, an opaque warm-memo token, and bridge-context fallback
  • render attempts carry the same root through that narrow interface; hooks no longer depend on the full UniversalRootImpl type
  • speculative memo caches are keyed by a per-root opaque token and retain the same WeakMap cleanup points
  • adds a public-root guard proving two hook slots receive distinct opaque IDs
  • patch changeset and living-spec §8 status

Owner claiming remains the final A3 seam and is intentionally not moved here.

Red-green / differential evidence

  • Final guard set (kernel, scheduling, event-scope, retained-Suspense, Activity, renderer, renderer-boundaries): 14 files / 396 tests green in dev/prod.
  • Existing guards cover useId abort/suspend/reclaim, warm sibling strata and >64 repeated occurrences, lazy loading, mixed DOM/universal bridge context including deliberate null/undefined, and transition behavior.
  • Deliberate break: making injected formatId ignore its index produced duplicate IDs; the new public-root guard failed in dev/prod (:octane-u1: === :octane-u1:). Restoring the service returned it to green.

Same-window performance evidence

universal-leaf-update, B/A/B/A, A3 transition base vs this slice:

scenario base windows candidate windows
scoped leaf, 4k clean siblings 0.037 / 0.039 ms 0.041 / 0.041 ms
root state, 4k clean siblings 6.654 / 6.565 ms 6.628 / 6.093 ms
root state, 4k dirty control 35.193 / 33.870 ms 35.200 / 36.969 ms

The result is mixed/inconclusive: the microsecond scoped difference has no whole-path corroboration, while clean/dirty root controls move in opposite directions. No performance improvement or regression claim is made; later slices should keep measuring the scoped path.

Validation

  • pnpm sync
  • scoped format + tsgo for all changed files
  • relevant universal guard set — 14 files / 396 tests
  • B/A/B/A universal-leaf-update with semantic controls
  • octane + octane-prod full projects not run in this slice; A2's broad run was environment-failed by SG1 inotify EMFILE, while relevant isolated failures and all universal guards passed
  • pnpm test (full repository)

Risk / follow-ups

  • One cold token object is allocated per root; the attempt adds only another reference to that same root. No per-hook/per-render object allocation was introduced.
  • Warm cache invalidation still happens at every prior suspension/new-attempt/shape-fallback point, now through the token.
  • Owner claiming is the final extraction seam before deciding whether the extraction-first path remains viable.

Provenance

  • An agent produced this diff (agent-authored)

Narrow universal hooks to injected ID formatting, opaque warm-memo token, and bridge-context services. Keep root policy and cache lifecycle in universal-core, add public-root distinct-ID coverage, and preserve abort, warm-stratum, and mixed-owner bridge behavior.

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

Trae-Session: 01a015c8-dc52-71b3-b929-2b5d818926bf
@Huxpro
Huxpro changed the base branch from refactor/universal-kernel-transitions 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 ad83cc7 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