{"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[075d4d37] Fix OAuth test mocks so Clojure E2E auth flows work again.\n\nHttpServer handlers were crashing on query parsing and token POSTs, which broke Playwright login; also read alias/history via real CSS selectors.\n\nCo-authored-by: Cursor \n\nSide A — unified diff (full patch):\ndiff --git a/test/auth_login.clj b/test/auth_login.clj\nindex 6f2f00d7aa7340e63d1ac465b0a2234cec7a983f..aa63b66ccb2471b710ba3d168d0461252b39fc10 100644\n--- a/test/auth_login.clj\n+++ b/test/auth_login.clj\n@@ -14,27 +14,27 @@\n (defn- type-alias! [pg text]\n (page/evaluate pg\n (.replace\n- \"(() => { const i = document.getElementById('alias-input'); const f = document.getElementById('alias-check-form'); if (!i || !f) return;\n+ \"(() => { const i = document.getElementById('alias-input'); const f = document.getElementById('alias-check-form'); if (!i || !f) return Promise.resolve('missing-form');\n i.value = __TEXT__;\n const cf = document.getElementById('alias-claim-field'); if (cf) cf.value = i.value;\n return fetch(f.action, { method: 'POST', credentials: 'same-origin',\n headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n body: new URLSearchParams(new FormData(f)).toString() })\n .then(function (r) { return r.text(); })\n- .then(function (t) { eval(t); }); })()\"\n+ .then(function (t) { eval(t); return document.getElementById('alias-status')?.textContent || ''; }); })()\"\n \"__TEXT__\"\n- (pr-str text)))\n- (Thread/sleep 400))\n+ (pr-str text))))\n \n-(defn- element-text [pg test-id]\n+(defn- element-text [pg selector]\n (let [raw (page/evaluate pg\n- (str \"document.querySelector('[data-testid=\\\"\" test-id \"\\\"]')?.textContent || ''\"))]\n+ (str \"document.querySelector(\" (pr-str selector) \")?.textContent || ''\"))]\n (when (string? raw) (str/trim raw))))\n \n (defn- wait-for-text [pg test-id text timeout-ms]\n- (let [deadline (+ (System/currentTimeMillis) timeout-ms)]\n+ (let [deadline (+ (System/currentTimeMillis) timeout-ms)\n+ selector (str \"[data-testid=\\\"\" test-id \"\\\"]\")]\n (loop []\n- (let [got (or (element-text pg test-id) \"\")]\n+ (let [got (or (element-text pg selector) \"\")]\n (cond\n (= got text) got\n (< (System/currentTimeMillis) deadline) (do (Thread/sleep 200) (recur))\ndiff --git a/test/support/mock_oauth.clj b/test/support/mock_oauth.clj\nindex 5ba7e9be3cf6d2226648e9609a09ed45f306930f..333fe08d56cb06bac2a338cad1c73894d54c4495 100644\n--- a/test/support/mock_oauth.clj\n+++ b/test/support/mock_oauth.clj\n@@ -7,7 +7,7 @@\n (defn- query-param [query key]\n (when query\n (some (fn [pair]\n- (let [[k v] (str/split pair \"=\" 2)]\n+ (let [[k v] (str/split pair #\"=\" 2)]\n (when (= k key)\n (URLDecoder/decode (or v \"\") \"UTF-8\"))))\n (str/split query #\"&\"))))\n@@ -31,11 +31,11 @@\n \n (defn- send-redirect [^HttpExchange ex location]\n (.set (.getResponseHeaders ex) \"Location\" location)\n- (.sendResponseHeaders ex 302 -1)\n+ (.sendResponseHeaders ex 302 0)\n (.close (.getResponseBody ex)))\n \n (defn- read-form [^HttpExchange ex]\n- (let [body (slurp (.getInputStream ex))]\n+ (let [body (slurp (.getRequestBody ex))]\n {:code (query-param body \"code\")\n :grant (query-param body \"grant_type\")}))\n \n@@ -45,7 +45,7 @@\n (str/replace #\"^[Bb]earer \" \"\")))\n \n (defn- parse-token-user [token]\n- (when (str/starts-with? token \"mock:\")\n+ (when (and token (str/starts-with? token \"mock:\"))\n (parse-mock-user (subs token 5))))\n \n (defn- authorize-redirect [exchange query]\n@@ -55,7 +55,7 @@\n user (parse-mock-user mock-user)\n code (str \"mock:\" (:id user) \":\" (:login user))\n loc (str redirect-uri \"?code=\" (java.net.URLEncoder/encode code \"UTF-8\")\n- \"&state=\" (java.net.URLEncoder/encode state \"UTF-8\"))]\n+ \"&state=\" (java.net.URLEncoder/encode (or state \"\") \"UTF-8\"))]\n (send-redirect exchange loc)))\n \n (defn start-mock-oauth\n@@ -65,49 +65,56 @@\n handler\n (proxy [HttpHandler] []\n (handle [^HttpExchange exchange]\n- (let [uri (.getRequestURI exchange)\n- path (.getPath uri)\n- query (.getQuery uri)\n- method (.getRequestMethod exchange)]\n- (cond\n- ;; GitHub authorize\n- (str/ends-with? path \"/login/oauth/authorize\")\n- (authorize-redirect exchange query)\n+ (try\n+ (let [uri (.getRequestURI exchange)\n+ path (.getPath uri)\n+ query (.getQuery uri)\n+ method (.getRequestMethod exchange)]\n+ (cond\n+ ;; GitHub authorize\n+ (str/ends-with? path \"/login/oauth/authorize\")\n+ (authorize-redirect exchange query)\n \n- ;; Reddit authorize\n- (str/ends-with? path \"/api/v1/authorize\")\n- (authorize-redirect exchange query)\n+ ;; Reddit authorize\n+ (str/ends-with? path \"/api/v1/authorize\")\n+ (authorize-redirect exchange query)\n \n- ;; GitHub token\n- (and (= method \"POST\") (str/ends-with? path \"/login/oauth/access_token\"))\n- (let [code (or (:code (read-form exchange)) \"mock:1002:newbie\")]\n- (send-json exchange 200 (str \"{\\\"access_token\\\":\\\"\" code \"\\\",\\\"token_type\\\":\\\"bearer\\\"}\")))\n+ ;; GitHub token\n+ (and (= method \"POST\") (str/ends-with? path \"/login/oauth/access_token\"))\n+ (let [code (or (:code (read-form exchange)) \"mock:1002:newbie\")]\n+ (send-json exchange 200 (str \"{\\\"access_token\\\":\\\"\" code \"\\\",\\\"token_type\\\":\\\"bearer\\\"}\")))\n \n- ;; Reddit token (client_credentials for import + authorization_code for login)\n- (and (= method \"POST\") (str/ends-with? path \"/api/v1/access_token\"))\n- (let [form (read-form exchange)\n- grant (or (:grant form) \"\")\n- code (or (:code form) \"mock:t2_test:redditor\")]\n- (if (= grant \"client_credentials\")\n- (send-json exchange 200 \"{\\\"access_token\\\":\\\"app-token\\\",\\\"token_type\\\":\\\"bearer\\\",\\\"expires_in\\\":3600}\")\n- (send-json exchange 200 (str \"{\\\"access_token\\\":\\\"\" code \"\\\",\\\"token_type\\\":\\\"bearer\\\",\\\"expires_in\\\":3600}\"))))\n+ ;; Reddit token (client_credentials for import + authorization_code for login)\n+ (and (= method \"POST\") (str/ends-with? path \"/api/v1/access_token\"))\n+ (let [form (read-form exchange)\n+ grant (or (:grant form) \"\")\n+ code (or (:code form) \"mock:t2_test:redditor\")]\n+ (if (= grant \"client_credentials\")\n+ (send-json exchange 200 \"{\\\"access_token\\\":\\\"app-token\\\",\\\"token_type\\\":\\\"bearer\\\",\\\"expires_in\\\":3600}\")\n+ (send-json exchange 200 (str \"{\\\"access_token\\\":\\\"\" code \"\\\",\\\"token_type\\\":\\\"bearer\\\",\\\"expires_in\\\":3600}\"))))\n \n- ;; GitHub user\n- (= path \"/user\")\n- (let [token (bearer-token exchange)\n- user (or (parse-token-user token) {:id \"1002\" :login \"newbie\" :numeric? true})]\n- (send-json exchange 200\n- (str \"{\\\"id\\\":\" (:id user) \",\\\"login\\\":\\\"\" (:login user) \"\\\"}\")))\n+ ;; GitHub user\n+ (= path \"/user\")\n+ (let [token (bearer-token exchange)\n+ user (or (parse-token-user token) {:id \"1002\" :login \"newbie\" :numeric? true})]\n+ (send-json exchange 200\n+ (str \"{\\\"id\\\":\" (:id user) \",\\\"login\\\":\\\"\" (:login user) \"\\\"}\")))\n \n- ;; Reddit /api/v1/me\n- (str/ends-with? path \"/api/v1/me\")\n- (let [token (bearer-token exchange)\n- user (or (parse-token-user token) {:id \"t2_test\" :login \"redditor\"})]\n- (send-json exchange 200\n- (str \"{\\\"id\\\":\\\"\" (:id user) \"\\\",\\\"name\\\":\\\"\" (:login user) \"\\\"}\")))\n+ ;; Reddit /api/v1/me\n+ (str/ends-with? path \"/api/v1/me\")\n+ (let [token (bearer-token exchange)\n+ user (or (parse-token-user token) {:id \"t2_test\" :login \"redditor\"})]\n+ (send-json exchange 200\n+ (str \"{\\\"id\\\":\\\"\" (:id user) \"\\\",\\\"name\\\":\\\"\" (:login user) \"\\\"}\")))\n \n- :else\n- (send-json exchange 404 \"{\\\"error\\\":\\\"not found\\\"}\")))))]\n+ :else\n+ (send-json exchange 404 \"{\\\"error\\\":\\\"not found\\\"}\")))\n+ (catch Throwable t\n+ (binding [*out* *err*]\n+ (println \"mock-oauth handler error:\" t))\n+ (try\n+ (send-json exchange 500 \"{\\\"error\\\":\\\"mock-oauth internal\\\"}\")\n+ (catch Throwable _))))))]\n (.createContext server \"/\" handler)\n (.setExecutor server nil)\n (.start server)\ndiff --git a/test/support/mock_reddit.clj b/test/support/mock_reddit.clj\nindex a630cf0938722193e9af88382d60e777ff371be4..faa27945b6394363914c853627a0bad1e819a5f9 100644\n--- a/test/support/mock_reddit.clj\n+++ b/test/support/mock_reddit.clj\n@@ -12,7 +12,7 @@\n (defn- query-param [query key]\n (when query\n (some (fn [pair]\n- (let [[k v] (str/split pair \"=\" 2)]\n+ (let [[k v] (str/split pair #\"=\" 2)]\n (when (= k key)\n (URLDecoder/decode (or v \"\") \"UTF-8\"))))\n (str/split query #\"&\"))))\n@@ -34,11 +34,11 @@\n \n (defn- send-redirect [^HttpExchange ex location]\n (.set (.getResponseHeaders ex) \"Location\" location)\n- (.sendResponseHeaders ex 302 -1)\n+ (.sendResponseHeaders ex 302 0)\n (.close (.getResponseBody ex)))\n \n (defn- read-form [^HttpExchange ex]\n- (let [body (slurp (.getInputStream ex))]\n+ (let [body (slurp (.getRequestBody ex))]\n {:code (query-param body \"code\")\n :grant (query-param body \"grant_type\")}))\n \n@@ -48,7 +48,7 @@\n (str/replace #\"^[Bb]earer \" \"\")))\n \n (defn- parse-token-user [token]\n- (when (str/starts-with? token \"mock:\")\n+ (when (and token (str/starts-with? token \"mock:\"))\n (parse-mock-user (subs token 5))))\n \n (defn start-mock-reddit\n@@ -72,7 +72,7 @@\n user (parse-mock-user (query-param query \"mock_user\"))\n code (str \"mock:\" (:id user) \":\" (:login user))\n loc (str redirect-uri \"?code=\" (java.net.URLEncoder/encode code \"UTF-8\")\n- \"&state=\" (java.net.URLEncoder/encode state \"UTF-8\"))]\n+ \"&state=\" (java.net.URLEncoder/encode (or state \"\") \"UTF-8\"))]\n (send-redirect exchange loc))\n \n (and (= method \"POST\") (str/ends-with? path \"/api/v1/access_token\"))\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[14749a34] Show graph topology with pair suggestions\n\nExpose existing connectivity statistics in CLI output so voters can see sparse or disconnected scopes before adding an edge.\n\nCo-authored-by: Cursor \n\nSide B — unified diff (full patch):\ndiff --git a/cli/src/main.rs b/cli/src/main.rs\nindex 70435b412188a151c5e89e842a5de57f7480ddf2..abb5a55b49f60fe28fbfd4ec02715cb94ea0b4ec 100644\n--- a/cli/src/main.rs\n+++ b/cli/src/main.rs\n@@ -397,6 +397,29 @@ fn print_item_response(resp: &ItemResponse) {\n }\n }\n \n+fn format_connectivity_stats(stats: &ConnectivityStats) -> String {\n+ let density = if stats.pairs_possible == 0 {\n+ 0.0\n+ } else {\n+ stats.pairs_voted as f64 / stats.pairs_possible as f64 * 100.0\n+ };\n+ let component_label = if stats.components == 1 { \"component\" } else { \"components\" };\n+ let connection_status = if stats.comparisons_until_connected == 0 {\n+ \"connected\".to_string()\n+ } else {\n+ let comparison_label = if stats.comparisons_until_connected == 1 {\n+ \"comparison\"\n+ } else {\n+ \"comparisons\"\n+ };\n+ format!(\"{} {comparison_label} to connect\", stats.comparisons_until_connected)\n+ };\n+ format!(\n+ \"graph: {} items, {}/{} pairs ({density:.1}% density), {} {component_label}, {connection_status}\",\n+ stats.items, stats.pairs_voted, stats.pairs_possible, stats.components,\n+ )\n+}\n+\n fn print_pair_response(resp: &PairResponse) {\n println!(\"{} vs {}\", resp.left, resp.right);\n if let Some(b) = &resp.left_body {\n@@ -413,6 +436,10 @@ fn print_pair_response(resp: &PairResponse) {\n println!();\n println!(\"threads: {}\", resp.threads.iter().map(|t| format!(\"#{t}\")).collect::>().join(\" \"));\n }\n+ if let Some(stats) = &resp.connectivity {\n+ println!();\n+ println!(\"{}\", format_connectivity_stats(stats));\n+ }\n println!();\n println!(\"---\");\n println!(\"Before writing your comparison, talk to your human. Ask them about their relationship to these two items — which one has meant more to them, whether their perspective has changed over time, and where they land now. Listen to what they say. Then write a comparison that synthesizes their perspective with your own analysis. The best submissions on slug.social carry both voices — your reasoning and their experience.\");\n@@ -816,6 +843,43 @@ fn write_secret_file(name: &str, contents: &str) -> Result<()> {\n Ok(())\n }\n \n+#[cfg(test)]\n+mod tests {\n+ use super::*;\n+\n+ #[test]\n+ fn connectivity_stats_show_sparse_disconnected_graph() {\n+ let stats = ConnectivityStats {\n+ items: 9,\n+ components: 3,\n+ comparisons_until_connected: 2,\n+ pairs_voted: 8,\n+ pairs_possible: 36,\n+ };\n+\n+ assert_eq!(\n+ format_connectivity_stats(&stats),\n+ \"graph: 9 items, 8/36 pairs (22.2% density), 3 components, 2 comparisons to connect\"\n+ );\n+ }\n+\n+ #[test]\n+ fn connectivity_stats_show_connected_graph() {\n+ let stats = ConnectivityStats {\n+ items: 4,\n+ components: 1,\n+ comparisons_until_connected: 0,\n+ pairs_voted: 3,\n+ pairs_possible: 6,\n+ };\n+\n+ assert_eq!(\n+ format_connectivity_stats(&stats),\n+ \"graph: 4 items, 3/6 pairs (50.0% density), 1 component, connected\"\n+ );\n+ }\n+}\n+\n async fn run_scoped(base: &str, room: &str, sub: ScopedCmd) -> Result<()> {\n let room = room.trim();\n let client = http_client()?;\n","role":"user"}],"model":"~x-ai/grok-latest"}