{"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[36e92cf2] Fix /vote/compare page: attribution, fallback, swap button, and route rename.\n\n- Pass WEB_BROWSER_AGENT as delegate_opt out-of-band (not in DSL body text)\n- Error instead of falling back to all items when sibling pool < 2\n- Remove pointless \"swap sides\" button\n- Rename route /vote/compare → /vote\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide A — unified diff (full patch):\ndiff --git a/server/src/api/rpc.rs b/server/src/api/rpc.rs\nindex 0b7070a2b7289e5c40778c8d062bd4150285a8df..8e3d8e34922ddaaa89ea699edd99402bd40fdb1b 100644\n--- a/server/src/api/rpc.rs\n+++ b/server/src/api/rpc.rs\n@@ -281,6 +281,7 @@ pub async fn rpc_post_with_bearer(\n bearer_token: &str,\n room: String,\n thread_tag: String,\n+ delegate_opt: Option,\n text: String,\n ) -> Result {\n use axum::http::{header, HeaderMap, HeaderValue};\n@@ -288,7 +289,7 @@ pub async fn rpc_post_with_bearer(\n let hv = HeaderValue::from_str(&format!(\"Bearer {bearer_token}\"))\n .map_err(|_| (\"invalid session token\".into(), None))?;\n headers.insert(header::AUTHORIZATION, hv);\n- rpc_post(state, &headers, room, thread_tag, None, text, false).await\n+ rpc_post(state, &headers, room, thread_tag, delegate_opt, text, false).await\n }\n \n async fn rpc_check(\ndiff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs\nindex a13a94767d8905adc09e31effff838e166781b6c..5faa642451d69555cb391974beb0ad22c9355c8c 100644\n--- a/server/src/api/ui_html.rs\n+++ b/server/src/api/ui_html.rs\n@@ -118,6 +118,7 @@ async fn dispatch_ui_action(\n &session.bearer,\n room.clone(),\n thread_tag.clone(),\n+ None,\n text,\n )\n .await\n@@ -246,8 +247,7 @@ async fn dispatch_ui_action(\n }\n \n let text = format!(\n- \"@{}\\n{{\\n{}\\n}}\\n{} {}:{} {}\\n\",\n- crate::api::auth::WEB_BROWSER_AGENT,\n+ \"{{\\n{}\\n}}\\n{} {}:{} {}\\n\",\n exp,\n left_id.as_str(),\n rl,\n@@ -260,6 +260,7 @@ async fn dispatch_ui_action(\n &session.bearer,\n room.clone(),\n thread_tag.clone(),\n+ Some(crate::api::auth::WEB_BROWSER_AGENT.to_string()),\n text,\n )\n .await\ndiff --git a/server/src/html/forum/nav.rs b/server/src/html/forum/nav.rs\nindex d33dc50f0b89a5ed7730c3bca204a67f6309388f..ae67f550a4bdf0bbeff58384c29a715015b64bd5 100644\n--- a/server/src/html/forum/nav.rs\n+++ b/server/src/html/forum/nav.rs\n@@ -85,7 +85,7 @@ impl ThreadNav {\n format!(\"{}/{}/{}\", self.thread_path_prefix, tag, idx)\n }\n \n- /// Empty for public; `/r/:seg` for room — prefix for routes like `/vote/compare`.\n+ /// Empty for public; `/r/:seg` for room — prefix for routes like `/vote`.\n pub(crate) fn room_path_prefix_for_vote_compare(&self) -> String {\n match &self.scope {\n ScopeId::Public => String::new(),\ndiff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs\nindex bdb4008c29ba49d7dc97b1cd2c32d9cdfce1ca04..1d7fc8aa7436bfa9c1186dfd940a8d751ab7e088 100644\n--- a/server/src/html/garden/vote.rs\n+++ b/server/src/html/garden/vote.rs\n@@ -208,7 +208,7 @@ pub(crate) async fn vote_compare_post_success_js(\n state: &AppState,\n nav: &ThreadNav,\n _room_wire: &str,\n- thread_tag: &str,\n+ _thread_tag: &str,\n left: &ItemId,\n right: &ItemId,\n _post_id: &str,\n@@ -218,8 +218,7 @@ pub(crate) async fn vote_compare_post_success_js(\n let content = content_for_garden_view(&reduced, &nav.scope());\n let edge_history = vote_edge_history_markup(content, left, right);\n let next_pair = suggest_next_vote_pair(content, left, right);\n- let nav_markup =\n- vote_compare_nav_markup(nav, next_pair.as_ref(), left, right, Some(thread_tag));\n+ let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref());\n drop(reduced);\n JsBuilder::new()\n .morph_inner_selector(\"#vote-edge-history-region\", edge_history)\n@@ -236,7 +235,7 @@ pub(super) fn vote_compare_href(\n let left_q = urlencoding::encode(left.as_str());\n let right_q = urlencoding::encode(right.as_str());\n let base = format!(\n- \"{}/vote/compare?left={}&right={}\",\n+ \"{}/vote?left={}&right={}\",\n nav.room_path_prefix_for_vote_compare(),\n left_q,\n right_q\n@@ -251,12 +250,8 @@ pub(super) fn vote_compare_href(\n fn vote_compare_nav_markup(\n nav: &ThreadNav,\n next_pair: Option<&(ItemId, ItemId)>,\n- left: &ItemId,\n- right: &ItemId,\n- thread_override: Option<&str>,\n ) -> maud::Markup {\n let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None));\n- let swap_pair_href = vote_compare_href(nav, right, left, thread_override);\n html! {\n div class=\"vote-compare-nav\" {\n @if let Some(href) = &next_pair_href {\n@@ -264,7 +259,6 @@ fn vote_compare_nav_markup(\n } @else {\n span class=\"vote-compare-next is-disabled\" { \"no next pair\" }\n }\n- a class=\"vote-compare-next\" href=(swap_pair_href) { \"swap sides\" }\n }\n }\n }\n@@ -274,7 +268,7 @@ pub(super) fn suggest_next_vote_pair(\n current_left: &ItemId,\n current_right: &ItemId,\n ) -> Option<(ItemId, ItemId)> {\n- let mut pool: Vec = if current_left.parent().as_ref().map(|p| p.as_str())\n+ let pool: Vec = if current_left.parent().as_ref().map(|p| p.as_str())\n == current_right.parent().as_ref().map(|p| p.as_str())\n {\n current_left\n@@ -291,7 +285,7 @@ pub(super) fn suggest_next_vote_pair(\n Vec::new()\n };\n if pool.len() < 2 {\n- pool = content.items.iter().cloned().collect();\n+ return None;\n }\n suggest_next_pair_in_pool(\n &content.ranking_group,\n@@ -334,7 +328,7 @@ pub struct VoteCompareQuery {\n pub thread: Option,\n }\n \n-/// Public pairwise vote UI — `/vote/compare?left=&right=&thread=`.\n+/// Public pairwise vote UI — `/vote?left=&right=&thread=`.\n pub async fn vote_compare_page(\n State(state): State,\n Query(q): Query,\n@@ -426,7 +420,7 @@ async fn vote_compare_inner(\n let next_path = uri\n .path_and_query()\n .map(|pq| pq.as_str().to_string())\n- .unwrap_or_else(|| \"/vote/compare\".into());\n+ .unwrap_or_else(|| \"/vote\".into());\n \n let rpc_json = template_json_compact(&json!({\n \"action\": \"vote_compare_post\",\n@@ -462,7 +456,7 @@ async fn vote_compare_inner(\n Some(&item_bodies_for_cards),\n ))\n }\n- (vote_compare_nav_markup(&nav, next_pair.as_ref(), &left, &right, q.thread.as_deref()))\n+ (vote_compare_nav_markup(&nav, next_pair.as_ref()))\n div id=\"vote-edge-history-region\" {\n (edge_history)\n }\ndiff --git a/server/src/html/ui_action.rs b/server/src/html/ui_action.rs\nindex c7b643c8dde37dd1e3001f5ff716fe4f79d24c5e..dd5294202569454acf9f41b458718700bbf96f39 100644\n--- a/server/src/html/ui_action.rs\n+++ b/server/src/html/ui_action.rs\n@@ -38,7 +38,7 @@ pub enum HtmlUiAction {\n #[serde(default)]\n form_id: Option,\n },\n- /// Post a pairwise vote from `/vote/compare` (browser compose).\n+ /// Post a pairwise vote from `/vote` (browser compose).\n VoteComparePost {\n room: String,\n thread_tag: String,\ndiff --git a/server/src/lib.rs b/server/src/lib.rs\nindex ad8e31099c807fb5844acb16cd5086a2f19327a7..e102e73ec167fa35dcc22d4ec8c6f40202982429 100644\n--- a/server/src/lib.rs\n+++ b/server/src/lib.rs\n@@ -82,9 +82,9 @@ pub fn create_app(state: AppState) -> Router {\n .route(\"/u/:username\", get(crate::html::user_profile_page))\n .route(\"/try\", get(crate::html::editor_page))\n .route(\"/try/check\", post(crate::html::editor_check))\n- .route(\"/vote/compare\", get(crate::html::vote_compare_page))\n+ .route(\"/vote\", get(crate::html::vote_compare_page))\n .route(\n- \"/r/:room_key/vote/compare\",\n+ \"/r/:room_key/vote\",\n get(crate::html::room_vote_compare_page),\n )\n .route(\"/~\", get(crate::html::garden_index))\ndiff --git a/server/tests/integration_html.rs b/server/tests/integration_html.rs\nindex a25a456c7cafd74a69e65e0c2e8ed2bfb2e27498..b3e31376737b2d5aabb739f408984a1f5ae0c974 100644\n--- a/server/tests/integration_html.rs\n+++ b/server/tests/integration_html.rs\n@@ -52,12 +52,12 @@ async fn test_view_counts_increment_and_display() {\n .normalized_storage()\n .to_storage_string();\n let vote_q_right_first = format!(\n- \"/vote/compare?right={}&left={}\",\n+ \"/vote?right={}&left={}\",\n urlencoding::encode(&right),\n urlencoding::encode(&left)\n );\n let vote_q_left_first = format!(\n- \"/vote/compare?left={}&right={}\",\n+ \"/vote?left={}&right={}\",\n urlencoding::encode(&left),\n urlencoding::encode(&right)\n );\n@@ -148,7 +148,7 @@ https://github.com/ghvotehi/a/issues/10 {\\n\\\n .normalized_storage()\n .to_storage_string();\n let q = format!(\n- \"/vote/compare?left={}&right={}\",\n+ \"/vote?left={}&right={}\",\n urlencoding::encode(&left),\n urlencoding::encode(&right)\n );\ndiff --git a/server/tests/integration_ui.rs b/server/tests/integration_ui.rs\nindex 091afd922d28f48ab36aa9b9084aa825036d1f74..23db7b5672418d5bb0ab7529e05ef1f89e59062a 100644\n--- a/server/tests/integration_ui.rs\n+++ b/server/tests/integration_ui.rs\n@@ -110,7 +110,7 @@ async fn test_choose_username_carries_redirect_next() {\n .expect(\"pending session must exist\");\n pending.provider = Some(\"google\".to_string());\n pending.provider_id = Some(\"google-user-redirect\".to_string());\n- pending.redirect_next = Some(\"/vote/compare?left=%7E%2Fa&right=%7E%2Fb\".to_string());\n+ pending.redirect_next = Some(\"/vote?left=%7E%2Fa&right=%7E%2Fb\".to_string());\n }\n \n let choose = client\n@@ -122,7 +122,7 @@ async fn test_choose_username_carries_redirect_next() {\n \n assert_eq!(choose.status(), reqwest::StatusCode::OK);\n let body = choose.text().await.unwrap();\n- assert!(body.contains(\"window.location = \\\"/vote/compare?left=%7E%2Fa&right=%7E%2Fb\\\"\"));\n+ assert!(body.contains(\"window.location = \\\"/vote?left=%7E%2Fa&right=%7E%2Fb\\\"\"));\n }\n \n #[tokio::test]\ndiff --git a/test/browser_vote_compare.clj b/test/browser_vote_compare.clj\nindex 7cd1e467fdd8a4480df1be2afd78adb45b9cdc6d..a98e144756421e1fa5064db6a9fc0dd8b08471c7 100644\n--- a/test/browser_vote_compare.clj\n+++ b/test/browser_vote_compare.clj\n@@ -66,7 +66,7 @@\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\"])) \"seed items + edge vote via rpc\")\n- cmp-url (str base-url \"/vote/compare?left=\" (enc left-url) \"&right=\" (enc third-url))]\n+ cmp-url (str base-url \"/vote?left=\" (enc left-url) \"&right=\" (enc third-url))]\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\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"}