Click a face to follow them: their tab, their frame, their play, their pointer

A collaborator's face in the top bar follows them. You go where they go —
the symbol they open, the frame they are on, play when they play — and each
of you sees the other's pointer on the stage, named and in their colour.
Clicking the face again, ringed while you are together, leaves.

tl's parties, nearly line for line. Nobody hosts: following someone on
their own takes their connection id as the party, so two people following
each other at once land in one, and anyone in it drives the rest. That is
why the eye beside the faces says whether you may be followed. The browsers
work it out from gossip; the server only relays `nav` and `cursor`, and
does not remember them.

Only deliberate moves go out. Every member plays the document off its own
clock, so a play is sent once with its frame rather than streamed. A dive
into a symbol made a moment ago waits for its write to land, and a dropped
socket rejoins the same party on the way back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-11 01:53:20 -04:00
parent 14b0d6fa85
commit fbdecfb5d2
10 changed files with 502 additions and 53 deletions

View file

@ -0,0 +1,47 @@
(ns arthur.domain.party-test
(:require [cljs.test :refer [deftest is]]
[arthur.domain.party :as party]))
(defn- roster [& entries]
(into {} (map (fn [[cid p joinable]]
[cid {:cid cid :party p :joinable (not (false? joinable))}]))
entries))
(def ^:private solo (roster ["a" nil] ["b" nil] ["c" nil]))
(deftest following-someone-on-their-own-takes-their-cid-as-the-party
;; so two people following each other at once converge on one party
(is (= "a" (party/join-id solo "a")))
(is (= "a" (party/join-id (assoc-in solo ["b" :party] "a") "b"))))
(deftest a-party-nobody-else-carries-is-not-a-party
(let [r (assoc-in solo ["b" :party] "a")] ; b followed a; a has not answered
(is (not (party/in-party? r "b")))
(is (empty? (party/peers r "b")))))
(deftest members-drive-each-other-and-nobody-else
(let [r (-> solo (assoc-in ["a" :party] "a") (assoc-in ["b" :party] "a"))]
(is (= #{"b"} (party/peers r "a")))
(is (party/mirrors? r "a" "b"))
(is (party/mirrors? r "b" "a"))
(is (not (party/mirrors? r "a" "a")) "never our own broadcast")
(is (not (party/mirrors? r "c" "a")) "an outsider stays put")
(is (not (party/mirrors? r "a" "c")))))
(deftest following-needs-consent-and-is-not-offered-twice
(let [r (-> solo (assoc-in ["a" :party] "a") (assoc-in ["b" :party] "a")
(assoc-in ["c" :joinable] false))]
(is (party/joinable? r "c" "a"))
(is (not (party/joinable? r "a" "c")) "c is not letting anyone follow")
(is (not (party/joinable? r "a" "b")) "already together")
(is (not (party/joinable? r "a" "a")))))
(deftest one-member-answers-a-newcomer-and-never-the-newcomer
(let [r (-> solo (assoc-in ["a" :party] "a") (assoc-in ["b" :party] "a")
(assoc-in ["c" :party] "a"))]
(is (= "a" (party/responder r "a" "c")))
(is (= "a" (party/responder r "a" "b")))
(is (= "b" (party/responder (-> solo (assoc-in ["a" :party] "b")
(assoc-in ["b" :party] "b"))
"b" "a"))
"the one followed answers, though the follower named the party")))