{"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[5350388a] Add pool-scoped voting: /vote?pool= picks pairs from children.\n\n- /vote now accepts an optional `pool` param (parent item path). When\n provided without left/right, it picks the first unvoted pair from the\n pool's children. When provided alongside left/right, it constrains\n \"next pair\" navigation to siblings within the pool.\n- \"vote on children\" button appears on item pages with ≥2 children,\n linking to /vote?pool=.\n- Pool is threaded through VoteComparePost → success JS so in-page\n morph after voting keeps the pool context for next-pair navigation.\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide A — unified diff (full patch):\ndiff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs\nindex 5faa642451d69555cb391974beb0ad22c9355c8c..b79efdb4d52bd445a67f38cbfd61d3507d2b3014 100644\n--- a/server/src/api/ui_html.rs\n+++ b/server/src/api/ui_html.rs\n@@ -193,6 +193,7 @@ async fn dispatch_ui_action(\n ratio_right,\n explanation,\n next,\n+ pool,\n form_action,\n } => {\n if form_action != \"/ui\" {\n@@ -239,6 +240,9 @@ async fn dispatch_ui_action(\n .into_response();\n }\n };\n+ let pool_id = pool.as_deref().and_then(|p| {\n+ crate::path_types::ItemId::parse(p.trim()).map(|i| i.normalized_storage())\n+ });\n let mut rl = ratio_left.trim().parse::().unwrap_or(0).max(0);\n let mut rr = ratio_right.trim().parse::().unwrap_or(0).max(0);\n if rl == 0 && rr == 0 {\n@@ -294,6 +298,7 @@ async fn dispatch_ui_action(\n &thread_tag,\n &left_id,\n &right_id,\n+ pool_id.as_ref(),\n pid.as_str(),\n post_index,\n )\ndiff --git a/server/src/html/garden/pin.rs b/server/src/html/garden/pin.rs\nindex 5865cfdbc06aeb6555c97380e25591fae6b3d125..1820d7fe7ee167ecbf5ad5124f23b2ab92ffb01f 100644\n--- a/server/src/html/garden/pin.rs\n+++ b/server/src/html/garden/pin.rs\n@@ -79,7 +79,7 @@ pub(super) fn ont_pin_vote_controls(\n }\n }\n } @else {\n- a class=\"ont-vote-compare-btn\" href=(vote_compare_href(nav, pi, ¤t, None)) title=\"Compare and vote\" {\n+ a class=\"ont-vote-compare-btn\" href=(vote_compare_href(nav, pi, ¤t, None, None)) title=\"Compare and vote\" {\n span class=\"ont-vote-glyph\" aria-hidden=\"true\" { \"⚖\" }\n span { \"vote\" }\n }\n@@ -121,7 +121,7 @@ pub(super) fn child_row_pin_or_vote(\n if nv == 1 { \"\" } else { \"s\" },\n );\n @let aria = format!(\"Vote; {} pairwise {}\", nv, if nv == 1 { \"vote\" } else { \"votes\" });\n- a class=\"ont-garden-vote-ico\" href=(vote_compare_href(nav, pi, row_item, None)) title=(tip) aria-label=(aria) {\n+ a class=\"ont-garden-vote-ico\" href=(vote_compare_href(nav, pi, row_item, None, None)) title=(tip) aria-label=(aria) {\n span class=\"ont-garden-vote-glyph\" aria-hidden=\"true\" { \"⚖\" }\n span class=\"ont-garden-vote-count\" { (format!(\"{}\", nv)) }\n }\ndiff --git a/server/src/html/garden/render.rs b/server/src/html/garden/render.rs\nindex 5c3986ca36902f6c9019a4b5590f0b3b9d2cb4ff..bd8cbce059ee789de6e8dc9b6f69f54beee2f994 100644\n--- a/server/src/html/garden/render.rs\n+++ b/server/src/html/garden/render.rs\n@@ -29,6 +29,7 @@ use super::{\n item::{child_depth_from_uri, item_code_label, item_display_path, item_href},\n item_page::{build_item_page_view_model, sibling_nav_markup},\n pin::{child_row_pin_or_vote, ont_pin_vote_controls, pinned_item_from_jar},\n+ vote::vote_pool_href,\n };\n \n pub(super) async fn render_scope_view(\n@@ -186,12 +187,21 @@ pub(super) async fn render_scope_view(\n }\n \n section class=\"ont-tab-panel ont-tab-panel-children\" {\n+ @let total_children = model.child_rankings.component_rankings\n+ .iter().map(|c| c.ranked.len()).sum::()\n+ + model.child_rankings.unranked_items.len();\n h3 {\n \"ranked child groups\"\n @if model.child_depth > 1 {\n \" \"\n span class=\"muted\" { (format!(\"(depth {})\", model.child_depth)) }\n }\n+ @if total_children >= 2 {\n+ \" \"\n+ a class=\"ont-vote-children-btn\" href=(vote_pool_href(&nav, &model.item)) {\n+ \"vote on children\"\n+ }\n+ }\n }\n @if model.child_rankings.component_rankings.is_empty() {\n p class=\"muted\" { \"no voted pairs yet in this scope\" }\ndiff --git a/server/src/html/garden/tests.rs b/server/src/html/garden/tests.rs\nindex 6900a6795bcde866a176722149d6378e5127b4c3..c2036fca7752aef63d260e36cfe9649f63b5c550 100644\n--- a/server/src/html/garden/tests.rs\n+++ b/server/src/html/garden/tests.rs\n@@ -105,7 +105,7 @@ fn suggest_next_vote_pair_prefers_unvoted_sibling_pair() {\n let content = content_for_garden_view(&reduced, &ScopeId::Public);\n let a = ItemId::parse(\"~/topic/a\").unwrap().normalized_storage();\n let b = ItemId::parse(\"~/topic/b\").unwrap().normalized_storage();\n- let next = suggest_next_vote_pair(content, &a, &b).expect(\"next sibling pair\");\n+ let next = suggest_next_vote_pair(content, &a, &b, None).expect(\"next sibling pair\");\n assert_ne!(\n canonical_edge_items(&next.0, &next.1),\n canonical_edge_items(&a, &b)\ndiff --git a/server/src/html/garden/vote.rs b/server/src/html/garden/vote.rs\nindex 1d7fc8aa7436bfa9c1186dfd940a8d751ab7e088..2682cfcbd2f834b56459a02831aa225cffe67c58 100644\n--- a/server/src/html/garden/vote.rs\n+++ b/server/src/html/garden/vote.rs\n@@ -211,14 +211,15 @@ pub(crate) async fn vote_compare_post_success_js(\n _thread_tag: &str,\n left: &ItemId,\n right: &ItemId,\n+ pool: Option<&ItemId>,\n _post_id: &str,\n _post_idx: Option,\n ) -> String {\n let reduced = state.reduced.read().await;\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 = vote_compare_nav_markup(nav, next_pair.as_ref());\n+ let next_pair = suggest_next_vote_pair(content, left, right, pool);\n+ let nav_markup = vote_compare_nav_markup(nav, next_pair.as_ref(), pool);\n drop(reduced);\n JsBuilder::new()\n .morph_inner_selector(\"#vote-edge-history-region\", edge_history)\n@@ -231,27 +232,39 @@ pub(super) fn vote_compare_href(\n left: &ItemId,\n right: &ItemId,\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 base = format!(\n+ let mut base = format!(\n \"{}/vote?left={}&right={}\",\n nav.room_path_prefix_for_vote_compare(),\n left_q,\n right_q\n );\n if let Some(t) = thread_override.filter(|s| !s.is_empty()) {\n- format!(\"{}&thread={}\", base, urlencoding::encode(t))\n- } else {\n- base\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 }\n+ base\n+}\n+\n+pub(super) fn vote_pool_href(nav: &ThreadNav, pool_item_str: &str) -> String {\n+ format!(\n+ \"{}/vote?pool={}\",\n+ nav.room_path_prefix_for_vote_compare(),\n+ urlencoding::encode(pool_item_str)\n+ )\n }\n \n fn vote_compare_nav_markup(\n nav: &ThreadNav,\n next_pair: Option<&(ItemId, ItemId)>,\n+ pool: Option<&ItemId>,\n ) -> maud::Markup {\n- let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None));\n+ let next_pair_href = next_pair.map(|(nl, nr)| vote_compare_href(nav, nl, nr, None, pool));\n html! {\n div class=\"vote-compare-nav\" {\n @if let Some(href) = &next_pair_href {\n@@ -267,8 +280,15 @@ pub(super) fn suggest_next_vote_pair(\n content: &ContentState,\n current_left: &ItemId,\n current_right: &ItemId,\n+ pool_parent: Option<&ItemId>,\n ) -> Option<(ItemId, ItemId)> {\n- let pool: Vec = if current_left.parent().as_ref().map(|p| p.as_str())\n+ let pool: Vec = if let Some(parent) = pool_parent {\n+ content\n+ .item_children\n+ .get(parent)\n+ .map(|s| s.iter().cloned().collect())\n+ .unwrap_or_default()\n+ } else 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@@ -322,10 +342,14 @@ pub(super) fn vote_compare_item_card(\n }\n #[derive(Debug, Deserialize)]\n pub struct VoteCompareQuery {\n- pub left: String,\n- pub right: String,\n+ #[serde(default)]\n+ pub left: Option,\n+ #[serde(default)]\n+ pub right: Option,\n #[serde(default)]\n pub thread: Option,\n+ #[serde(default)]\n+ pub pool: Option,\n }\n \n /// Public pairwise vote UI — `/vote?left=&right=&thread=`.\n@@ -376,17 +400,53 @@ async fn vote_compare_inner(\n jar: CookieJar,\n uri: Uri,\n ) -> axum::response::Response {\n- let left = match ItemId::parse(q.left.trim()) {\n- Some(i) => i.normalized_storage(),\n- None => return (StatusCode::NOT_FOUND, \"bad left item\").into_response(),\n+ let pool_id: Option = match q.pool.as_deref() {\n+ Some(p) => match ItemId::parse(p.trim()) {\n+ Some(i) => Some(i.normalized_storage()),\n+ None => return (StatusCode::BAD_REQUEST, \"bad pool item\").into_response(),\n+ },\n+ None => None,\n };\n- let right = match ItemId::parse(q.right.trim()) {\n- Some(i) => i.normalized_storage(),\n- None => return (StatusCode::NOT_FOUND, \"bad right item\").into_response(),\n+\n+ let (left, right) = match (q.left.as_deref(), q.right.as_deref()) {\n+ (Some(l), Some(r)) => {\n+ let left = match ItemId::parse(l.trim()) {\n+ Some(i) => i.normalized_storage(),\n+ None => return (StatusCode::NOT_FOUND, \"bad left item\").into_response(),\n+ };\n+ let right = match ItemId::parse(r.trim()) {\n+ Some(i) => i.normalized_storage(),\n+ None => return (StatusCode::NOT_FOUND, \"bad right item\").into_response(),\n+ };\n+ if left == right {\n+ return (StatusCode::BAD_REQUEST, \"items must differ\").into_response();\n+ }\n+ (left, right)\n+ }\n+ (None, None) => {\n+ let Some(pool) = pool_id.as_ref() else {\n+ return (StatusCode::BAD_REQUEST, \"provide left+right or pool\").into_response();\n+ };\n+ let reduced = state.reduced.read().await;\n+ let content = content_for_garden_view(&reduced, &nav.scope());\n+ let children: Vec = content\n+ .item_children\n+ .get(pool)\n+ .map(|s| s.iter().cloned().collect())\n+ .unwrap_or_default();\n+ if children.len() < 2 {\n+ drop(reduced);\n+ return (StatusCode::BAD_REQUEST, \"pool has fewer than 2 children to compare\").into_response();\n+ }\n+ let pair = suggest_next_pair_in_pool(&content.ranking_group, &children, None);\n+ drop(reduced);\n+ match pair {\n+ Some(p) => p,\n+ None => return (StatusCode::BAD_REQUEST, \"no pairs available in pool\").into_response(),\n+ }\n+ }\n+ _ => return (StatusCode::BAD_REQUEST, \"provide both left and right, or just pool\").into_response(),\n };\n- if left == right {\n- return (StatusCode::BAD_REQUEST, \"items must differ\").into_response();\n- }\n \n let reduced = state.reduced.read().await;\n let content = content_for_garden_view(&reduced, &nav.scope());\n@@ -409,7 +469,7 @@ async fn vote_compare_inner(\n let left_body = content.item_bodies.get(&left).cloned();\n let right_body = content.item_bodies.get(&right).cloned();\n let item_bodies_for_cards = content.item_bodies.clone();\n- let next_pair = suggest_next_vote_pair(content, &left, &right);\n+ let next_pair = suggest_next_vote_pair(content, &left, &right, pool_id.as_ref());\n drop(reduced);\n \n let title = format!(\n@@ -432,6 +492,7 @@ async fn vote_compare_inner(\n \"ratio_right\": {\"$form\": \"ratio_right\"},\n \"explanation\": {\"$form\": \"explanation\"},\n \"next\": next_path,\n+ \"pool\": pool_id.as_ref().map(|p| p.as_str()),\n \"form_action\": \"/ui\",\n }))\n .expect(\"vote compare rpc json\");\n@@ -456,7 +517,7 @@ async fn vote_compare_inner(\n Some(&item_bodies_for_cards),\n ))\n }\n- (vote_compare_nav_markup(&nav, next_pair.as_ref()))\n+ (vote_compare_nav_markup(&nav, next_pair.as_ref(), pool_id.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 dd5294202569454acf9f41b458718700bbf96f39..2589a2cc00bb7b18cd19ebcbb938083122d6921d 100644\n--- a/server/src/html/ui_action.rs\n+++ b/server/src/html/ui_action.rs\n@@ -50,6 +50,9 @@ pub enum HtmlUiAction {\n explanation: String,\n /// Same-origin path after successful post (JS redirect).\n next: String,\n+ /// Pool parent item path, if the vote was initiated from a pool URL.\n+ #[serde(default)]\n+ pool: Option,\n #[serde(default = \"default_ui_form_action\")]\n form_action: String,\n },\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[81de487b] Fix zero-ratio guard in reducer to drop before registering items or pair.\n\nPreviously the early-return for zero-weight votes happened after\nensure_item and voted_pairs.insert, leaving ghost items in the index\nand the pair incorrectly marked as voted. Move the check to before\nany side effects.\n\nCo-Authored-By: Claude Sonnet 4.6 \n\nSide B — unified diff (full patch):\ndiff --git a/server/src/reducer.rs b/server/src/reducer.rs\nindex 6841d35cfc9de2389f340a22b8a45acb335e36c3..0e36979abe0f051493038ff7e652efc7f7a0ac80 100644\n--- a/server/src/reducer.rs\n+++ b/server/src/reducer.rs\n@@ -112,6 +112,10 @@ impl GroupState {\n if vote.ratio_right < 0 {\n vote.ratio_right = 0;\n }\n+ if vote.ratio_left == 0 || vote.ratio_right == 0 {\n+ // Zero on either side produces no valid edge; drop before registering items or pair.\n+ return;\n+ }\n \n let a_idx = self.ensure_item(&vote.a);\n let b_idx = self.ensure_item(&vote.b);\n@@ -121,10 +125,6 @@ impl GroupState {\n \n let w_a = vote.ratio_left as f64;\n let w_b = vote.ratio_right as f64;\n- if w_a == 0.0 || w_b == 0.0 {\n- // Zero on either side produces no valid edge; drop the vote.\n- return;\n- }\n \n self.add_edge_weight(b_idx, a_idx, w_a);\n self.add_edge_weight(a_idx, b_idx, w_b);\ndiff --git a/server/tests/basic.rs b/server/tests/basic.rs\nindex cc8c1a0d139f3722ba6ecd13dd001c65be835b67..08159f4a7f0850fd165817a4a1af4f31ced2ad76 100644\n--- a/server/tests/basic.rs\n+++ b/server/tests/basic.rs\n@@ -546,12 +546,10 @@ fn reducer_negative_ratio_clamped_to_zero() {\n delegate: Some(\"00000000-0000-0000-0000-000000000000:test:local/test\".to_string()),\n thread_tag: \"t\".to_string(),\n });\n- // Items are registered, but the zero-clamped vote produces no edges.\n- assert_eq!(group.idx_to_item.len(), 2);\n- let a_idx = group.item_to_idx[&item_id(\"https://slug.social/~/t/a\")];\n- let b_idx = group.item_to_idx[&item_id(\"https://slug.social/~/t/b\")];\n- assert!(!group.edges.contains_key(&(a_idx, b_idx)));\n- assert!(!group.edges.contains_key(&(b_idx, a_idx)));\n+ // Nothing registered: zero-clamped vote is dropped before ensure_item.\n+ assert!(group.idx_to_item.is_empty());\n+ assert!(group.edges.is_empty());\n+ assert!(group.voted_pairs.is_empty());\n }\n \n \n","role":"user"}],"model":"openai/gpt-chat-latest"}