{"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[0728c06a] Vote pool: use display_path in hrefs; test all 45 pairs + assert ranking.\n\n- vote_compare_href and vote_pool_href now encode ~/… and -/… as their\n short display forms (not the full https://slug.social/… storage URL),\n matching what users see in the item display and DSL.\n- Rewrite browser_vote_pool test to vote all C(10,2)=45 pairs in the\n pool, always preferring the alphabetically-earlier letter, then query\n GetGardenRank and assert the 10 items form one component ranked a→j.\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide A — unified diff (full patch):\ndiff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs\nindex 2682cfcbd2f834b56459a02831aa225cffe67c58..d0ec78cd675eae284d056fb3b8eaf5cc853d6263 100644\n--- a/server/src/html/garden/vote.rs\n+++ b/server/src/html/garden/vote.rs\n@@ -234,8 +234,10 @@ pub(super) fn vote_compare_href(\n thread_override: Option<&str>,\n pool: Option<&ItemId>,\n ) -> String {\n- let left_q = urlencoding::encode(left.as_str());\n- let right_q = urlencoding::encode(right.as_str());\n+ let left_dp = left.display_path();\n+ let right_dp = right.display_path();\n+ let left_q = urlencoding::encode(&left_dp);\n+ let right_q = urlencoding::encode(&right_dp);\n let mut base = format!(\n \"{}/vote?left={}&right={}\",\n nav.room_path_prefix_for_vote_compare(),\n@@ -246,16 +248,20 @@ pub(super) fn vote_compare_href(\n base = format!(\"{}&thread={}\", base, urlencoding::encode(t));\n }\n if let Some(p) = pool {\n- base = format!(\"{}&pool={}\", base, urlencoding::encode(p.as_str()));\n+ let pool_dp = p.display_path();\n+ base = format!(\"{}&pool={}\", base, urlencoding::encode(&pool_dp));\n }\n base\n }\n \n pub(super) fn vote_pool_href(nav: &ThreadNav, pool_item_str: &str) -> String {\n+ let display = ItemId::parse(pool_item_str)\n+ .map(|i| i.display_path())\n+ .unwrap_or_else(|| pool_item_str.to_string());\n format!(\n \"{}/vote?pool={}\",\n nav.room_path_prefix_for_vote_compare(),\n- urlencoding::encode(pool_item_str)\n+ urlencoding::encode(&display)\n )\n }\n \ndiff --git a/test/browser_vote_pool.clj b/test/browser_vote_pool.clj\nindex d51f05db47dc3cb013e56e65f3a1edfbbcbd96ab..23d0bd80b02bd8b1b48853454bed02793296550e 100644\n--- a/test/browser_vote_pool.clj\n+++ b/test/browser_vote_pool.clj\n@@ -1,6 +1,8 @@\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+ \"Pool-scoped voting: seed ~/pool/a-j (10 letters), follow the\n+ vote → next-pair sequence for all C(10,2)=45 pairs voting the\n+ alphabetically-earlier item each time, then assert the garden\n+ ranking is a…j in order.\"\n (:require [babashka.fs :as fs]\n [cheshire.core :as json]\n [clojure.string :as str]\n@@ -11,26 +13,38 @@\n [test.common :as common]\n [test.oauth :as oauth]))\n \n+(def letters [\"a\" \"b\" \"c\" \"d\" \"e\" \"f\" \"g\" \"h\" \"i\" \"j\"])\n+(def total-pairs (/ (* (count letters) (dec (count letters))) 2)) ; C(10,2) = 45\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+ (let [text (try (locator/text-content (page/locator pg selector)) (catch Exception _ nil))]\n (if (and (string? text) (str/includes? text expected))\n true\n (if (< (System/currentTimeMillis) deadline)\n- (do (Thread/sleep 200) (recur))\n+ (do (Thread/sleep 150) (recur))\n false))))))\n \n (defn- element-text [pg selector]\n- (try (locator/text-content (page/locator pg selector)) (catch Exception _ nil)))\n+ (try (locator/text-content (page/locator pg selector)) (catch Exception _ \"\")))\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+;; Extract the terminal path segment, e.g. \"~/pool/c\" → \"c\".\n+(defn- leaf [path] (last (str/split path #\"/\")))\n+\n+;; Set the hidden ratio inputs so the alphabetically-earlier item wins.\n+(defn- set-ratio! [pg left-text right-text]\n+ (let [[rl rr] (if (neg? (compare (leaf left-text) (leaf right-text)))\n+ [100 0] ; left is earlier → prefer left\n+ [0 100])] ; right is earlier → prefer right\n+ (page/evaluate pg (str \"document.getElementById('vote-ratio-left').value='\" rl \"'\"))\n+ (page/evaluate pg (str \"document.getElementById('vote-ratio-right').value='\" rr \"'\"))))\n \n (defn vote-pool-flow! []\n- (println \"\\n━━━ browser vote pool (/vote?pool= seeds + follow next-pair sequence) ━━━\\n\")\n+ (println (str \"\\n━━━ browser vote pool (all \" total-pairs \" pairs → sorted ranking) ━━━\\n\"))\n \n (common/letlocals\n (bind build (common/run-cargo-build-release! [\"slugsocial-server\"]))\n@@ -54,7 +68,6 @@\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@@ -77,51 +90,57 @@\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+ ;; Vote all 45 pairs, always preferring the alphabetically-earlier item.\n+ (loop [votes-cast 0]\n+ (when (< votes-cast total-pairs)\n+ (let [left-text (element-text pg \".vote-compare-left code\")\n+ right-text (element-text pg \".vote-compare-right code\")]\n+ (is (str/includes? left-text \"~/pool/\")\n+ (str \"vote \" votes-cast \": left is in pool: \" left-text))\n+ (is (str/includes? right-text \"~/pool/\")\n+ (str \"vote \" votes-cast \": right is in pool: \" right-text))\n+ (set-ratio! pg left-text right-text)\n+ (let [winner (if (neg? (compare (leaf left-text) (leaf right-text)))\n+ (leaf left-text) (leaf right-text))]\n+ (locator/fill (page/locator pg \"#vote-explain\")\n+ (str \"prefer \" winner)))\n+ (locator/click (page/locator pg \"#vote-compare-form button[type=submit]\"))\n+ (is (wait-for-text pg \"ul.vote-edge-history\" \"prefer \" 20000)\n+ (str \"vote \" votes-cast \" appears in edge history\"))\n+ (when (< (inc votes-cast) total-pairs)\n+ (is (wait-for-text pg \"[data-testid=\\\"vote-next-pair\\\"]\" \"next pair\" 8000)\n+ (str \"next pair available after vote \" votes-cast))\n+ (locator/click (page/locator pg \"[data-testid=\\\"vote-next-pair\\\"]\"))\n+ (is (wait-for-text pg \"body.view-vote-compare\" \"compare\" 10000)\n+ (str \"vote page loaded for pair \" (inc votes-cast))))\n+ (recur (inc votes-cast)))))\n+\n+ (println (str \" cast all \" total-pairs \" votes\"))\n+\n+ ;; Query the ranking via RPC and assert alphabetical order.\n+ (let [rank-resp (oauth/http-post-json\n+ (str base-url \"/api/v0/rpc\")\n+ [{\"GetGardenRank\" {\"room\" \"public\"\n+ \"parent_path\" \"~/pool\"}}]\n+ :headers {\"Authorization\" (str \"Bearer \" alice-token)})\n+ rank-json (json/parse-string (:body rank-resp) true)\n+ result (get-in rank-json [:results 0 :result :GardenRank])\n+ components (:components result)\n+ unranked (:unranked_items result)\n+ ranked (mapv :item (mapcat :ranking components))\n+ ranked-leaves (mapv #(last (str/split % #\"[/~]+\")) ranked)]\n+ (is (= 1 (count components))\n+ (str \"all 10 items form one connected component (got \" (count components) \")\"))\n+ (is (empty? unranked)\n+ (str \"no unranked items (got \" (count unranked) \")\"))\n+ (is (= 10 (count ranked))\n+ (str \"10 items ranked (got \" (count ranked) \")\"))\n+ (is (= letters ranked-leaves)\n+ (str \"ranking is alphabetical a→j (got \" ranked-leaves \")\"))))))))\n \n (finally\n (when-some [s @!server] (common/kill-server s))\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[1531154d] dequeue -> vec\n\nSide B — unified diff (full patch):\ndiff --git a/server/src/projection_apply.rs b/server/src/projection_apply.rs\nindex 9c8990a8af927f35d3344c8d0872a516aba56b86..ad404bacb8bcdd5ae0e682cff97f974fd44528ea 100644\n--- a/server/src/projection_apply.rs\n+++ b/server/src/projection_apply.rs\n@@ -6,8 +6,6 @@\n //! batch as the (non-idempotent) edge merges guarantees exactly-once application\n //! across replay.\n \n-use std::collections::BTreeSet;\n-\n use crate::{\n event_log::EventLogError,\n events::{Event, EventRecord},\n@@ -44,7 +42,6 @@ pub fn apply_records(\n \n let db = projection_store.db();\n let mut batch = db.batch();\n- let mut vote_parents: BTreeSet = BTreeSet::new();\n let mut last_seq = 0u64;\n \n for record in records {\n@@ -70,7 +67,6 @@ pub fn apply_records(\n *ts,\n )\n .map_err(|e| EventLogError::Apply(e.to_string()))?;\n- vote_parents.insert(parent);\n }\n Event::NodeEnsured { id } => {\n let parsed = parse_event_id(id)?;\n@@ -85,11 +81,5 @@ pub fn apply_records(\n .commit_with(durable::Durability::DisableWal)\n .map_err(|e| EventLogError::Apply(e.to_string()))?;\n \n- for parent in vote_parents {\n- projection_store\n- .trim_recent_votes(&parent)\n- .map_err(|e| EventLogError::Apply(e.to_string()))?;\n- }\n-\n Ok(())\n }\ndiff --git a/server/src/projection_store.rs b/server/src/projection_store.rs\nindex 8576d671f351004426207894ac35594ddb0f70cf..9a8953d010029d3639dc3987687554bab8b7663e 100644\n--- a/server/src/projection_store.rs\n+++ b/server/src/projection_store.rs\n@@ -18,7 +18,7 @@ use crate::{\n \n const PROJECTION_CURSOR_KEY: &str = \"cursor\";\n const PROJECTION_SCHEMA_KEY: &str = \"schema_version\";\n-const PROJECTION_SCHEMA_VERSION: u64 = 3;\n+const PROJECTION_SCHEMA_VERSION: u64 = 4;\n \n #[derive(Debug, thiserror::Error)]\n pub enum ProjectionStoreError {\n@@ -142,16 +142,6 @@ impl ProjectionStore {\n Ok(tree)\n }\n \n- /// Cap a node's recent-vote window after applying votes (best-effort, blind).\n- pub(crate) fn trim_recent_votes(&self, parent: &ItemId) -> Result<(), ProjectionStoreError> {\n- node(parent).recent_votes().truncate_back(\n- &self.db,\n- crate::storage_schema::RECENT_VOTES_CAP,\n- Durability::DisableWal,\n- )?;\n- Ok(())\n- }\n-\n /// Cache Reddit display content outside the event log (must be evicted per policy).\n pub fn put_ephemeral_content(\n &self,\ndiff --git a/server/src/reducer.rs b/server/src/reducer.rs\nindex 0c75c85150bb9e5f578bbadf58b3e43f8a80be4b..759918b8c0eb8f8bf1ed0911d8877adaa55c8ea6 100644\n--- a/server/src/reducer.rs\n+++ b/server/src/reducer.rs\n@@ -1,4 +1,4 @@\n-use std::collections::{HashMap, HashSet, VecDeque};\n+use std::collections::{HashMap, HashSet};\n \n use serde::{Deserialize, Serialize};\n \n@@ -52,7 +52,7 @@ pub struct GroupState {\n pub idx_to_item: Vec,\n pub edges: HashMap<(usize, usize), f64>,\n pub voted_pairs: HashSet<(usize, usize)>,\n- pub recent_votes: VecDeque,\n+ pub recent_votes: Vec,\n }\n \n impl GroupState {\n@@ -62,7 +62,7 @@ impl GroupState {\n idx_to_item: Vec::new(),\n edges: HashMap::new(),\n voted_pairs: HashSet::new(),\n- recent_votes: VecDeque::with_capacity(200),\n+ recent_votes: Vec::new(),\n }\n }\n \n@@ -111,10 +111,7 @@ impl GroupState {\n self.add_edge_weight(b_idx, a_idx, w_a);\n self.add_edge_weight(a_idx, b_idx, w_b);\n \n- self.recent_votes.push_front(vote);\n- while self.recent_votes.len() > 200 {\n- self.recent_votes.pop_back();\n- }\n+ self.recent_votes.push(vote);\n }\n }\n \ndiff --git a/server/src/storage_dto.rs b/server/src/storage_dto.rs\nindex 9dfb13c53efe4389277625a6ab3bfc18f566a453..3fd6db5cb909ac4896bd8a3ecace796de5f08781 100644\n--- a/server/src/storage_dto.rs\n+++ b/server/src/storage_dto.rs\n@@ -39,7 +39,7 @@ pub struct StoredEntityDataV1 {\n pub link_url: Option,\n }\n \n-/// One vote stored in a node's `recent_votes` deque.\n+/// One vote stored in a node's `recent_votes` list.\n #[derive(Debug, Clone, Serialize, Deserialize)]\n pub struct StoredVoteV1 {\n pub version: u32,\ndiff --git a/server/src/storage_schema.rs b/server/src/storage_schema.rs\nindex bd26e665e084b95b10fdfff091c31e8dc84d07b8..5d2bb1d56927fb61c7c6d2d8602bd6882327f862 100644\n--- a/server/src/storage_schema.rs\n+++ b/server/src/storage_schema.rs\n@@ -2,13 +2,13 @@\n //! durable collections instead of one blob per node.\n //!\n //! A vote updates a handful of keys: a few edge-weight merges, a voted-pair flag,\n-//! a recent-vote deque push, and child-link set entries. The in-memory\n+//! a recent-vote list append, and child-link set entries. The in-memory\n //! [`crate::reducer::GroupState`] is reconstructed from these keys on read for\n //! rank-centrality.\n \n use std::collections::{BTreeSet, HashMap, HashSet};\n \n-use durable::{Batch, Db, Deque, Durable, Leaf, Map, Sum};\n+use durable::{Batch, Db, Durable, Leaf, List, Map, Sum};\n \n use crate::{\n path_types::ItemId,\n@@ -38,8 +38,8 @@ pub struct NodeSchema {\n pub edges: Map>,\n /// Voted pairs `(min, max) -> true`.\n pub voted_pairs: Map>,\n- /// Recent votes, newest at the front (capped on write).\n- pub recent_votes: Deque>,\n+ /// Recent votes, append-only oldest-first (cap applied on read).\n+ pub recent_votes: List>,\n /// When ephemeral Reddit display content was last fetched (ms); absent after eviction.\n pub fetched_at: Leaf,\n }\n@@ -55,7 +55,7 @@ pub struct Store {\n pub view_meta: Map>,\n }\n \n-/// Cap on the per-node recent-vote window (matches the in-memory reducer).\n+/// Max recent votes returned when loading a node (query-time cap only).\n pub const RECENT_VOTES_CAP: u64 = 200;\n \n fn id_key(id: &ItemId) -> String {\n@@ -148,11 +148,14 @@ fn build_group_state(\n }\n }\n \n- // Deque is front=newest; in-memory VecDeque is also front=newest.\n- let mut recent_votes = std::collections::VecDeque::new();\n- for stored in np.recent_votes().iter(db)? {\n- recent_votes.push_back(decode_vote(stored).map_err(durable::Error::Deserialize)?);\n- }\n+ // List is index order (oldest first); keep the newest RECENT_VOTES_CAP entries.\n+ let stored = np.recent_votes().iter(db)?;\n+ let cap = RECENT_VOTES_CAP as usize;\n+ let start = stored.len().saturating_sub(cap);\n+ let recent_votes = stored[start..]\n+ .iter()\n+ .map(|s| decode_vote(s.clone()).map_err(durable::Error::Deserialize))\n+ .collect::, _>>()?;\n \n Ok(GroupState {\n item_to_idx,\n@@ -248,7 +251,7 @@ pub fn vote_writes(\n };\n batch.write(pnode.voted_pairs().key(&(lo, hi)).set(&true));\n \n- // Recent votes (newest at front).\n+ // Recent votes (append-only; cap on read).\n let stored = encode_vote(&VoteData {\n ts,\n a: a_id,\n@@ -260,7 +263,7 @@ pub fn vote_writes(\n delegate: None,\n thread_tag: \"default\".to_string(),\n });\n- batch.push_front(&pnode.recent_votes(), &stored)?;\n+ batch.push(&pnode.recent_votes(), &stored)?;\n Ok(())\n }\n \n@@ -314,6 +317,35 @@ mod tests {\n assert!(load_node_state(&db, &parent).unwrap().is_none());\n }\n \n+ #[test]\n+ fn load_caps_recent_votes_at_query_time() {\n+ let dir = tempfile::tempdir().unwrap();\n+ let db = Db::open(dir.path()).unwrap();\n+ let parent = ItemId::root();\n+\n+ let mut batch = db.batch();\n+ for i in 0..RECENT_VOTES_CAP + 10 {\n+ vote_writes(&mut batch, &parent, \"alpha\", \"beta\", 1, 0, i as i64).unwrap();\n+ }\n+ batch.commit().unwrap();\n+\n+ assert_eq!(\n+ node(&parent).recent_votes().len(&db).unwrap(),\n+ RECENT_VOTES_CAP + 10\n+ );\n+\n+ let node_state = load_node_state(&db, &parent).unwrap().unwrap();\n+ assert_eq!(node_state.local_ranking.recent_votes.len(), RECENT_VOTES_CAP as usize);\n+ assert_eq!(\n+ node_state.local_ranking.recent_votes.first().map(|v| v.ts),\n+ Some(10)\n+ );\n+ assert_eq!(\n+ node_state.local_ranking.recent_votes.last().map(|v| v.ts),\n+ Some(RECENT_VOTES_CAP as i64 + 9)\n+ );\n+ }\n+\n #[test]\n fn missing_node_is_none() {\n let dir = tempfile::tempdir().unwrap();\n","role":"user"}],"model":"~anthropic/claude-sonnet-latest"}