Side B fixes a real correctness bug (silently defaulting to 0 instead of failing when an ingested post can't be found, and inconsistent 1-vs-0 indexing across garden.rs, rpc.rs, and types docs), consistently updates all affected call sites, and adds integration tests asserting correct index values. Side A only adds a new CLI display helper for existing stats with unit tests, which is useful but a smaller, purely additive feature rather than a fix to an existing defect.
constitution · epochs · watch · epoch 3
c_d6d339485601 (tommy-mor) vs c_6a02ffb06a41 (tommy-mor)
download prompt · raw event · cmp_c3494735dfbed0
council reasoning
A adds a complete, tested user-facing feature that surfaces existing ConnectivityStats (density, components, comparisons-to-connect) in pair CLI output, directly aiding voting decisions. B only tightens rank-history indexing (drop unwrap_or(0)/1-based map, always emit 0-based links, assert in tests)—a useful consistency fix, but narrower and less product leverage than A’s topology guidance.
Side A adds a new user-facing capability by exposing graph connectivity statistics in CLI pair output, including density, component count, connection status, and dedicated tests covering connected and disconnected cases. Side B mainly tightens an invariant by replacing fallback values with `expect`, aligns documentation and UI around 0-based thread indices, and adds assertions, but it is largely a consistency/refinement change rather than a substantial new feature.
sides
A — c_d6d339485601 (tommy-mor)
message
[14749a34] Show graph topology with pair suggestions Expose existing connectivity statistics in CLI output so voters can see sparse or disconnected scopes before adding an edge. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/cli/src/main.rs b/cli/src/main.rs
index 70435b412188a151c5e89e842a5de57f7480ddf2..abb5a55b49f60fe28fbfd4ec02715cb94ea0b4ec 100644
--- a/cli/src/main.rs
+++ b/cli/src/main.rs
@@ -397,6 +397,29 @@ fn print_item_response(resp: &ItemResponse) {
}
}
+fn format_connectivity_stats(stats: &ConnectivityStats) -> String {
+ let density = if stats.pairs_possible == 0 {
+ 0.0
+ } else {
+ stats.pairs_voted as f64 / stats.pairs_possible as f64 * 100.0
+ };
+ let component_label = if stats.components == 1 { "component" } else { "components" };
+ let connection_status = if stats.comparisons_until_connected == 0 {
+ "connected".to_string()
+ } else {
+ let comparison_label = if stats.comparisons_until_connected == 1 {
+ "comparison"
+ } else {
+ "comparisons"
+ };
+ format!("{} {comparison_label} to connect", stats.comparisons_until_connected)
+ };
+ format!(
+ "graph: {} items, {}/{} pairs ({density:.1}% density), {} {component_label}, {connection_status}",
+ stats.items, stats.pairs_voted, stats.pairs_possible, stats.components,
+ )
+}
+
fn print_pair_response(resp: &PairResponse) {
println!("{} vs {}", resp.left, resp.right);
if let Some(b) = &resp.left_body {
@@ -413,6 +436,10 @@ fn print_pair_response(resp: &PairResponse) {
println!();
println!("threads: {}", resp.threads.iter().map(|t| format!("#{t}")).collect::<Vec<_>>().join(" "));
}
+ if let Some(stats) = &resp.connectivity {
+ println!();
+ println!("{}", format_connectivity_stats(stats));
+ }
println!();
println!("---");
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.");
@@ -816,6 +843,43 @@ fn write_secret_file(name: &str, contents: &str) -> Result<()> {
Ok(())
}
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn connectivity_stats_show_sparse_disconnected_graph() {
+ let stats = ConnectivityStats {
+ items: 9,
+ components: 3,
+ comparisons_until_connected: 2,
+ pairs_voted: 8,
+ pairs_possible: 36,
+ };
+
+ assert_eq!(
+ format_connectivity_stats(&stats),
+ "graph: 9 items, 8/36 pairs (22.2% density), 3 components, 2 comparisons to connect"
+ );
+ }
+
+ #[test]
+ fn connectivity_stats_show_connected_graph() {
+ let stats = ConnectivityStats {
+ items: 4,
+ components: 1,
+ comparisons_until_connected: 0,
+ pairs_voted: 3,
+ pairs_possible: 6,
+ };
+
+ assert_eq!(
+ format_connectivity_stats(&stats),
+ "graph: 4 items, 3/6 pairs (50.0% density), 1 component, connected"
+ );
+ }
+}
+
async fn run_scoped(base: &str, room: &str, sub: ScopedCmd) -> Result<()> {
let room = room.trim();
let client = http_client()?;
B — c_6a02ffb06a41 (tommy-mor)
message
[3bc88847] removed optional
diff preview
diff --git a/server/src/api/rpc.rs b/server/src/api/rpc.rs
index ba93ca87182d49f57dffc8220f604ffa150f9a6c..5049a26b096bd8435d6eb9e75ccb751b6f489061 100644
--- a/server/src/api/rpc.rs
+++ b/server/src/api/rpc.rs
@@ -1337,8 +1337,7 @@ pub async fn handle_rpc_batch(
.ingests_by_scope_thread
.get(&(scope.clone(), e.thread.clone()))
.and_then(|q| q.iter().rev().position(|id| id == &e.post_id))
- .map(|i| i + 1)
- .unwrap_or(0);
+ .expect("rank history post_id must be in ingests_by_scope_thread for (scope, thread)");
RankHistoryRow {
ts: e.ts,
scope_rank: e.scope_rank,
diff --git a/server/src/html/garden.rs b/server/src/html/garden.rs
index 319feb15a6b68d2b5df98b4289fedbc9bdd048d3..23245d6fdfc9019b199ab8417150faf5f3297067 100644
--- a/server/src/html/garden.rs
+++ b/server/src/html/garden.rs
@@ -450,6 +450,7 @@ struct RankHistoryEntryView {
scope_total: usize,
scope_rank_delta: i32,
thread: String,
+ /// 0-based index as [`crate::html::forum::ingest::thread_post_index_in_scope`] / `/t/tag/N`.
thread_post_index: usize,
caused_by: Vec<crate::reducer::VoteData>,
}
@@ -573,11 +574,11 @@ fn build_rank_history(
})
.unwrap_or_default();
- let thread_post_index = reduced.ingests_by_scope_thread
+ let thread_post_index = reduced
+ .ingests_by_scope_thread
.get(&(scope.clone(), e.thread.clone()))
.and_then(|q| q.iter().rev().position(|id| id == &e.post_id))
- .map(|i| i + 1)
- .unwrap_or(0);
+ .expect("rank history post_id must be in ingests_by_scope_thread for (scope, thread)");
RankHistoryEntryView {
ts: e.ts,
@@ -704,11 +705,9 @@ async fn render_scope_view(
span class="muted" { (ago) (label) }
" · "
a href=(thread_href(&e.thread)) { "#" (e.thread) }
- @if e.thread_post_index > 0 {
- " "
- a href=(format!("{}/{}", thread_href(&e.thread), e.thread_post_index)) {
- span class="muted" { "post #" (e.thread_post_index) }
- }
+ " "
+ a href=(format!("{}/{}", thread_href(&e.thread), e.thread_post_index)) {
+ span class="muted" { "post #" (e.thread_post_index) }
}
}
@if e.caused_by.is_empty() {
diff --git a/server/tests/integration.rs b/server/tests/integration.rs
index d4c5bfe9c6f1c71dc61878bd8c5e729b1b7c69ef..9766adb43ad315a64f5df17b79f66718ce149509 100644
--- a/server/tests/integration.rs
+++ b/server/tests/integration.rs
@@ -1322,6 +1322,11 @@ async fn test_rank_history() {
assert_eq!(entry["scope_rank_delta"], 0, "delta is 0 on first appearance");
let caused_by = entry["caused_by"].as_array().unwrap();
assert_eq!(caused_by.len(), 2, "both votes in the ingest touched rust");
+ assert_eq!(
+ entry["thread_post_index"],
+ 0,
+ "rank history links use same 0-based index as /t/hist-test/0"
+ );
ingest(
"00000000-0000-0000-0000-000000000002:rig:test/model",
@@ -1349,6 +1354,16 @@ async fn test_rank_history() {
assert_eq!(caused_by2.len(), 1);
assert!(caused_by2[0]["a"].as_str().unwrap().ends_with("python") ||
caused_by2[0]["b"].as_str().unwrap().ends_with("python"));
+ assert_eq!(
+ hist2[0]["thread_post_index"],
+ 0,
+ "first hist-test post is chronological index 0"
+ );
+ assert_eq!(
+ hist2[1]["thread_post_index"],
+ 1,
+ "second ingest is chronological index 1"
+ );
let hist_rust2 = rpc_batch(
&client,
diff --git a/types/src/lib.rs b/types/src/lib.rs
index edbb923e4d7d41ad82dfc254c3bd697562383527..49abba8ea9f786ef68e3157d2a5d309e15e09ba0 100644
--- a/types/src/lib.rs
+++ b/types/src/lib.rs
@@ -253,7 +253,7 @@ pub struct FeedPost {
/// Primary thread tag (without #), if the ingest declared one.
#[serde(skip_serializing_if = "Option::is_none")]
pub thread: Option<String>,
- /// 1-indexed chronological position of this post within the thread.
+ /// 1-based display ordinal for this post within the thread (feed only; URLs use 0-based paths).
#[serde(skip_serializing_if = "Option::is_none")]
pub thread_post_index: Option<usize>,
/// Full raw body of the ingest document.
@@ -628,7 +628,7 @@ pub struct RankHistoryRow {
pub score: f64,
/// Thread tag of the ingest that triggered this rank change.
pub thread: String,
- /// 1-indexed chronological position of this post within the thread.
+ /// 0-indexed chronological position of this post within the thread (same as `/t/tag/N` routes).
pub thread_post_index: usize,
/// Votes from this ingest that directly touched this item. Empty when change was transitive.
pub caused_by: Vec<VoteRow>,
Hardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.