Skip to content

Fix plugin cloud sync: wire CloudSyncInvalidationBus to PluginManager#402

Merged
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
test01203:fix/plugin-cloud-sync
Jun 22, 2026
Merged

Fix plugin cloud sync: wire CloudSyncInvalidationBus to PluginManager#402
ProdigyV21 merged 1 commit into
ProdigyV21:mainfrom
test01203:fix/plugin-cloud-sync

Conversation

@test01203

Copy link
Copy Markdown
Contributor

Bug

PluginManager.triggerRemoteSync() always returned early due to dead code left from the old Supabase auth system:

if (true /* !authManager.isAuthenticated */) {
    return  // ← always exits here, nothing is ever pushed
}

As a result, adding/removing plugin repositories was saved locally only and never triggered a cloud push.

Fix

3 files changed:

1. CloudSyncInvalidationBus.kt

Add PLUGINS to the CloudSyncScope enum so the coordinator knows how to debounce plugin changes.

2. CloudSyncCoordinator.kt

Add 1000ms debounce for PLUGINS scope (between IPTV's 750ms and LOCAL_HISTORY's 2000ms).

3. PluginManager.kt (sideload)

  • Inject CloudSyncInvalidationBus
  • Replace dead triggerRemoteSync() implementation with invalidationBus.markDirty(CloudSyncScope.PLUGINS, ...)
  • Wire markDirty() to: addRepository, removeRepository, toggleScraper, toggleAllScrapersForRepo, setPluginsEnabled, flushPendingSync

Result

After this fix, any plugin change (add repo, remove repo, enable/disable scraper) will:

  1. Save locally as before
  2. Trigger CloudSyncCoordinator via the invalidation bus (1s debounce)
  3. Push the full snapshot (including pluginRepositories + pluginScrapers) to cloud
  4. Other devices sync down on next pull

Bug: PluginManager.triggerRemoteSync() always returned early due to
dead code (if (true) { return }) from old Supabase auth guard.
Plugin adds/removes/toggles were saved locally but never pushed to cloud.

Fix:
- Add CloudSyncScope.PLUGINS to the invalidation scope enum
- Add PLUGINS debounce (1000ms) to CloudSyncCoordinator
- Inject CloudSyncInvalidationBus into sideload PluginManager
- Replace dead triggerRemoteSync() with invalidationBus.markDirty()
- Wire markDirty() to: addRepository, removeRepository, toggleScraper,
  toggleAllScrapersForRepo, setPluginsEnabled, flushPendingSync
@ProdigyV21 ProdigyV21 merged commit a6e99ba into ProdigyV21:main Jun 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants