Repository navigation
refactor(stems): lift #audio shim state into state.js SH container - #31
Conversation
Move the 7 reassigned shim scalars (shimsInstalled, shimsUsable, and the captured coreCurrentTimeDesc/corePausedDesc/coreDurationDesc/coreNativePlay/ coreNativePause) out of main.js's IIFE scope into an SH container in state.js, same rationale as S: ES imports are read-only bindings, so reassigned scalars need a container to mutate cross-module. These are read across the transport layer + onSongReady (SH.shimsUsable gates the takeover), so they must be shared, not module-private. Keystone for extracting the transport/shims layer next. Pure state-lift, no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR is a refactor-only “state lift” that moves the #audio transport-shim mutable scalars out of src/main.js’s IIFE scope into a shared SH container exported from src/state.js, matching the existing S container pattern and enabling future module extraction without running into read-only ES import bindings.
Changes:
- Added
export const SH = { … }insrc/state.jsto hold shim install/usable guards plus captured core descriptors and native play/pause functions. - Updated
src/main.jsto importSHand replace all former local shim scalars withSH.*accesses/mutations. - Updated the
onSongReadytakeover gate to useSH.shimsUsable.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/state.js | Introduces the new shared SH container for transport-shim mutable state. |
| src/main.js | Replaces local shim scalar variables with SH.* to centralize transport-shim state. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAudio transport shim state (install/usable flags, captured property descriptors, and native play/pause bindings) is moved from module-scoped local variables in src/main.js into a new shared SH object exported from src/state.js, with shim installation, delegation, and song-ready logic updated to read/write SH instead of locals. ChangesTransport shim state refactor
Estimated code review effort: 2 (Simple) | ~15 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Comment |
What
Step 8 — first keystone of the entangled-core split. Lifts the 7 reassigned shim scalars out of
main.js's IIFE scope into anSHcontainer instate.js:shimsInstalled,shimsUsable,coreCurrentTimeDesc,corePausedDesc,coreDurationDesc,coreNativePlay,coreNativePauseSame rationale as the
Scontainer (step 4b): ES imports are read-only bindings, so reassigned scalars can't beexport let— they needSH.x = …. These are read across the transport layer andonSongReady(SH.shimsUsablegates the sloppak takeover), so they must be shared, not private to the future shims module.Pure state-lift, no behavior change. No function moved yet — this unblocks extracting the transport+shims layer as a module (a later PR) without recreating the read-only-binding problem.
Tests
Full suite green (
npm test, 41 pass);tests/test_manifest.pygreen. Codex preflight: 0 issues. Rewrite audit: 0 double-prefixes, 0 bare refs left, no key/shorthand/string-literal collisions.Summary by CodeRabbit