Side B removes a fragile, incrementally-maintained cache (add/subtract/rollback edge-weight bookkeeping in GroupState) and replaces it with a single source of truth (uuid_votes) from which edges, components, and rankings are derived on demand—eliminating a whole class of state-drift/rollback bugs and simplifying the core ranking model with equivalent test coverage. Side A adds a legitimate new feature (Reddit OAuth linking) with sensible identity/privacy design, but it mostly extends existing patterns (mirroring GitHub OAuth) and adds a large amount of mock/test-harness boilerplate rather than fixing a structural weakness in the core system.
constitution · epochs · watch · epoch 3
c_afa638171cf7 (tommy-mor) vs c_ef71be9831cc (tommy-mor)
download prompt · raw event · cmp_91ce74d15145af
council reasoning
A ships lasting identity architecture: UUID-only principals, multi-provider OAuth link/conflict semantics (including Reddit end-to-end), private linked-provider UX, trust-weight stacking, and a real batch pending_weights fix. B is valuable core cleanup—dropping GroupState’s cached edges/idxs/rollback for on-demand ScopeVotes derivation—but it mostly realigns in-memory state with an already-deduped uuid_votes source of truth rather than adding comparable product capability.
Side B performs a substantial architectural simplification by replacing cached `GroupState` edge/index state with `ScopeVotes`, deriving edges, item indices, connected components, and rankings from persisted `uuid_votes` on demand. This removes duplicated mutable state across the reducer, storage, ranking, and UI layers while preserving behavior through broad test updates, whereas Side A mainly extends OAuth with Reddit support and UUID-linked identities, adding valuable features but with a narrower long-term impact.
sides
A — c_afa638171cf7 (tommy-mor)
message
[52f5c51c] Add Reddit OAuth linking and make UUID the only account identity. OAuth providers only attach to a session UUID (first link creates the principal); linked providers stay private on the account page. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/AGENTS.md b/AGENTS.md
index 6e0fd8ebb65d665c9c1438e3275971d62b98fd95..e9cc3173dbeb21ad0fc090ca7b407b027c7820a9 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -35,8 +35,11 @@ Environment variables (defaults in `server/src/state.rs`):
- `SORTER2_DATA_DIR` — default `./data` (created on startup)
- `SORTER2_EVENT_LOG` — default `{data_dir}/events.jsonl`
- `SORTER2_BASE_URL` — public origin (also drives Secure cookies when `https://`)
-- `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` — GitHub OAuth (optional; login disabled if unset)
-- `SORTER2_ALLOW_MOCK_OAUTH=1` — allow `mock_user` on `/auth/github` (tests only)
+- `GITHUB_CLIENT_ID` / `GITHUB_CLIENT_SECRET` — GitHub OAuth linking (optional)
+- `REDDIT_CLIENT_ID` / `REDDIT_CLIENT_SECRET` (or `REDDIT_APP_*`) — Reddit API import + OAuth linking (optional)
+- `SORTER2_ALLOW_MOCK_OAUTH=1` — allow `mock_user` on `/auth/github` and `/auth/reddit` (tests only)
+
+Identity: UUID is canonical. OAuth providers only *link* to a UUID (first link creates the principal). Linked providers are private to the account owner.
Health check: `GET /healthz` → `ok`.
diff --git a/server/src/auth/mod.rs b/server/src/auth/mod.rs
index 5906f93b13853421e96a3c37bc9d8202a47842bf..c706ae8045a811e5941f5f6c72da88f42a403a82 100644
--- a/server/src/auth/mod.rs
+++ b/server/src/auth/mod.rs
@@ -1,4 +1,8 @@
-//! GitHub OAuth login, session cookies, and vote actor resolution.
+//! OAuth linking, session cookies, and vote actor resolution.
+//!
+//! Canonical identity is a UUID. OAuth providers only *link* to that UUID
+//! (first link creates the principal; later links attach while logged in).
+//! Which providers are linked is private to the account owner.
pub mod config;
pub mod identity;
@@ -22,7 +26,9 @@ use crate::{
form_template::template_json_compact,
html::layout,
state::AppState,
- storage_schema::{oauth_link_owner, pseudonym_owner, Store, StoreFields},
+ storage_schema::{
+ linked_providers_for_uuid, oauth_link_owner, pseudonym_owner, Store, StoreFields,
+ },
ui_action::UI_RPC_FIELD,
};
@@ -53,10 +59,12 @@ fn new_actor_uuid() -> String {
pub struct LoginQuery {
#[serde(default)]
pub return_to: Option<String>,
+ #[serde(default)]
+ pub error: Option<String>,
}
#[derive(Debug, Deserialize)]
-pub struct GitHubStartQuery {
+pub struct OAuthStartQuery {
#[serde(default)]
pub return_to: Option<String>,
#[serde(default)]
@@ -72,15 +80,22 @@ fn return_from_query_or_jar(jar: &CookieJar, query: Option<&str>) -> String {
.unwrap_or_else(|| "/".to_string())
}
-fn oauth_providers(base_url: &str, return_to: &str) -> Vec<(&'static str, String)> {
+/// Available OAuth link targets: `(provider_key, label, start_href)`.
+fn oauth_providers(base_url: &str, return_to: &str) -> Vec<(&'static str, &'static str, String)> {
let mut out = Vec::new();
+ let enc = urlencoding::encode(return_to);
if oauth::GitHubConfig::from_env(base_url).is_some() {
out.push((
- "GitHub",
- format!(
- "/auth/github?return_to={}",
- urlencoding::encode(return_to)
- ),
+ "github",
+ oauth::provider_label("github"),
+ format!("/auth/github?return_to={enc}"),
+ ));
+ }
+ if oauth::RedditConfig::from_env(base_url).is_some() {
+ out.push((
+ "reddit",
+ oauth::provider_label("reddit"),
+ format!("/auth/reddit?return_to={enc}"),
));
}
out
@@ -125,23 +140,41 @@ fn alias_claim_forms(return_to: &str, submit_label: &str) -> Result<Markup, Stat
})
}
-fn signed_out_body(providers: &[(&str, String)]) -> Markup {
+fn login_error_message(code: Option<&str>) -> Option<&'static str> {
+ match code {
+ Some("oauth_taken") => {
+ Some("that OAuth account is already linked to a different sorter2 account")
+ }
+ Some("oauth_failed") => Some("OAuth failed — try again"),
+ _ => None,
+ }
+}
+
+fn signed_out_body(
+ providers: &[(&str, &str, String)],
+ error: Option<&str>,
+) -> Markup {
html! {
main class="panel login-page" {
section class="login-section" {
h1 { "sign in" }
- p class="muted" { "link an account to vote under a lasting alias" }
+ p class="muted" {
+ "link an OAuth account to create your identity, then claim an alias to vote"
+ }
+ @if let Some(msg) = login_error_message(error) {
+ p class="alias-bad" data-testid="login-error" { (msg) }
+ }
@if providers.is_empty() {
p class="muted" {
- "OAuth is not configured. Set GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET."
+ "OAuth is not configured. Set GitHub and/or Reddit client credentials."
}
} @else {
ul class="oauth-provider-list" {
- @for (name, href) in providers {
+ @for (key, label, href) in providers {
li {
a href=(href) class="btn-primary oauth-provider"
- data-testid=(format!("oauth-{}", name.to_lowercase())) {
- (format!("Continue with {name}"))
+ data-testid=(format!("oauth-{key}")) {
+ (format!("Link {label}"))
}
}
}
@@ -156,7 +189,10 @@ fn signed_out_body(providers: &[(&str, String)]) -> Markup {
fn account_body(
actor: &session::SessionActor,
aliases: &[String],
- providers: &[(&str, String)],
+ // Provider keys already linked to this UUID (private).
+ linked: &[String],
+ // Providers available to link: not yet attached.
+ unlinkable: &[(&str, &str, String)],
claim_forms: Markup,
) -> Markup {
let current = actor.pseudonym.trim();
@@ -212,16 +248,29 @@ fn account_body(
(claim_forms)
}
- @if !providers.is_empty() {
- section class="login-section" {
- h2 { "linked sign-in" }
- p class="muted small" { "sign in again with the same provider to return to this account" }
+ section class="login-section" {
+ h2 { "linked sign-in" }
+ p class="muted small" {
+ "private to you — linking more providers raises trust weight without publishing which accounts you use"
+ }
+ @if linked.is_empty() {
+ p class="muted" data-testid="linked-providers-empty" { "none yet" }
+ } @else {
+ ul class="linked-provider-list" data-testid="linked-providers" {
+ @for key in linked {
+ li data-testid=(format!("linked-{key}")) {
+ (oauth::provider_label(key))
+ }
+ }
+ }
+ }
+ @if !unlinkable.is_empty() {
ul class="oauth-provider-list" {
- @for (name, href) in providers {
+ @for (key, label, href) in unlinkable {
li {
a href=(href) class="btn-secondary oauth-provider"
- data-testid=(format!("oauth-relink-{}", name.to_lowercase())) {
- (format!("Re-link {name}"))
+ data-testid=(format!("oauth-link-{key}")) {
+ (format!("Link {label}"))
}
}
}
@@ -243,12 +292,21 @@ fn account_body(
fn login_body(
session: Option<&session::SessionActor>,
aliases: &[String],
- providers: &[(&str, String)],
+ linked: &[String],
+ providers: &[(&str, &str, String)],
claim_forms: Option<Markup>,
+ error: Option<&str>,
) -> Markup {
match (session, claim_forms) {
- (Some(actor), Some(forms)) => account_body(actor, aliases, providers, forms),
- _ => signed_out_body(providers),
+ (Some(actor), Some(forms)) => {
+ let unlinkable: Vec<_> = providers
+ .iter()
+ .filter(|(key, _, _)| !linked.iter().any(|p| p == key))
+ .cloned()
+ .collect();
+ account_body(actor, aliases, linked, &unlinkable, forms)
+ }
+ _ => signed_out_body(providers, error),
}
}
@@ -268,6 +326,10 @@ pub async fn login_page(
.as_ref()
.map(|s| alias_list(db, &s.uuid))
.unwrap_or_default();
+ let linked = session
+ .as_ref()
+ .map(|s| linked_providers_for_uuid(db, &s.uuid).unwrap_or_default())
+ .unwrap_or_default();
let providers = oauth_providers(&base_url_from_env(state.cfg.port), &return_to);
let claim_forms = if session.is_some() {
@@ -282,7 +344,14 @@ pub async fn login_page(
} else {
"login · sorter2"
},
- login_body(session.as_ref(), &aliases, &providers, claim_forms),
+ login_body(
+ session.as_ref(),
+ &aliases,
+ &linked,
+ &providers,
+ claim_forms,
+ query.error.as_deref(),
+ ),
state.views.get_views("/login"),
session
.as_ref()
@@ -302,7 +371,6 @@ pub async fn alias_page(
let db = state.projection_store.db();
let session = session::load_valid_session(db, &session_id).ok_or(StatusCode::UNAUTHORIZED)?;
if session::session_has_pseudonym(&session) {
- // Already onboarded — manage aliases on the account page.
return Ok(Redirect::to("/login").into_response());
}
@@ -331,7 +399,7 @@ pub async fn alias_page(
pub async fn github_start(
State(state): State<AppState>,
jar: CookieJar,
- Query(query): Query<GitHubStartQuery>,
+ Query(query): Query<OAuthStartQuery>,
) -> Result<Response, StatusCode> {
let cfg = oauth::GitHubConfig::from_env(&base_url_from_env(state.cfg.port))
.ok_or(StatusCode::SERVICE_UNAVAILABLE)?;
@@ -342,7 +410,28 @@ pub async fn github_start(
} else {
None
};
- let url = oauth::authorize_url(&cfg, &state_token, mock_user);
+ let url = oauth::github_authorize_url(&cfg, &state_token, mock_user);
+ let jar = jar
+ .add(session::oauth_state_cookie_value(&state_token))
+ .add(session::auth_return_cookie_value(&return_to));
+ Ok((jar, Redirect::temporary(&url)).into_response())
+}
+
+pub async fn reddit_start(
+ State(state): State<AppState>,
+ jar: CookieJar,
+ Query(query): Query<OAuthStartQuery>,
+) -> Result<Response, StatusCode> {
+ let cfg = oauth::RedditConfig::from_env(&base_url_from_env(state.cfg.port))
+ .ok_or(StatusCode::SERVICE_UNAVAILABLE)?;
+ let return_to = return_from_query_or_jar(&jar, query.return_to.as_deref());
+ let state_token = session::new_oauth_state();
+ let mock_user = if config::mock_oauth_allowed() {
+ query.mock_user.as_deref()
+ } else {
+ None
+ };
+ let url = oauth::reddit_authorize_url(&cfg, &state_token, mock_user);
let jar = jar
.add(session::oauth_state_cookie_value(&state_token))
.add(session::auth_return_cookie_value(&return_to));
@@ -355,6 +444,13 @@ pub struct OAuthCallbackQuery {
pub state: String,
}
+/// Link `provider:provider_id` to a UUID.
+///
+/// - Logged in + new provider → attach to session UUID
+/// - Logged in + already ours → no-op
+/// - Logged in
… preview truncated; 29,823 characters omittedB — c_ef71be9831cc (tommy-mor)
message
[af73743d] Replace GroupState with ScopeVotes and derive edges at ranking time. Store only uuid_votes and recent_votes per scope; rank centrality and pair logic rebuild edge weights on demand instead of maintaining cached state. Co-authored-by: Cursor <cursoragent@cursor.com>
diff preview
diff --git a/server/src/events.rs b/server/src/events.rs
index 8a166d49b4f26835fbc2b58cb1f4bdbf002763b8..015208311f6c5c23a0e8aab068d002a69c89c4e1 100644
--- a/server/src/events.rs
+++ b/server/src/events.rs
@@ -43,7 +43,7 @@ pub enum ViewEvent {
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum Event {
- /// Pairwise comparison vote (replayed into the parent node's [`crate::reducer::GroupState`] on boot).
+ /// Pairwise comparison vote (replayed into the parent node's [`crate::reducer::ScopeVotes`] on boot).
/// `scope` is the parent [`crate::path_types::ItemId`] string; empty string is the tree root.
VoteRecorded {
ts: i64,
diff --git a/server/src/html/mod.rs b/server/src/html/mod.rs
index 4eff2e19ed4d303ff8e80c1eabd8a15b4990e643..1e2e7a06856d8a62378741aaf5ed94a4ffed337e 100644
--- a/server/src/html/mod.rs
+++ b/server/src/html/mod.rs
@@ -13,7 +13,7 @@ use crate::{
form_template::template_json_compact,
path_types::ItemId,
ranking::{
- connected_components_from_voted_pairs, ranked_items_subset, RankedItem, MAX_ITERS, TOL,
+ ranked_items_subset, scope_components, RankedItem, MAX_ITERS, TOL,
},
reducer::{GlobalTree, NodeState},
state::AppState,
@@ -397,10 +397,9 @@ pub fn ranking_panel_with_highlights(
tree: &GlobalTree,
highlighted: &HashSet<ItemId>,
) -> Markup {
- let group = &node.local_ranking;
- let n = group.idx_to_item.len();
- let (comps, _isolates) =
- connected_components_from_voted_pairs(n, group.voted_pairs.iter().copied());
+ let scope = &node.votes;
+ let (comps, _isolates, _) =
+ scope_components(scope);
// Each connected component of voted items is its own ranking; isolated and
// never-voted children fall into the "unranked" bucket below.
@@ -410,7 +409,7 @@ pub fn ranking_panel_with_highlights(
if comp.len() < 2 {
continue;
}
- let ranked = ranked_items_subset(group, comp, MAX_ITERS, TOL);
+ let ranked = ranked_items_subset(scope, comp, MAX_ITERS, TOL);
for r in &ranked {
ranked_ids.insert(r.item.clone());
}
diff --git a/server/src/html/vote.rs b/server/src/html/vote.rs
index bf82aef3ad9c5f4e9e877c47dab27beb29a80b8f..3aa00c417c89a9cab3417c650b50ed7c73f08e20 100644
--- a/server/src/html/vote.rs
+++ b/server/src/html/vote.rs
@@ -14,7 +14,7 @@ use crate::{
html::{ranking_panel_with_highlights, scope_theme_style, JsBuilder},
pair::{children_of, resolve_pair, suggest_next_pair_in_pool},
path_types::ItemId,
- reducer::{GlobalTree, GroupState, NodeState, VoteData},
+ reducer::{GlobalTree, NodeState, ScopeVotes, VoteData},
state::{parse_item_param, AppState},
ui_action::UI_RPC_FIELD,
};
@@ -68,8 +68,8 @@ fn ratios_for_page(v: &VoteData, page_left: &ItemId, page_right: &ItemId) -> (i3
}
}
-fn edge_votes(group: &GroupState, left: &ItemId, right: &ItemId) -> Vec<VoteData> {
- group
+fn edge_votes(scope: &ScopeVotes, left: &ItemId, right: &ItemId) -> Vec<VoteData> {
+ scope
.recent_votes
.iter()
.filter(|v| {
@@ -113,11 +113,11 @@ fn slider_value_from_ratios(r_left: i32, r_right: i32) -> i32 {
fn vote_edge_history(
tree: &GlobalTree,
- group: &GroupState,
+ scope: &ScopeVotes,
left: &ItemId,
right: &ItemId,
) -> Markup {
- let mut votes = edge_votes(group, left, right);
+ let mut votes = edge_votes(scope, left, right);
votes.sort_by(|a, b| b.ts.cmp(&a.ts));
let legend_left = child_title(tree, left);
let legend_right = child_title(tree, right);
@@ -228,9 +228,9 @@ pub(crate) fn vote_recorded_morph(
) -> JsBuilder {
let pool = children_of(tree, parent);
let empty = NodeState::default();
- let group = tree.get(parent).unwrap_or(&empty).local_ranking.clone();
- let edge_history = vote_edge_history(tree, &group, left, right);
- let next_pair = suggest_next(&group, left, right, &pool);
+ let scope = tree.get(parent).unwrap_or(&empty).votes.clone();
+ let edge_history = vote_edge_history(tree, &scope, left, right);
+ let next_pair = suggest_next(&scope, left, right, &pool);
let actions = vote_compare_actions(parent, next_pair.as_ref());
let sidebar = vote_ranking_sidebar(tree, parent, left, right);
JsBuilder::new()
@@ -252,12 +252,12 @@ fn vote_compare_item_card(tree: &GlobalTree, item: &ItemId, side_class: &str) ->
}
fn suggest_next(
- group: &GroupState,
+ scope: &ScopeVotes,
left: &ItemId,
right: &ItemId,
pool: &[ItemId],
) -> Option<(ItemId, ItemId)> {
- suggest_next_pair_in_pool(group, pool, Some((left, right)))
+ suggest_next_pair_in_pool(scope, pool, Some((left, right)))
}
pub async fn vote_page(
@@ -284,9 +284,9 @@ pub async fn vote_page(
};
let pool = children_of(&tree, &parent);
- let group = &parent_node.local_ranking;
- let next_pair = suggest_next(group, &left, &right, &pool);
- let edge_history = vote_edge_history(&tree, group, &left, &right);
+ let scope = &parent_node.votes;
+ let next_pair = suggest_next(&scope, &left, &right, &pool);
+ let edge_history = vote_edge_history(&tree, &scope, &left, &right);
let rpc_json = template_json_compact(&serde_json::json!({
"action": "record_vote",
@@ -388,8 +388,8 @@ mod polarity_tests {
let mut tree = GlobalTree::new();
tree.apply_vote(&parent, vote, TEST_ACTOR_UUID);
- let group = &tree.get(&parent).unwrap().local_ranking;
- let ranked = ranked_items(group);
+ let scope = &tree.get(&parent).unwrap().votes;
+ let ranked = ranked_items(scope);
assert_eq!(
ranked[0].item, left,
"left item should rank first when ratio favours the left"
diff --git a/server/src/pair.rs b/server/src/pair.rs
index 42a1b1eb2adf16730d34d0fe23c13d5a75d7ba27..9873295c51526726089875bbfd2f97d7faa91872 100644
--- a/server/src/pair.rs
+++ b/server/src/pair.rs
@@ -11,8 +11,8 @@ use std::collections::{HashMap, HashSet};
use crate::{
path_types::ItemId,
- ranking::{connected_components_from_voted_pairs, ranked_items},
- reducer::{GlobalTree, GroupState},
+ ranking::{pair_is_voted, ranked_items, scope_components},
+ reducer::{GlobalTree, ScopeVotes},
};
fn pairs_match(a: &ItemId, b: &ItemId, x: &ItemId, y: &ItemId) -> bool {
@@ -23,26 +23,15 @@ fn pair_excluded(a: &ItemId, b: &ItemId, exclude: Option<(&ItemId, &ItemId)>) ->
exclude.is_some_and(|(x, y)| pairs_match(a, b, x, y))
}
-fn pair_is_voted(group: &GroupState, a: &ItemId, b: &ItemId) -> bool {
- let Some(&ai) = group.item_to_idx.get(a) else {
- return false;
- };
- let Some(&bi) = group.item_to_idx.get(b) else {
- return false;
- };
- let (i, j) = if ai < bi { (ai, bi) } else { (bi, ai) };
- group.voted_pairs.contains(&(i, j))
-}
struct ComponentLayout {
ids: HashMap<ItemId, usize>,
established: HashSet<usize>,
}
-fn component_layout(group: &GroupState, pool: &[ItemId]) -> ComponentLayout {
- let n = group.idx_to_item.len();
- let (comps, isolates) =
- connected_components_from_voted_pairs(n, group.voted_pairs.iter().copied());
+fn component_layout(scope: &ScopeVotes, pool: &[ItemId]) -> ComponentLayout {
+ let (comps, isolates, idx_to_item) = scope_components(scope);
+ let n = idx_to_item.len();
let mut established = HashSet::new();
let mut ids: HashMap<ItemId, usize> = HashMap::new();
@@ -52,14 +41,14 @@ fn component_layout(group: &GroupState, pool: &[ItemId]) -> ComponentLayout {
}
for &idx in comp {
if idx < n {
- ids.insert(group.idx_to_item[idx].clone(), comp_idx);
+ ids.insert(idx_to_item[idx].clone(), comp_idx);
}
}
}
let mut next = comps.len();
for &idx in &isolates {
if idx < n {
- ids.insert(group.idx_to_item[idx].clone(), next);
+ ids.insert(idx_to_item[idx].clone(), next);
next += 1;
}
}
@@ -121,7 +110,7 @@ fn established_groups_in_pool<'a>(
groups
}
-fn ranked_pool_order(group: &GroupState, pool: &[ItemId]) -> Vec<ItemId> {
+fn ranked_pool_order(group: &ScopeVotes, pool: &[ItemId]) -> Vec<ItemId> {
let pool_set: HashSet<_> = pool.iter().collect();
ranked_items(group)
.into_iter()
@@ -132,7 +121,7 @@ fn ranked_pool_order(group: &GroupState, pool: &[ItemId]) -> Vec<ItemId> {
/// Walk 1↔2, 2↔3, …; optional `require_unvoted` skips voted edges.
fn zip_adjacent_pair(
- group: &GroupState,
+ group: &ScopeVotes,
order: &[ItemId],
exclude: Option<(&ItemId, &ItemId)>,
require_unvoted: bool,
@@ -153,7 +142,7 @@ fn zip_adjacent_pair(
/// Grow the voted graph toward one component (no rank centrality).
fn suggest_grow_pair(
- group: &GroupState,
+ group: &ScopeVotes,
pool: &[ItemId],
layout: &ComponentLayout,
exclude: Option<(&ItemId, &ItemId)>,
@@ -216,7 +205,7 @@ fn suggest_grow_pair(
/// Pick the next pair to vote on within `pool`.
pub fn suggest_next_pair_in_pool(
- group: &GroupState,
+ group: &ScopeVotes,
pool: &[ItemId],
exclude: Option<(&ItemId, &ItemId)>,
) -> Option<(ItemId, ItemId)> {
@@ -315,7 +304,7 @@ pub fn resolve_pair(
(None, None) => {
let group = tree
.get(parent)
- .map(|n| &n.local_ranking)
+ .map(|n| &n.votes)
.cloned()
.unwrap_or_default();
suggest_next_pair_in_pool(&group, &children, None).ok_or(PairError::NoPair)
@@ -398,7 +387,7 @@ mod tests {
"https://reddit.com/r/rust/b",
],
);
- let group = tree.get(&parent).unwrap().local_ranking.clone();
+ let group = tree.get(&parent).unwrap().votes.clone();
let pool = children_of(&tree, &parent);
assert!(!pair_is_voted(&group, &pool[0], &pool[1]));
assert!(suggest_next_pair_in_pool(&group, &pool, None).is_some());
@@ -417,7 +406,7 @@ mod tests {
);
let vote = test_vote(1, "https://reddit.com/r/rust/a", "https://reddit.com/r/rust/b", 2, 1);
apply(&mut tree, &parent, vote);
- let group = tree.get(&parent).unwrap().local_ranking.clone();
+ let group = tree.get(&parent).unwrap().votes.clone();
let pool = children_of(&tree, &parent);
let (l, r) = suggest_next_pair_in_pool(&group, &pool, None).unwrap();
let voted_ab = (l.as_str() == "https://reddit.com/r/rust/a" && r.as_str() == "https://reddit.com/r/rust/b")
@@ -441,7 +430,7 @@ mod tests {
let cd = test_vote(2, "https://reddit.com/r/rust/c", "https://reddit.com/r/rust/d", 2, 1);
apply(&mut tree, &parent, ab);
apply(&mut tree, &parent, cd);
- let group = tree.get(&parent).unwrap().local_ranking.clone();
+ let group = tree.get(&parent).unwrap().votes.clone();
let pool = children_of(&tree, &parent);
let pair = suggest_next_pair_in_pool(&group, &pool, None).unwrap();
let chosen = pair_set(&pair);
@@ -467,7 +456,7 @@ mod tests {
);
let ab = test_vote(1, "https://reddit.com/r/rust/a", "https://reddit.com/r/rust/b", 2, 1);
apply(&mut tree, &parent, ab);
- let group = tree.get(&parent).unwrap().local_ranking.clone();
+ let group = tree.get(&parent).unwrap().votes.clone();
let pool = children_of(&tree, &parent);
let pair = suggest_next_pair_in_pool(&group, &pool, None).unwrap();
let chosen = pair_set(&pair);
@@ -496,7 +485,7 @@ mod tests {
);
let ab = test_vote(1, "https://reddit.com/r/rust/a", "https://reddit.com/r/rust/b", 2, 1);
apply(&mut tree, &parent, ab);
- let group = tree.get(&parent).unwrap().local_ranking.clone();
+
… preview truncated; 38,568 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.