Repository navigation
Live sync over Firebase (Cloud Firestore) - #12
Open
LeventeBotos wants to merge 6 commits into
Open
LeventeBotos wants to merge 6 commits into
LeventeBotos wants to merge 6 commits into
Conversation
A transport answers the wire-protocol routes in-process and may push the page's visible comments live. The existing queue, conflict handling and merge code is reused unchanged; apiFetch just calls transport.request instead of fetch. With subscribe(), polling drops to a 60 s safety net, snapshots that race an in-flight or just-acknowledged write cannot drop it, and a refused subscription falls back to local mode like a refused session. HTTP behaviour is untouched. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
firebase.mjs implements wire protocol v1 in the browser on top of Firestore (transactions give the stale check, tombstones and reply idempotency) and pushes each page's visible comments with onSnapshot. It ships as @reviewjs/annotate/firebase with firebase as an optional peer dependency; annotate.js stays dependency-free. examples/firebase/firestore.rules is the trust boundary: reviewers see and change only their own comments, only authors assign, clients cannot hard-delete or promote themselves. Tested on the emulators with the real rules: 25 tests covering the protocol cases, the rules attacked directly, and live subscriptions. Pen strokes are flattened because Firestore rejects nested arrays. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A reviewer's comment reaches the author without a reload, the author's decision reaches the reviewer, and a second reviewer never sees it. The browser bundle is built with esbuild; a new CI job runs the rules, conformance and e2e suites on the emulators (demo- project, no secrets). Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Design spec and plan, a README setup guide, the wire protocol's new Transports section (additive, no /v2), and the site FAQ. Raises the optional firebase peer range to 12. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Behaviour change: reviewers previously saw only their own comments; every member now reads every comment and its activity and may reply to any comment. Writes are unchanged: a reviewer creates comments and edits, resolves or deletes only their own, and only authors assign. Rules: get/list/activity read are isMember(). A non-owner's update may change only replies and updatedAt and may append exactly one reply of their own (a non-owner may also log a 'replied' activity event). The empty-thread case needed a guard because slicing an empty prefix is a rules evaluation error, which would have refused every first reply. Adapter: drop the authorId list filter and the reply/activity ownership gates; reply removal stays a write (403 not_owner for non-authors); the ifDenied mapping is gone since a denial no longer means 'not yours'. Tests rewritten for the new model, plus rules tests for reply append, forging, stacking, tampering and the first reply. README, design spec and the wire protocol's Transports section record the change. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Follow-up to letting every member read all comments. - Rules: a non-author may only append or remove one reply of their own, and a comment's owner can no longer forge replies in another member's name. Non-owners may log "replied" and "reply_deleted" activity. - Adapter: a reply's author can remove it from any comment. - Core: Resolve/Reopen is shown only on comments a reviewer owns, and toasts no longer blame "the review owner" for other reviewers' changes. - Add examples/firebase/index.html, a no-bundler demo that runs against the emulators in two windows. - Tests for each of the above; docs updated. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lets a site owner sync reviews through their own Firebase project, with comments reaching the author live (no reload, no server to run). Local-only mode, the HTTP backend, exports and the dependency-free
annotate.jsare unchanged.transportoption.annotate.jsalready has a persisted queue, conflict handling and merge logic behind one function (apiFetch). A transport answers the same wire-protocol routes in-process and may push the page's visible comments. The existing sync engine is reused rather than duplicated. Polling drops to a 60 s safety net when a transport can push. Snapshots that race an in-flight or just-acknowledged write cannot drop it.@reviewjs/annotate/firebase.firebase.mjsimplements wire protocol v1 on Firestore (transactions give the stale check, tombstones and reply idempotency;onSnapshotgives live push).firebaseis an optional peer dependency.examples/firebase/firestore.rules. The trust boundary: reviewers see and change only their own comments, only authors assign, clients cannot hard-delete or promote themselves.docs/superpowers/, a new additive Transports section inwire-protocol.md(no/v2), a README setup guide, site FAQ.Design and known limits:
docs/superpowers/specs/2026-11-19-firebase-live-sync-design.md. No version bump; releasing is left to the maintainer.Things worth a reviewer's attention
updatedAtcomes from the browser clock; the adapter keeps it strictly increasing per document.openor restricted to members an author adds.firebasepeer range (>=12) is a judgement call; only 13.4 was tested.Test plan
npm run test:server: 21 pass (reference server unchanged)npx playwright test --project=chromium: 165 pass, then the new suites separatelytests/transport.spec.js(7, in-memory transport) andtests/remote.spec.json Firefox and WebKit: 44 passnpm run test:firebase: 25 pass on the emulators (rules attacked directly, protocol conformance, live subscription)npm run test:firebase:e2e: 2 pass (two real browsers: reviewer to author live, author decision back, a second reviewer sees nothing)firebasejob (emulators, no secrets); needs to run on this PR🤖 Generated with Claude Code