fix(web): restore surviving capability owners after backend teardown - #714
fix(web): restore surviving capability owners after backend teardown#714shubhamsinnh wants to merge 1 commit into
Conversation
|
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 (1)
Included review availability: Your plan includes up to 10 reviews per rolling hour; 9 remain after this review. 📝 WalkthroughWalkthrough
ChangesCapability ownership restoration
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change restores surviving Web SDK capability owners after backend teardown, with reported checks passing; no actionable merge-blocking risk remains beyond normal review. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant ModuleRegistry
participant WasmModuleRecord
participant ModalityProtoAdapter
ModuleRegistry->>WasmModuleRecord: record capability generations
ModuleRegistry->>WasmModuleRecord: remove unregistered module
WasmModuleRecord-->>ModuleRegistry: select highest-generation survivors
ModuleRegistry->>ModalityProtoAdapter: restore surviving dispatch routes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
bindings/web/packages/core/src/runtime/EmscriptenModule.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
fd13172 to
9860e65
Compare
Description
unregisterWasmModule()inEmscriptenModule.tsremoved every_recordByCapabilityslot owned by a torn-down backend. Because registration is last-writer-wins, unregistering a later module deleted the mapping even when an earlier sibling still claimed the same capability ?getModuleForCapability('llm')returnednulland facade verbs reported no backend, contradicting the function's own contract that teardown lets siblings keep their slots.The fix re-elects the most recently registered surviving sibling (highest registration generation for that capability) for each released capability, restores it in the capability registry, and re-registers it with
ModalityProtoAdapterso per-modality dispatch slots and the aggregatedefaultModulekeep pointing at a live module.reelectLifecycleAndRegistryPrimary()then correctly re-pins the lifecycle/model-registry adapters to the survivor instead of falling back to commons.Type of Change
Testing
Local (from
bindings/web/packages/core):npm run typecheck(exit 0, 0 errors),npm run lint(exit 0, 0 findings),npx vitest run tests/unit/runtime/EmscriptenModule.test.ts(9/9 passed),npm run test:unit(56 files / 244 tests passed).git diff --checkclean.Platform-Specific Testing (check all that apply)
Swift SDK / iOS Sample:
Kotlin SDK / Android Sample:
Flutter SDK / Flutter Sample:
React Native SDK / React Native Sample:
Web SDK / Web Sample:
Labels
Please add the appropriate label(s):
SDKs:
Swift SDK- Changes to Swift SDK (bindings/swift)Kotlin SDK- Changes to Kotlin SDK (bindings/kotlin)Flutter SDK- Changes to Flutter SDK (bindings/flutter)React Native SDK- Changes to React Native SDK (bindings/react-native)Web SDK- Changes to Web SDK (bindings/web)Commons- Changes to shared native code (core)Sample Apps:
Flutter Sample- Changes to Flutter example app (bindings/flutter/example)React Native Sample- Changes to React Native example app (bindings/react-native/example)Minimal Examples- Changes to an in-repo SDK harness (bindings/{swift,kotlin,web}/example)The iOS, Android, Web, and Electron consumer apps live in their own
repositories (
RunanywhereAI/runanywhere-{ios,android,web,electron}) ? openthose PRs there.
Checklist
Screenshots
Attach relevant UI screenshots for changes (if applicable):
Summary by CodeRabbit