{"messages":[{"content":"You are a constitutional council ranking individual git commits for ownership allocation.\n\nCompare these two commits. Decide which contributed more lasting value to the project.\n\nJudge substance, not spectacle:\n- Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise.\n- Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one.\n- Do not favor a side merely because its patch is longer or noisier.\n- Weight what the change does for the project, not the contributor's name.\n\nReturn ONLY a JSON object: {\"winner\": \"A\" or \"B\", \"ratio\": \"N:M\", \"explanation\": \"...\"}\nThe explanation must cite concrete differences in the patches (1-3 sentences).\n\nSide A — contributor: tommy-mor\nSide A — commit message:\n[71f27882] Delete test/runner.clj\n\nSide A — unified diff (full patch):\ndiff --git a/test/runner.clj b/test/runner.clj\ndeleted file mode 100644\nindex e8d3d3d05e84110545d68350b7db2c9d1cfbf979..0000000000000000000000000000000000000000\n--- a/test/runner.clj\n+++ /dev/null\n@@ -1,24 +0,0 @@\n-(ns test.runner\n- \"JVM entrypoint: run the same flows as Kaocha (for scripts / quick runs).\"\n- (:require [test.integration :as integration]\n- [test.auth :as auth]\n- [test.grants :as grants]\n- [test.invites :as invites]\n- [test.room-list :as room-list]\n- [test.browser-sse :as browser-sse]\n- [test.browser-post-redact :as browser-post-redact]\n- [test.browser-ui-morph :as browser-ui-morph]))\n-\n-(defn run-core! []\n- (integration/integration-flow!)\n- (auth/auth-flow!)\n- (grants/grants-flow!)\n- (invites/invites-flow!)\n- (room-list/room-list-flow!))\n-\n-(defn -main [& args]\n- (case (vec args)\n- [\"browser-sse\"] (browser-sse/sse-browser-flow!)\n- [\"browser-post-redact\"] (browser-post-redact/post-redact-flow!)\n- [\"browser-ui-morph\"] (browser-ui-morph/ui-morph-flow!)\n- (run-core!)))\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[7287df45] Add browser test for pool-scoped vote sequence.\n\nSeeds ~/pool/a-j (10 letters), enters /vote?pool=~/pool, then follows\nthe vote → next-pair loop up to 15 iterations. Asserts each vote lands\nin edge history and each pair shown belongs to the pool.\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide B — unified diff (full patch):\ndiff --git a/test/browser_vote_pool.clj b/test/browser_vote_pool.clj\nnew file mode 100644\nindex 0000000000000000000000000000000000000000..d51f05db47dc3cb013e56e65f3a1edfbbcbd96ab\n--- /dev/null\n+++ b/test/browser_vote_pool.clj\n@@ -0,0 +1,137 @@\n+(ns test.browser-vote-pool\n+ \"Pool-scoped voting: seed ~/pool/a-j, enter via /vote?pool=~/pool, follow\n+ the vote → next-pair → vote sequence until no next pair or 15 iterations.\"\n+ (:require [babashka.fs :as fs]\n+ [cheshire.core :as json]\n+ [clojure.string :as str]\n+ [clojure.test :refer [deftest is]]\n+ [com.blockether.spel.core :as core]\n+ [com.blockether.spel.locator :as locator]\n+ [com.blockether.spel.page :as page]\n+ [test.common :as common]\n+ [test.oauth :as oauth]))\n+\n+(defn- wait-for-text [pg selector expected timeout-ms]\n+ (let [deadline (+ (System/currentTimeMillis) timeout-ms)]\n+ (loop []\n+ (let [text (locator/text-content (page/locator pg selector))]\n+ (if (and (string? text) (str/includes? text expected))\n+ true\n+ (if (< (System/currentTimeMillis) deadline)\n+ (do (Thread/sleep 200) (recur))\n+ false))))))\n+\n+(defn- element-text [pg selector]\n+ (try (locator/text-content (page/locator pg selector)) (catch Exception _ nil)))\n+\n+(defn- enc [^String s]\n+ (java.net.URLEncoder/encode s \"UTF-8\"))\n+\n+(def letters [\"a\" \"b\" \"c\" \"d\" \"e\" \"f\" \"g\" \"h\" \"i\" \"j\"])\n+\n+(defn vote-pool-flow! []\n+ (println \"\\n━━━ browser vote pool (/vote?pool= seeds + follow next-pair sequence) ━━━\\n\")\n+\n+ (common/letlocals\n+ (bind build (common/run-cargo-build-release! [\"slugsocial-server\"]))\n+ (is (zero? (:exit build)) \"cargo build succeeds\")\n+ (bind server-bin \"target/release/slugsocial-server\")\n+\n+ (bind tmp-dir (str (fs/create-temp-dir {:prefix \"slug-browser-vote-pool-\"})))\n+ (bind slug-port (common/pick-port))\n+ (bind google-port (common/pick-port))\n+ (bind base-url (str \"http://127.0.0.1:\" slug-port))\n+ (bind google-url (str \"http://127.0.0.1:\" google-port))\n+\n+ (bind !server (atom nil))\n+ (bind !google (atom nil))\n+ (bind server-env (common/slug-server-env tmp-dir base-url google-url slug-port))\n+ (try\n+ (reset! !google (oauth/start-mock-google google-port\n+ :google-users [\"google-user-alice\"]))\n+ (reset! !server (common/start-server server-bin server-env))\n+ (is (common/wait-for-server base-url 10000) \"server responds to /healthz\")\n+\n+ (let [alice-token (oauth/fetch-bearer-token! base-url :username \"alice\")\n+ thread-tag \"browser-vote-pool\"\n+ ;; seed ~/pool/a through ~/pool/j as items with bodies\n+ item-lines (str/join \"\\n\"\n+ (map (fn [l] (str \"~/pool/\" l \" {\" l \"}\")) letters))\n+ raw (str \"# \" thread-tag \"\\n\\n~/pool {root}\\n\" item-lines \"\\n\")\n+ post-resp (oauth/http-post-json\n+ (str base-url \"/api/v0/rpc\")\n+ [{\"Post\" {\"room\" \"public\"\n+ \"thread_tag\" thread-tag\n+ \"text\" raw\n+ \"return_rank_diff\" false}}]\n+ :headers {\"Authorization\" (str \"Bearer \" alice-token)})\n+ post-json (json/parse-string (:body post-resp) false)\n+ _ (is (true? (get-in post-json [\"results\" 0 \"ok\"]))\n+ \"seed ~/pool/a-j items via rpc\")\n+ pool-url (str base-url \"/vote?pool=\" (enc \"~/pool\"))]\n+\n+ (core/with-playwright [pw]\n+ (core/with-browser [browser (core/launch-chromium pw {:headless true :channel \"chrome\"})]\n+ (core/with-context [ctx (core/new-context browser)]\n+ (core/with-page [pg (core/new-page-from-context ctx)]\n+ (page/navigate pg (str base-url \"/login\"))\n+ (is (wait-for-text pg \"body\" \"@alice\" 15000) \"alice session after login\")\n+\n+ ;; Enter via pool URL — page picks first pair automatically.\n+ (page/navigate pg pool-url)\n+ (is (wait-for-text pg \"body.view-vote-compare\" \"compare\" 15000)\n+ \"pool entry: vote compare page loads\")\n+\n+ ;; Verify the initial pair is within the pool.\n+ (let [pair-text (element-text pg \".vote-compare-pair\")]\n+ (is (and (string? pair-text) (str/includes? pair-text \"~/pool/\"))\n+ (str \"initial pair is within ~/pool: \" pair-text)))\n+\n+ ;; Follow vote → next-pair sequence up to 15 iterations.\n+ (let [votes-cast\n+ (loop [i 0]\n+ (if (>= i 15)\n+ i\n+ (let [explanation (str \"pool vote \" i \" reason\")]\n+ (locator/fill (page/locator pg \"#vote-explain\") explanation)\n+ (locator/click (page/locator pg \"#vote-compare-form button[type=submit]\"))\n+ ;; Wait for edge history morph confirming the vote landed.\n+ (if-not (wait-for-text pg \"ul.vote-edge-history\" explanation 20000)\n+ (do (println \" vote\" i \"history morph timed out — stopping\")\n+ i)\n+ (let [has-next (wait-for-text pg \"[data-testid=\\\"vote-next-pair\\\"]\"\n+ \"next pair\" 8000)]\n+ (if-not has-next\n+ ;; \"no next pair\" — pool exhausted.\n+ (do (println \" no next pair after vote\" i \" — pool exhausted\")\n+ (inc i))\n+ (do\n+ ;; Verify the pair on this page is within the pool before advancing.\n+ (let [pt (element-text pg \".vote-compare-pair\")]\n+ (is (and (string? pt) (str/includes? pt \"~/pool/\"))\n+ (str \"pair at vote \" i \" is within ~/pool: \" pt)))\n+ (locator/click (page/locator pg \"[data-testid=\\\"vote-next-pair\\\"]\"))\n+ ;; Wait for next pair to load.\n+ (wait-for-text pg \"body.view-vote-compare\" \"compare\" 10000)\n+ (recur (inc i)))))))))]\n+\n+ (is (>= votes-cast 1) (str \"cast at least 1 vote, got: \" votes-cast))\n+ (println (str \" pool voting sequence complete: \" votes-cast \" vote(s) cast\")))\n+\n+ ;; After the sequence, the current page is still a pool-scoped vote page.\n+ (let [url (page/url pg)]\n+ (is (str/includes? (or url \"\") \"/vote\")\n+ (str \"still on /vote after sequence: \" url))))))))\n+\n+ (finally\n+ (when-some [s @!server] (common/kill-server s))\n+ (when-some [g @!google] ((:stop-fn g)))\n+ (fs/delete-tree tmp-dir)))\n+\n+ nil))\n+\n+(defn vote-pool-browser-test [& _args]\n+ (vote-pool-flow!))\n+\n+(deftest browser-vote-pool-sequence\n+ (vote-pool-flow!))\n","role":"user"}],"model":"~anthropic/claude-sonnet-latest"}