Skip to content

feat(db): add vector-clock time travel queries#2

Open
anweshabhattacharyya wants to merge 352 commits into
arpitkhandelwal12:mainfrom
anweshabhattacharyya:feat/peer-naming
Open

feat(db): add vector-clock time travel queries#2
anweshabhattacharyya wants to merge 352 commits into
arpitkhandelwal12:mainfrom
anweshabhattacharyya:feat/peer-naming

Conversation

@anweshabhattacharyya
Copy link
Copy Markdown

@anweshabhattacharyya anweshabhattacharyya commented May 19, 2026

Summary

This PR introduces vector-clock based time travel capabilities to ZerithDB, enabling causal version tracking and historical query support. It also adds improvements to peer identity handling and extends core networking types.

Key Changes

🧠 Vector Clock Support

  • Added VectorClock type to core networking layer
  • Introduced vector-clock module in core types
  • Foundation for causal ordering in distributed updates

🕒 Time Travel Queries (DB Layer)

  • Implemented vector-clock based time-travel querying
  • Added new test suite: time-travel.test.ts
  • Added documentation for time-travel behavior

🌐 Network + Core Updates

  • Extended NetworkMessage and peer-related structures
  • Improved peer identity and connection metadata
  • Exported new vector-clock utilities from core package

🧪 Testing

  • Added new vitest setup for DB time-travel tests
  • Expanded coverage for causal ordering logic

📦 Build & Infra

  • Updated package dependencies across DB modules
  • Lockfile updated due to workspace dependency resolution changes

Breaking Changes

None

Notes

  • Some merge conflict resolution was required during rebase due to concurrent changes in core and db packages.
  • pnpm-lock changes reflect dependency graph updates across workspace packages.

Checklist

  • Builds successfully (pnpm build)
  • Typecheck passes (tsc --noEmit)
  • Rebase completed cleanly
  • Tests added for time-travel logic

atul-upadhyay-7 and others added 30 commits May 17, 2026 00:08
* 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
feat(web): add dark mode theme toggle
chore(cli): improve init command success message with next steps
test(core): add unit tests for EventEmitter
docs: add Why ZerithDB section to README
refactor(db): add clear() alias to CollectionClient
arpittkhandelwal and others added 27 commits May 17, 2026 21:39
* 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>
@anweshabhattacharyya anweshabhattacharyya changed the title feat(network): add peer naming and fix CI feat(db): add vector-clock time travel queries May 19, 2026
@anweshabhattacharyya
Copy link
Copy Markdown
Author

@arpittkhandelwal pls add the #761 issue back (adding time traveled queries back to db) which was originally assigned to me along with a workflow enabled on base repo so i can run the cl checks on my pr.Would be glad if u do the same.

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.