refactor(worker-javascript): extract Phase 2 helpers from Core.js#1038
Open
dqnykamp wants to merge 5 commits intoDoenet:mainfrom
Open
refactor(worker-javascript): extract Phase 2 helpers from Core.js#1038dqnykamp wants to merge 5 commits intoDoenet:mainfrom
dqnykamp wants to merge 5 commits intoDoenet:mainfrom
Conversation
Begin breaking up the 13,837-line Core class by lifting seven self- contained, low-coupling helpers into TypeScript modules. The pattern matches the existing composed siblings (Dependencies.js, ParameterStack): each module is constructed with a `core` back-reference, and Core retains a thin delegating wrapper for every method/property that was previously on the class so external callers (CoreWorker, tests, components, and `coreFunctions`-bound references) continue to work unchanged. Modules extracted: - DiagnosticsManager.ts — diagnostics queue + source-location walk - StateVariableNameResolver.ts — pure-function name resolution utilities - VisibilityTracker.ts — visibility state and save/suspend timers - StatePersistence.ts — save to localStorage / database - AutoSubmitManager.ts — debounced answer-submit queue - NavigationHandler.ts — handleNavigatingToComponent, navigateToTarget - ResolverAdapter.ts — adapter to the external Rust name resolver No behavior change. Core.js drops from 13,837 to 12,909 lines. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Continues the Core.js breakup with six moderate-effort modules. Same pattern as Phase 1 (composed sibling holding a `core` back-reference, thin delegating wrapper on Core for every public method/property). No behavior change. Modules extracted: - RendererInstructionBuilder.ts — owns componentsToRender, componentsWithChangedChildrenToRender, rendererState; the dast instruction stream sent to the renderer - ProcessQueue.ts — owns processQueue, processing, stopProcessingRequests; async request queue and entry-point scheduling (executeProcesses, requestAction, requestUpdate, requestRecordEvent) - ComponentLifecycle.ts — stateless: registration, ancestors, defining-child splicing, propagation to shadows - ChildMatcher.ts — child-group matching, adapter substitution, rendered-child filtering (recursion guard only) - DeletionEngine.ts — stateless two-phase component deletion - ActionTriggerScheduler.ts — owns stateVariableChangeTriggers, actionsChangedToActions, originsOfActionsChangedToActions; trigger polling and chained-action graph Core.js drops from 12,909 to 11,253 lines (this PR), 13,837 → 11,253 since the refactor began (~18.7%). Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
|
This was referenced May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Stacked on #1036. This PR includes Phase 1's commits in its diff until #1036 merges; review Phase 2 by reading just the final commit, or use the commits tab to see Phase 2 changes in isolation. Once #1036 merges, this PR will auto-rebase and the diff will show only Phase 2.
Summary
Phase 2 of breaking up
packages/doenetml-worker-javascript/src/Core.js. Same pattern as Phase 1 (composed sibling holding acoreback-reference, thin delegating wrapper on Core for every public method/property). No behavior change.Net effect over both phases:
Core.jsdrops from 13,837 → 11,253 lines (-18.7%).Modules extracted in Phase 2
RendererInstructionBuilder.tscomponentsToRender,componentsWithChangedChildrenToRender,rendererState; the dast/instruction stream sent to the rendererProcessQueue.tsprocessQueue,processing,stopProcessingRequests; the async request queue and entry-point scheduling (executeProcesses,requestAction,requestUpdate,requestRecordEvent)ComponentLifecycle.tsregisterComponent,deregisterComponent,setAncestors,processNewDefiningChildren,spliceChildren,addChildrenAndRecurseToShadowsChildMatcher.tsDeletionEngine.tsActionTriggerScheduler.tsstateVariableChangeTriggers,actionsChangedToActions,originsOfActionsChangedToActions; trigger polling and chained-action graphSequencing rationale
Per the multi-phase plan: `RendererInstructionBuilder` and `ProcessQueue` first (highest readability per line, unblock downstream); `ChildMatcher` and `DeletionEngine` are larger but algorithmically isolated; `ActionTriggerScheduler` last because it shares `updateInfo` fields with the perform bodies still in Core.
Test plan
🤖 Generated with Claude Code