constitution · epochs · watch · epoch 7
comparison
c_8ab77bd33251 (tommy-mor) vs c_a7c8c56586a8 (tommy-mor)
download prompt · raw event · cmp_8aac70f2badf7a
council reasoning
No judgments yet.
sides
A — c_8ab77bd33251 (tommy-mor)
message
[239f4693] Point body/matchup 404s at garden children when path is a scope garden body ~/portraits 404s with a bare does-not-exist hint even though garden children -- portraits ranks 22 members. When the leaf is absent from items but has scope members, the hint now names the scope, its child count, and the exact children command to run.
diff preview
diff --git a/server/src/api/rpc.rs b/server/src/api/rpc.rs
index 83cd06182ce4d0139f4d7fb77965acd938d50f4f..a8b960491de845fa876da7ad9bd3204766ff4999 100644
--- a/server/src/api/rpc.rs
+++ b/server/src/api/rpc.rs
@@ -1065,13 +1065,31 @@ pub async fn dispatch_rpc(state: &AppState, headers: &HeaderMap, cmd: RpcCommand
.unwrap_or_else(|| ItemId::opaque(item_str.clone()));
let item_str = item.as_str().to_string();
if !content.items.contains(&item) {
- line_err(
- "item not found",
- Some(format!(
- "{} does not exist",
- GardenItemUrl::from_storage_str(&item_str, &room)
- )),
- )
+ let members = content.members_of(&item);
+ if !members.is_empty() {
+ let leaf = item.last_segment();
+ let children_cmd = if room == "public" {
+ format!("npx slugsocial@latest public garden children -- {leaf}")
+ } else {
+ format!("npx slugsocial@latest private {room} garden children -- {leaf}")
+ };
+ line_err(
+ "item not found",
+ Some(format!(
+ "{} is a scope with {} children, not an item with a body (folder paths are scopes, not vote targets); rank them with: {children_cmd}",
+ GardenItemUrl::from_storage_str(&item_str, &room),
+ members.len(),
+ )),
+ )
+ } else {
+ line_err(
+ "item not found",
+ Some(format!(
+ "{} does not exist",
+ GardenItemUrl::from_storage_str(&item_str, &room)
+ )),
+ )
+ }
} else {
let want_full = full.unwrap_or(false);
let (body, truncated, body_len) = match content.item_bodies.get(&item) {
@@ -1505,13 +1523,31 @@ pub async fn dispatch_rpc(state: &AppState, headers: &HeaderMap, cmd: RpcCommand
let item_str = item.as_str().to_string();
let limit = limit.unwrap_or(50).clamp(1, 200);
if !content.items.contains(&item) {
- line_err(
- "item not found",
- Some(format!(
- "{} does not exist",
- GardenItemUrl::from_storage_str(&item_str, &room)
- )),
- )
+ let members = content.members_of(&item);
+ if !members.is_empty() {
+ let leaf = item.last_segment();
+ let children_cmd = if room == "public" {
+ format!("npx slugsocial@latest public garden children -- {leaf}")
+ } else {
+ format!("npx slugsocial@latest private {room} garden children -- {leaf}")
+ };
+ line_err(
+ "item not found",
+ Some(format!(
+ "{} is a scope with {} children, not an item with vote history (folder paths are scopes, not vote targets); rank them with: {children_cmd}",
+ GardenItemUrl::from_storage_str(&item_str, &room),
+ members.len(),
+ )),
+ )
+ } else {
+ line_err(
+ "item not found",
+ Some(format!(
+ "{} does not exist",
+ GardenItemUrl::from_storage_str(&item_str, &room)
+ )),
+ )
+ }
} else {
let votes: Vec<VoteRow> = content
.item_votes
B — c_a7c8c56586a8 (tommy-mor)
message
[279ebd55] Add score-history replay at ?v=history (the sorter-proof chart, grown up)
Scope pages now carry an always-visible bar above the ranked children
that links "open the replay →" once >=2 members carry >=2 member<->member
vote events (empty state + vote link until then; childless leaves stay
clean). The replay is a query-param view of the scope page itself:
- ?v=history serves a one-HTML-file React app — the sorter-proof
"Ranking Replay 2" stack verbatim (CDN React 18 UMD + babel-standalone
+ Chart.js + React Query, inline JSX): autoplay/scrub/speed controls,
hue-rotated tension-0.4 lines, current-rankings + unsorted legend,
5s polling, and the clickable comparison matrix whose cells open the
full vote reasoning.
- ?v=history.json serves {criteria, items, history[], final_matrix}.
Each step re-solves the scope's member<->member vote graph through the
reducer's own kernel (GroupState::apply_vote -> rank_partition) — one
honest solve per event, never scores mixed from different solves.
- Vote dedupe takes each vote once from the smaller endpoint's
item_votes list; repeated same-pair votes still add. Matrix weights
are pairwise win shares with quoted reasoning.
- Capped at 240 events / 64 members. Room-scoped and external scope
pages get the same view via the render_scope_view branch.
agents.md updated. Rust: 412/412. Kaocha: 24 tests, 631 assertions, 0 failures.diff preview
diff --git a/agents.md b/agents.md
index 188a63c9383d84b6f2ed188d7bbf40f31afe2794..4f42d4bd48d8aa0728ea692c2420f2af5b6e81d9 100644
--- a/agents.md
+++ b/agents.md
@@ -76,6 +76,8 @@ Strict **CSP** that blocks `eval` would break the current app. Other projects ma
- **Aspect sub-scopes:** A `:slug` / `:slug {prompt}` / bare `:` statement is parse-derived from ingest text (no event-schema change, no new write path). Votes under an aspect go to a ranking group keyed `(scope_item, aspect)` where `scope_item` is a shared active-membership scope of both vote items; the canonical `ranking_group` and `rank_position_cache` stay aspect-free. Garden parent/item pages (`render_scope_view`, public `~/`) and the `/try` editor preview list aspect sections **below** the canonical ranking when that scope has aspect votes (heading `:{slug}`, optional prompt). No `?aspect=` routes or default-aspect redirects. CLI `garden children --aspect` / `garden rank --aspect` and MCP `get_rank.aspect` are opt-in reads via `GetGardenRank.aspect`. Prompts live on `ContentState.aspect_prompts` per `(room scope, slug)`. `parent_path` in those reads resolves to its leaf item (`~/x/luke` → `~luke`).
+- **Garden score-history replay (`?v=history`):** Scope pages carry an always-visible `ont-history-link` bar above the ranked children table (`score_history_link_panel` in `server/src/html/garden/replay.rs`): with sufficient history (≥2 members and ≥2 member↔member vote events) it links **"open the replay →"**; otherwise an empty state ("score history draws itself once two or more members carry votes") plus a vote-on-children link when ≥2 children exist. Childless leaf pages render no bar. The replay is a **query-param view of the scope page** (branched in `render_scope_view`): `?v=history` serves a one-HTML-file React app — the sorter-proof "Ranking Replay 2" stack verbatim (CDN React 18 UMD + babel-standalone + Chart.js + React Query, inline JSX; autoplay/scrub/speed controls, hue-rotated `tension: 0.4` lines, current-rankings + unsorted legend, clickable comparison matrix with reasoning dialog, 5s polling) bound to a fixed data URL via `window.SLUG_REPLAY` — and `?v=history.json` serves the payload `{criteria, items, history[], final_matrix}` built from `ContentState`: per-event snapshots **re-solve the scope's member↔member vote graph through the reducer's own kernel** (`GroupState::apply_vote` + `rank_partition`), one honest solve per vote event (cap 240 events / 64 members); comparisons and matrix cells quote vote reasonings from `item_votes` (matrix `weight` = pairwise win share in percent). Bar CSS lives in the `Garden score-history replay link` block of every theme.
+
- **Garden page flow and edge anchors:** `~/` item pages read top → bottom as **parents (↑ `member of` card) → body → children (↓ ranked table)**. A blue **flow gradient** on the left edge descends parents (full blue) → hero (mid) → children (grey) — see the `GARDEN HIERARCHY` block in each of `theme_default.css`, `theme_retro_craft.css`, and `theme_retro.css`; garden hierarchy CSS (including the structural flex that keeps per-edge vote/§ links off parent titles) must exist in every theme that styles ontology pages. Every containment edge has a fragment URL: `#edge-<child>-in-<parent>` on the child's page (each parent row links its scope vote pool as the vote home, plus a `§` permalink), and `#item-<child>` on ranked/unranked rows of the parent scope page (`aspect-<slug>-` prefixed in aspect tables). Weight footnotes show totals only (`containment N · border M`); path sugar is not distinguished in the UI.
- **Browser auth redirects:** `/login`, `/join/:token`, `/auth/login`, and `/auth/choose-username` may carry **`next`** (or legacy **`redirect`**) as a **safe local path only**. The value is stored on the RAM-only pending session and applied after OAuth / username selection.
diff --git a/server/src/html/garden/mod.rs b/server/src/html/garden/mod.rs
index 3dd3b7730834f26bce1caf156ff74a4e35cffbf6..49408de6adcfc2aefc9337b41d2eecb5d75e7d83 100644
--- a/server/src/html/garden/mod.rs
+++ b/server/src/html/garden/mod.rs
@@ -8,6 +8,7 @@ mod item;
mod item_page;
mod pin;
mod render;
+mod replay;
mod routes;
mod vote;
diff --git a/server/src/html/garden/render.rs b/server/src/html/garden/render.rs
index 2260efcac3a5efc6b971b586e449300ecb5c7a4d..83e46cf83da440fa1816bd0736a6db846eb7150c 100644
--- a/server/src/html/garden/render.rs
+++ b/server/src/html/garden/render.rs
@@ -30,6 +30,10 @@ use super::{
build_item_page_view_model, fragment_slug, item_relations_markup, AspectRankingView,
},
pin::{child_row_pin_or_vote, ont_pin_vote_controls, pinned_item_from_jar},
+ replay::{
+ replay_history_json_response, replay_mode_from_uri, replay_page_response,
+ score_history_link_panel, ReplayMode,
+ },
vote::vote_pool_href,
};
@@ -132,6 +136,15 @@ pub(super) async fn render_scope_view(
let child_depth = child_depth_from_uri(&uri);
let model = build_item_page_view_model(&reduced, &scope, browse.item(), child_depth);
let scope_content = content_for_garden_view(&reduced, &scope);
+ // The replay is a query-param view of the scope page itself: `?v=history`
+ // serves the one-file React app, `?v=history.json` its data payload.
+ match replay_mode_from_uri(&uri) {
+ Some(ReplayMode::Page) => return replay_page_response(&nav, &model.item),
+ Some(ReplayMode::Data) => {
+ return replay_history_json_response(scope_content, &model.child_rankings, &model.item);
+ }
+ None => {}
+ }
let thread_href = |tag: &str| nav.thread_url(tag);
let external_empty_body = browse.is_external() && model.body.is_none();
let cli_path_arg = item_display_path(&model.item);
@@ -329,6 +342,19 @@ pub(super) async fn render_scope_view(
@if model.child_rankings.component_rankings.is_empty() {
p class="muted" { "no voted pairs yet in this scope" }
}
+ @if let Some(panel) = score_history_link_panel(
+ scope_content,
+ &model.child_rankings,
+ &nav,
+ &model.item,
+ if total_children >= 2 {
+ Some(vote_pool_href(&nav, &model.item))
+ } else {
+ None
+ },
+ ) {
+ (panel)
+ }
(ont_ranking_lists_markup(
&model.child_rankings,
&nav,
diff --git a/server/src/html/garden/replay.rs b/server/src/html/garden/replay.rs
new file mode 100644
index 0000000000000000000000000000000000000000..826cee280f381506805122c01af1aa648bc193f4
--- /dev/null
+++ b/server/src/html/garden/replay.rs
@@ -0,0 +1,956 @@
+//! Score-history replay: the sorter-proof "Ranking Replay 2" experience —
+//! one-HTML-file React app (CDN React 18 + babel-standalone + Chart.js +
+//! React Query, inline JSX) served as a query-param view of any scope page.
+//!
+//! - `GET /~/<scope>?v=history` → the replay app (its own full page)
+//! - `GET /~/<scope>?v=history.json` → the sorter-proof-shaped data payload
+//! `{criteria, items, history[], final_matrix}` built from `ContentState`:
+//! per-event snapshots **re-solve the scope's member↔member vote graph**
+//! through the reducer's own kernel (`GroupState::apply_vote` →
+//! `rank_partition`), one honest solve per vote event — never scores mixed
+//! from different solves the way per-item rank-history carry-forward would
+//! mix them. Comparisons and matrix cells quote vote reasonings from
+//! `item_votes`.
+//!
+//! The flat scope page links here via [`score_history_link_panel`], which is
+//! always visible on scopes with members (empty state until history suffices).
+
+use std::collections::{BTreeMap, HashMap, HashSet};
+
+use axum::http::Uri;
+use axum::response::{Html, IntoResponse};
+use maud::{html, Markup};
+use serde::Serialize;
+
+use crate::html::ThreadNav;
+use crate::path_types::ItemId;
+use crate::reducer::{ContentState, VoteData};
+use crate::scope_rank::ChildrenRankings;
+
+use super::item::{item_display_path, item_href};
+
+/// Most vote events replayed (recent window when history is longer).
+const MAX_EVENTS: usize = 240;
+/// Most members in the replay (chart datasets and matrix rows alike).
+const MAX_MEMBERS: usize = 64;
+
+/// Which replay response a `?v=` query selects.
+#[derive(Debug, Clone, Copy, PartialEq, Eq)]
+pub(super) enum ReplayMode {
+ /// `?v=history` — the app page.
+ Page,
+ /// `?v=history.json` — the data payload the app polls.
+ Data,
+}
+
+pub(super) fn replay_mode_from_uri(uri: &Uri) -> Option<ReplayMode> {
+ uri.query()
+ .into_iter()
+ .flat_map(|q| q.split('&'))
+ .find_map(|pair| pair.strip_prefix("v="))
+ .and_then(|v| match v {
+ "history" => Some(ReplayMode::Page),
+ "history.json" => Some(ReplayMode::Data),
+ _ => None,
+ })
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub(super) struct ReplayRanked {
+ item: String,
+ score: f64,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub(super) struct ReplayComparison {
+ left: String,
+ right: String,
+ score: f64,
+ explanation: String,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub(super) struct ReplayStep {
+ timestamp: i64,
+ comparison: ReplayComparison,
+ current_rankings: Vec<ReplayRanked>,
+ unsorted_items: Vec<String>,
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub(super) struct MatrixDetails {
+ score: f64,
+ explanation: String,
+}
+
+#[derive(Debug, Clone, Serialize, Default)]
+pub(super) struct MatrixCell {
+ #[serde(skip_serializing_if = "is_zero_weight")]
+ weight: f64,
+ #[serde(skip_serializing_if = "Option::is_none")]
+ details: Option<MatrixDetails>,
+}
+
+fn is_zero_weight(w: &f64) -> bool {
+ *w == 0.0
+}
+
+#[derive(Debug, Clone, Serialize)]
+pub(super) struct ReplayData {
+ criteria: String,
+ items: Vec<String>,
+ history: Vec<ReplayStep>,
+ final_matrix: Vec<Vec<MatrixCell>>,
+ /// Members omitted from the replay (over [`MAX_MEMBERS`]).
+ truncated_members: usize,
+ /// False when there is not enough history to chart (panel shows the
+ /// empty state instead of the replay link).
+ #[serde(skip_serializing)]
+ sufficient: bool,
+}
+
+/// `Forward: a / ---- / b / REASONING: body` — the sorter-proof explanation card.
+fn format_vote_explanation(content_label: &impl Fn(&ItemId) -> String, v: &VoteData) -> String {
+ format!(
+ "Forward: {}\n---------\n{}\n\nREASONING:\n{}",
+ content_label(&v.a),
+ content_label(&v.b),
+ if v.body.trim().is_empty() {
+ "(no reasoning recorded)"
+ } else {
+ v.body.trim()
+ }
+ )
+}
+
+/// Signed log-ratio scaled like the prototype's comparison scores
+/// (3:1 → +11.0, 3:2 → +4.1, 1:2 → −6.9, 1:1 → 0.0).
+fn vote_score(ratio_left: i32, ratio_right: i32) -> f64 {
+ let l = (ratio_left.max(1)) as f64;
+ let r = (ratio_right.max(1)) as f64;
+ let v = (l / r).ln() * 10.0;
+ (v * 10.0).round() / 10.0
+}
+
+/// Build the replay payload for one scope, or `None` when the scope has no
+/// members at all (childless leaf pages get neither panel nor replay).
+pub(super) fn build_replay(
+ content: &ContentState,
+ rankings: &ChildrenRankings,
+ scope_item: &str,
+) -> Option<ReplayData> {
+ // Members in display order: ranked across components, then unranked.
+ let mut members: Vec<ItemId> = rankings
+ .component_rankings
+ .iter()
+ .flat_map(|c| c.ranked.iter().map(|r| r.item.ontology_leaf()))
+ .collect();
+ members.extend(rankings.unranked_items.iter().map(|i| i.ontology_leaf()));
+ let mut seen = HashSet::new();
+ members.retain(|m| seen.insert(m.clone()));
… preview truncated; 43,000 characters omittedHardlinks — judgments / attempts / prompt
judgments
(none)
attempts
- ~anthropic/claude-sonnet-latest #1
- ~x-ai/grok-latest #1
- openai/gpt-chat-latest #1
- ~x-ai/grok-latest #2
- ~anthropic/claude-sonnet-latest #2
- openai/gpt-chat-latest #2
Prompt text is loaded only by the download route.