{"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[3bc88847] removed optional\n\nSide A — unified diff (full patch):\ndiff --git a/server/src/api/rpc.rs b/server/src/api/rpc.rs\nindex ba93ca87182d49f57dffc8220f604ffa150f9a6c..5049a26b096bd8435d6eb9e75ccb751b6f489061 100644\n--- a/server/src/api/rpc.rs\n+++ b/server/src/api/rpc.rs\n@@ -1337,8 +1337,7 @@ pub async fn handle_rpc_batch(\n .ingests_by_scope_thread\n .get(&(scope.clone(), e.thread.clone()))\n .and_then(|q| q.iter().rev().position(|id| id == &e.post_id))\n- .map(|i| i + 1)\n- .unwrap_or(0);\n+ .expect(\"rank history post_id must be in ingests_by_scope_thread for (scope, thread)\");\n RankHistoryRow {\n ts: e.ts,\n scope_rank: e.scope_rank,\ndiff --git a/server/src/html/garden.rs b/server/src/html/garden.rs\nindex 319feb15a6b68d2b5df98b4289fedbc9bdd048d3..23245d6fdfc9019b199ab8417150faf5f3297067 100644\n--- a/server/src/html/garden.rs\n+++ b/server/src/html/garden.rs\n@@ -450,6 +450,7 @@ struct RankHistoryEntryView {\n scope_total: usize,\n scope_rank_delta: i32,\n thread: String,\n+ /// 0-based index as [`crate::html::forum::ingest::thread_post_index_in_scope`] / `/t/tag/N`.\n thread_post_index: usize,\n caused_by: Vec,\n }\n@@ -573,11 +574,11 @@ fn build_rank_history(\n })\n .unwrap_or_default();\n \n- let thread_post_index = reduced.ingests_by_scope_thread\n+ let thread_post_index = reduced\n+ .ingests_by_scope_thread\n .get(&(scope.clone(), e.thread.clone()))\n .and_then(|q| q.iter().rev().position(|id| id == &e.post_id))\n- .map(|i| i + 1)\n- .unwrap_or(0);\n+ .expect(\"rank history post_id must be in ingests_by_scope_thread for (scope, thread)\");\n \n RankHistoryEntryView {\n ts: e.ts,\n@@ -704,11 +705,9 @@ async fn render_scope_view(\n span class=\"muted\" { (ago) (label) }\n \" · \"\n a href=(thread_href(&e.thread)) { \"#\" (e.thread) }\n- @if e.thread_post_index > 0 {\n- \" \"\n- a href=(format!(\"{}/{}\", thread_href(&e.thread), e.thread_post_index)) {\n- span class=\"muted\" { \"post #\" (e.thread_post_index) }\n- }\n+ \" \"\n+ a href=(format!(\"{}/{}\", thread_href(&e.thread), e.thread_post_index)) {\n+ span class=\"muted\" { \"post #\" (e.thread_post_index) }\n }\n }\n @if e.caused_by.is_empty() {\ndiff --git a/server/tests/integration.rs b/server/tests/integration.rs\nindex d4c5bfe9c6f1c71dc61878bd8c5e729b1b7c69ef..9766adb43ad315a64f5df17b79f66718ce149509 100644\n--- a/server/tests/integration.rs\n+++ b/server/tests/integration.rs\n@@ -1322,6 +1322,11 @@ async fn test_rank_history() {\n assert_eq!(entry[\"scope_rank_delta\"], 0, \"delta is 0 on first appearance\");\n let caused_by = entry[\"caused_by\"].as_array().unwrap();\n assert_eq!(caused_by.len(), 2, \"both votes in the ingest touched rust\");\n+ assert_eq!(\n+ entry[\"thread_post_index\"],\n+ 0,\n+ \"rank history links use same 0-based index as /t/hist-test/0\"\n+ );\n \n ingest(\n \"00000000-0000-0000-0000-000000000002:rig:test/model\",\n@@ -1349,6 +1354,16 @@ async fn test_rank_history() {\n assert_eq!(caused_by2.len(), 1);\n assert!(caused_by2[0][\"a\"].as_str().unwrap().ends_with(\"python\") ||\n caused_by2[0][\"b\"].as_str().unwrap().ends_with(\"python\"));\n+ assert_eq!(\n+ hist2[0][\"thread_post_index\"],\n+ 0,\n+ \"first hist-test post is chronological index 0\"\n+ );\n+ assert_eq!(\n+ hist2[1][\"thread_post_index\"],\n+ 1,\n+ \"second ingest is chronological index 1\"\n+ );\n \n let hist_rust2 = rpc_batch(\n &client,\ndiff --git a/types/src/lib.rs b/types/src/lib.rs\nindex edbb923e4d7d41ad82dfc254c3bd697562383527..49abba8ea9f786ef68e3157d2a5d309e15e09ba0 100644\n--- a/types/src/lib.rs\n+++ b/types/src/lib.rs\n@@ -253,7 +253,7 @@ pub struct FeedPost {\n /// Primary thread tag (without #), if the ingest declared one.\n #[serde(skip_serializing_if = \"Option::is_none\")]\n pub thread: Option,\n- /// 1-indexed chronological position of this post within the thread.\n+ /// 1-based display ordinal for this post within the thread (feed only; URLs use 0-based paths).\n #[serde(skip_serializing_if = \"Option::is_none\")]\n pub thread_post_index: Option,\n /// Full raw body of the ingest document.\n@@ -628,7 +628,7 @@ pub struct RankHistoryRow {\n pub score: f64,\n /// Thread tag of the ingest that triggered this rank change.\n pub thread: String,\n- /// 1-indexed chronological position of this post within the thread.\n+ /// 0-indexed chronological position of this post within the thread (same as `/t/tag/N` routes).\n pub thread_post_index: usize,\n /// Votes from this ingest that directly touched this item. Empty when change was transitive.\n pub caused_by: Vec,\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[798c764d] feat(html): grouped cli_panel with hover-to-copy and JS-safe asserts\n\nSingle bordered panel for multiple commands; rows copy on click without a\nseparate copy control. Assert CLI strings contain no chars that would break\nsingle-quoted onclick JS.\n\nMade-with: Cursor\n\nSide B — unified diff (full patch):\ndiff --git a/server/src/html/forum.rs b/server/src/html/forum.rs\nindex f6e45b05bb92126966e304619f80ef1d45be7a4b..075860914a6ce18bb0dfa73dc5651ef1a6318b67 100644\n--- a/server/src/html/forum.rs\n+++ b/server/src/html/forum.rs\n@@ -718,7 +718,7 @@ pub async fn home(\n }\n div id=\"public-new-thread-ui-slot\" {}\n (render_thread_feed(Some(&nav), \"thread-feed\", &public_rows, now))\n- (cli_panel(\"npx slugsocial public forum list\"))\n+ (cli_panel(&[\"npx slugsocial public forum list\"]))\n },\n None,\n theme_from_jar(&jar),\n@@ -868,7 +868,7 @@ async fn thread_view_inner(\n div id=\"thread-live-region\" {\n (compose_form(&nav, &tag, show_compose))\n }\n- (cli_panel(&cli))\n+ (cli_panel(std::slice::from_ref(&cli)))\n },\n None,\n theme_from_jar(&jar),\n@@ -984,9 +984,7 @@ pub async fn room_page(\n (new_thread_form_for_room(&nav, true, false))\n }\n }\n- (cli_panel(&forum_cli))\n- (cli_panel(&garden_cli))\n- (cli_panel(&audit_cli))\n+ (cli_panel(&[forum_cli, garden_cli, audit_cli]))\n },\n None,\n theme_from_jar(&jar),\n@@ -1409,7 +1407,7 @@ pub async fn user_profile_page(\n }\n }\n }\n- (cli_panel(&format!(\"npx slugsocial public forum list\")))\n+ (cli_panel(&[format!(\"npx slugsocial public forum list\")]))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/src/html/garden.rs b/server/src/html/garden.rs\nindex 9b4789a79c3e293cbfc5f033a0eac8650320d94d..c8ce7de450f7d14e04020511e7eb7323bd487deb 100644\n--- a/server/src/html/garden.rs\n+++ b/server/src/html/garden.rs\n@@ -139,7 +139,7 @@ pub async fn garden_index(\n }\n }\n }\n- (cli_panel(\"npx slugsocial garden tree\"))\n+ (cli_panel(&[\"npx slugsocial garden tree\"]))\n },\n None,\n theme_from_jar(&jar),\n@@ -542,7 +542,7 @@ async fn render_scope_view(\n ScopeId::Public => format!(\"npx slugsocial public garden body {}\", path.as_str().trim_start_matches(\"https://slug.social/~/\")),\n ScopeId::Room(room_id) => format!(\"npx slugsocial private {room_id} garden body {}\", path.as_str().trim_start_matches(\"https://slug.social/~/\")),\n };\n- (cli_panel(&cli))\n+ (cli_panel(std::slice::from_ref(&cli)))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/src/html/mod.rs b/server/src/html/mod.rs\nindex e7f5bfb7a4b2dee2adf96447224c58d641092124..6617781a2e8e86c2e2693788ea7cd0eb0e3659a2 100644\n--- a/server/src/html/mod.rs\n+++ b/server/src/html/mod.rs\n@@ -599,18 +599,38 @@ pub(super) fn render_linkified_with_embeds_in_scope(raw: &str, garden_prefix: &s\n }\n }\n \n-/// Small CLI hint panel showing how to look up this page from the terminal.\n-pub(super) fn cli_panel(cmd: &str) -> Markup {\n+/// CLI strings are embedded in a single-quoted JS literal; they must never need escaping.\n+fn assert_cli_panel_cmd_js_single_quote_safe(s: &str) {\n+ assert!(\n+ !s.contains('\\\\')\n+ && !s.contains('\\'')\n+ && !s.contains('\\n')\n+ && !s.contains('\\r'),\n+ \"cli_panel cmd must not contain `\\\\`, `'`, or newlines (got {s:?})\"\n+ );\n+}\n+\n+/// Small CLI hint panel: one border and title; each line is hover-highlighted and copies on click.\n+pub(super) fn cli_panel>(cmds: &[I]) -> Markup {\n+ if cmds.is_empty() {\n+ return html! {};\n+ }\n+ for cmd in cmds {\n+ assert_cli_panel_cmd_js_single_quote_safe(cmd.as_ref());\n+ }\n html! {\n div class=\"cli-panel\" {\n span class=\"cli-panel-label muted\" { \"cli\" }\n- code class=\"cli-panel-cmd\" { (cmd) }\n- button\n- class=\"cli-panel-copy\"\n- title=\"Copy to clipboard\"\n- onclick=(format!(r#\"navigator.clipboard.writeText('{}'); this.textContent='✓'; setTimeout(() => this.textContent='copy', 2000);\"#, cmd.replace(\"'\", \"\\\\'\")))\n- {\n- \"copy\"\n+ div class=\"cli-panel-cmds\" {\n+ @for cmd in cmds {\n+ @let s = cmd.as_ref();\n+ button type=\"button\" class=\"cli-panel-row\" title=\"Copy command\" onclick=(format!(\n+ r#\"navigator.clipboard.writeText('{}');\"#,\n+ s\n+ )) {\n+ code class=\"cli-panel-cmd\" { (s) }\n+ }\n+ }\n }\n }\n }\ndiff --git a/server/src/html/search.rs b/server/src/html/search.rs\nindex 28ceaa53c3fcac6777311535e95fb771b19438f5..43e6ebf36cf0fe72c96f0f9d850bea51ac094c43 100644\n--- a/server/src/html/search.rs\n+++ b/server/src/html/search.rs\n@@ -418,7 +418,7 @@ pub async fn search_page(\n value=(query) autocomplete=\"off\" autofocus;\n }\n (render_search_results(&results, &query))\n- (cli_panel(\"npx slugsocial search \"))\n+ (cli_panel(&[\"npx slugsocial search \"]))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/static/theme_default.css b/server/static/theme_default.css\nindex e024a5c8b74139ae8be37b2a1bd17e4c3abe9324..764b66c8208e91e6138b83c534387cf43c85b8b5 100644\n--- a/server/static/theme_default.css\n+++ b/server/static/theme_default.css\n@@ -610,7 +610,7 @@ code {\n CLI PANEL — how to view this page from the terminal\n ---------------------------------------------------------------- */\n div.cli-panel {\n- align-items: baseline;\n+ align-items: flex-start;\n background: var(--g1);\n border: var(--bv) solid;\n border-color: var(--lo) var(--hi) var(--hi) var(--lo); /* inset */\n@@ -621,11 +621,34 @@ div.cli-panel {\n width: fit-content;\n max-width: 100%;\n }\n+.cli-panel-cmds {\n+ display: flex;\n+ flex-direction: column;\n+ gap: 4px;\n+ flex: 1;\n+ min-width: 0;\n+}\n+button.cli-panel-row {\n+ background: transparent;\n+ border: none;\n+ color: inherit;\n+ cursor: pointer;\n+ display: block;\n+ font: inherit;\n+ margin: 0;\n+ padding: 2px 4px;\n+ text-align: left;\n+ width: 100%;\n+}\n+button.cli-panel-row:hover {\n+ background: var(--g3);\n+}\n .cli-panel-label {\n font-size: 11px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n flex-shrink: 0;\n+ padding-top: 2px;\n }\n .cli-panel-cmd {\n background: none;\ndiff --git a/server/static/theme_retro_craft.css b/server/static/theme_retro_craft.css\nindex 00714575bfa533d1d9c66653b9089642e2b0a6ca..f89ecbc3a18eb9b2b27d1f7764330f6bd6987552 100644\n--- a/server/static/theme_retro_craft.css\n+++ b/server/static/theme_retro_craft.css\n@@ -306,19 +306,41 @@ a.post-nav-btn:hover {\n }\n \n div.cli-panel {\n- align-items: baseline;\n+ align-items: flex-start;\n border: 1px dashed var(--line);\n display: flex;\n- flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0.65rem 0;\n padding: 0.45rem 0.65rem;\n }\n+.cli-panel-cmds {\n+ display: flex;\n+ flex-direction: column;\n+ gap: 0.25rem;\n+ flex: 1;\n+ min-width: 0;\n+}\n+button.cli-panel-row {\n+ background: transparent;\n+ border: none;\n+ color: inherit;\n+ cursor: pointer;\n+ display: block;\n+ font: inherit;\n+ margin: 0;\n+ padding: 0.1rem 0.2rem;\n+ text-align: left;\n+ width: 100%;\n+}\n+button.cli-panel-row:hover {\n+ background: color-mix(in srgb, var(--accent) 14%, transparent);\n+}\n .cli-panel-label {\n color: var(--ink-dim);\n font-size: 0.72rem;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n+ padding-top: 0.12rem;\n }\n .cli-panel-cmd {\n color: var(--accent);\n","role":"user"}],"model":"~anthropic/claude-sonnet-latest"}