Skip to content

fix(sync): resolve sync-engine interval leak, brace syntax error, and duplicate handlers#1

Open
AdityaM-IITH wants to merge 342 commits into
arpitkhandelwal12:mainfrom
AdityaM-IITH:fix/sync-engine-timer-leak
Open

fix(sync): resolve sync-engine interval leak, brace syntax error, and duplicate handlers#1
AdityaM-IITH wants to merge 342 commits into
arpitkhandelwal12:mainfrom
AdityaM-IITH:fix/sync-engine-timer-leak

Conversation

@AdityaM-IITH
Copy link
Copy Markdown

Overview

This PR resolves an architectural interval leak in the synchronization engine, repairs a broken method boundary parsing error, and cleans up duplicate handler signatures introduced from a previous merge conflict.

Changes Executed

  • Memory/CPU Leak Fix: Declared a private antiEntropyTimer reference to store the setInterval identity. Updated enable() to assign it and disable() to cleanly execute clearInterval upon state toggles.
  • Syntax Repair: Restored the missing closing curly brace on the disable() method, preventing the parser from nestedly wrapping registerPlugin().
  • Type Cleanup: Removed parameterless, duplicate definitions of onPeerConnected and onPeerDisconnected, preserving only the fully-typed, parameterized signatures.

Verification Matrix

  • npx pnpm install --frozen-lockfile exits with 0
  • pnpm turbo typecheck passes cleanly across the sync package workspace

KGFCH2 and others added 30 commits May 16, 2026 22:28
* feat(core): add shared Logger utility

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Arpit Khandelwal <71580150+arpittkhandelwal@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* feat(cli): add maintenance mode command to signal server (#277)

* chore: add lighthouse ci to ensure blazing fast docs

* fix: resolve lighthouse contrast and noopener warnings

* fix: remove brittle startServerReadyPattern

* fix: use desktop preset for lighthouse to avoid mobile throttling

---------

Co-authored-by: ananya4khandelwal <ananyakhandelwal274@gmail.com>
…s (#242)

* feat(ui): add Copy to Clipboard functionality for Identity Public Keys

* feat(ui): add Copy to Clipboard functionality for Identity Public Keys

* feat(ui): add Copy to Clipboard functionality for Identity Public Keys

- Add copy-to-clipboard button for Ed25519 public keys
- Refactor timeout management using useRef instead of state
- Add toast notifications with accessibility attributes
- Fix linting issues and formatting

* fixed linting

* chore: fix line endings in CONTRIBUTING.md

* added aria-label
* Add inbox/outbox queues for sync updates

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Acknowledge inbox entries after remote apply

* chore: add happy-dom for vitest

* ci: remove emojis to match branch protection rules

* ci: remove emoji from lighthouse job name

* chore: lower lighthouse thresholds to prevent flaky CI failures

---------

Co-authored-by: Atul Upadhyay <atul-upadhyay192@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gemini CLI <gemini-cli@example.com>
* feat(devtools): add memory usage visualizer for IndexedDB and WebRTC

Introduces zerithdb-devtools collector package and Chrome DevTools extension
with live charts, peak tracking, and per-peer buffer breakdown. Opt in via
debug.devtools when calling createApp. Closes #270.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): resolve formatting issues and update ci workflows

* fix: format

---------

Co-authored-by: Atul Upadhyay <atul-upadhyay192@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Gemini CLI <gemini-cli@example.com>
* feat(graphql): auto-generate mutations for ZerithDB collections

Adds zerithdb-graphql package that builds GraphQL SDL and mutation resolvers
from CollectionSchema definitions, mapping insert/update/delete to app.db() calls.
Closes #280.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(ci): resolve formatting issues and update ci workflows

---------

Co-authored-by: Atul Upadhyay <atul-upadhyay192@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Gemini CLI <gemini-cli@example.com>
* Add Auth0 integration package and guide

* Potential fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* fix(auth0): resolve typecheck errors and remove emojis in ci.yml

---------

Co-authored-by: Atul Upadhyay <atul-upadhyay192@gmail.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Gemini CLI <gemini-cli@example.com>
…ckages (#469)

Critical fixes:
- sync-engine: bytesToBase64 crashes on large CRDT payloads (>64KB) due to
  spread operator exceeding call stack — now processes in 8KB chunks
- sync-engine: encodeMessage/decodeMessage use single-byte name length header,
  silently corrupting payloads for collection names >255 bytes — now uses
  2-byte big-endian header
- network-manager: ICE candidates sent with wrong signaling type ('offer'/'answer')
  instead of 'ice-candidate', breaking WebRTC connections in ~30% of network
  conditions — now inspects data.type from simple-peer

High-severity fixes:
- react/index.tsx: useQuery called non-existent subscribe() and collection()
  APIs, and passed raw id to delete() instead of QueryFilter — complete rewrite
  using actual ZerithDB API with polling
- react/index.tsx: ZerithProvider never called dispose() on unmount, leaking
  WebRTC connections, IndexedDB handles, and Yjs documents — added cleanup
- sdk/create-app.ts: redundant collection cache created inconsistent type
  references — removed in favor of DbClient's internal cache

Medium-severity fixes:
- db-client: matchesFilter treated all non-null objects as operator specs,
  breaking queries on nested object fields — now detects operators by $ prefix
- network-manager: autoReconnect config was ignored, reconnection always ran —
  now checks config before scheduling
- cli/init.ts: chat and notes templates fell through to blank template — added
  dedicated template generators

Co-authored-by: arpittkhandelwal <arpitkhandelwal810@gmail.com>
Embed a live code editor on the landing page where visitors can run insert/find queries and watch simulated P2P CRDT sync between two clients.

Closes #240

Co-authored-by: Cursor <cursoragent@cursor.com>
refactor(playground): optimize client components and fix message over…
docs(infra): add bug report and feature request templates
Shravani-36 and others added 30 commits May 17, 2026 21:08
fix(web): fixed unreadable navbar hover items in dark mode (#874)
feat(db): add support for $exists and improve $regex query operators (#871)
docs: add Awesome ZerithDB community list (#870)
feat(db): optimize collection count helper (#865)
test(utils): add edge case tests for zerithdb-utils #346 (#873)
feat(db): add graph traversal and edge support to ZerithDB (#872)
* feat: add Electron offline-first starter template example

* feat: add Electron offline-first starter template example

* fix: update pnpm lockfile for Electron starter template

* update pnpm lockfile
…(#900)

* feat: add custom 404 page for routing errors

* style: format custom 404 page with prettier

* fix(sdk): replace @ts-ignore with @ts-expect-error in create-app.test.ts
…904)

Refactor CollectionClient.find to use Dexie cursors instead of loading full collections into memory. This significantly reduces memory overhead and improves latency for large datasets by terminating scans early when a limit is reached.

Tasks:
- Refactor find() to use cursor-based iteration with .until()
- Add QueryOptions with limit and offset support
- Add pagination unit tests
- Add query benchmark script
…() (#921)

Co-authored-by: Laxmikanth <laxxmikanthyaga@gmail.com>
* feat(web): add visual schema builder MVP

* fix(schema-builder): address review feedback

* chore(lint): replace ts-ignore in sdk test

* perf(web): throttle schema builder dragging
* feat: add Firebase/Supabase to ZerithDB migrator (#803)

* Implement feature X to enhance user experience and optimize performance

* fix: address Copilot review comments

* chore: update uuid and vitest dependencies in package.json and pnpm-lock.yaml

* feat: enhance migration CLI with structured commands for Firebase and Supabase

* fix migrate lint and test issues

* fix: use query filter value type
… #785 (#926)

* feat(security): implement biometric-bound session keys #785

* chore(ci): trigger checks
Co-authored-by: Laxmikanth <laxxmikanthyaga@gmail.com>
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.