Refactor/project manager#7754
Merged
walterbender merged 3 commits intoJul 7, 2026
Merged
Conversation
0089c7f to
5972f7b
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7754 +/- ##
==========================================
+ Coverage 56.80% 57.43% +0.62%
==========================================
Files 172 173 +1
Lines 57683 57707 +24
==========================================
+ Hits 32767 33142 +375
+ Misses 24916 24565 -351 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…anager Move project loading, saving, import, session restore, and initialization logic from activity.js into a new js/project-manager.js module. The module exposes a clean public API via setupProjectManager(activity) and delegates all calls from activity to the new ProjectManager class. No behavioral changes; all existing functionality is preserved. What was moved - doLoadAnimation / stopLoadAnimation — loading animation lifecycle - _loadStart / _loadProject / loadStartWrapper / justLoadStart — orchestration - doLoad / doMergeLoad / _afterDelete / newProject — UI-triggered operations - prepareExport / saveLocally — save/export logic - runProject / getClosestStandardNoteValue — runtime helpers - File chooser, drag-drop handlers — file/drag-drop import - _midiImportBlocks — MIDI import modal - start() — URL parameter parsing + initial load loader.js: add "project-manager" to the activity/activity shim deps list and paths map. Without these entries RequireJS resolved the module to ./project-manager.js (404), crashing startup before Activity() could run. Updated activity_startup_recovery.test.js and activity_toolbar_integration .test.js to exercise the extracted code directly from project-manager.js. Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
Add 105 tests covering all public methods of the extracted ProjectManager class, raising statement coverage from 0% to 72.79% and clearing the Codecov patch coverage gate (≥56.80%). Coverage highlights - doLoadAnimation: interval, counter wrap at 9 ticks - _loadStart: no session, existing session, bad session key removal, textMsg error recovery - _loadProject: 2500ms timeout body, textMsg error, missing planet methods, __functionload branch (run:true / firstRun:true) - prepareExport: value blocks (chord, note, default), named blocks (start, temperament1, nopValueBlock, matrixData, wrapmode), null entry - saveLocally: happy path, allProjects setter error, thumbnail via Image.onload, canvas getContext error - _midiImportBlocks: confirm button presence, cancel removes modal - _setupFileHandlers: click clears value, change handler (null file, MIDI, read error, no file selected) - start(): single-param id URL, multi-param id URL, unknown param, callback scheduling; window.history.replaceState used instead of delete window.location (non-configurable in jsdom 26) Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
c176444 to
4f77131
Compare
Replace four tests that asserted pubsub.on/off was called (implementation details) with behavior-based equivalents: - _loadStart: checks keyboardEnableFlag returns to 1 after finishedLoading - _loadStart: emits event twice, verifies stage.update not called twice - _loadProject: checks _toggleCollapsibleStacks, _changeBlockVisibility, and firstRun=false after event fires (instead of spying on pubsub.on) - _loadProject: emits event twice, verifies no double-invocation - runProject: pubsub.off there is a defensive no-op so the spy test is replaced with a direct assertion that the 5s work fires once per call Behavior tests survive implementation refactors; spy-on-internal-call tests do not. Signed-off-by: Vanshika <pahalvanshikaa@gmail.com>
Member
|
great work @vanshika2720 |
Ashutoshx7
approved these changes
Jul 7, 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.
Summary
js/activity.jsinto a newjs/project-manager.jsmodulesetupProjectManager(activity)which creates aProjectManagerinstance wired to the activity — no new globals addedactivity.jsare replaced with thin delegate wrappers that forward tothis.projectManager, preserving the existing public APIWhat was moved
doLoadAnimation/stopLoadAnimation/showContents— loading animation lifecycle_loadStart/_loadProject/loadStartWrapper/justLoadStart— load orchestrationdoLoad/doMergeLoad/_afterDelete/newProject— UI-triggered load/new operationsprepareExport/saveLocally/__saveLocally— save/export logicrunProject— runtime entry pointgetClosestStandardNoteValue— MIDI note helperchangeevent handler,__handleFileSelect,__handleDragOver— file/drag-drop importprojectManager.start()midiImportBlocks— MIDI import modalNo behavioral changes
This is a pure extraction refactor. All existing functionality, event sequencing (including the trash handshake), session restore behavior, merge logic, and planet integration are preserved exactly.
Test plan
activity_startup_recovery.test.jsupdated to testProjectManager._loadStart,runProject, and_loadProjectdirectly fromproject-manager.jsactivity_toolbar_integration.test.jsupdated to mocksetupProjectManagerin vm sandboxRefactoring Notes