B removes genuinely dead/redundant code with a clear rationale and updates the corresponding test to match the new (correct) behavior, improving code clarity and correctness confidence. A is a UI simplification that removes labels/toggle behavior and changes placeholder text, which is a stylistic tweak with less lasting substantive value and risks losing the collapsible-form UX without clear justification.
constitution · epochs · watch · epoch 3
c_19f4b8f10b98 (tommy-mor) vs c_cf0a514b261a (tommy-mor)
download prompt · raw event · cmp_8d2996b6ad6db9
council reasoning
B removes proven dead code from the core reducer and updates tests to match the real invariant (zeros rejected upstream; zero-weight edges skipped), which is a lasting clarity/correctness win. A only trims UI chrome and tweaks placeholders/copy on the new-thread form—cosmetic churn with little durable design impact.
Side B removes a redundant guard in the reducer based on documented upstream validation, preserving item and pair registration while relying on existing zero-weight edge handling, and updates tests to verify the intended behavior. Side A mainly simplifies the forum form UI by removing labels/toggle behavior and changing placeholder text/button wording, which is largely cosmetic and potentially reduces usability rather than adding durable functionality.
sides
A — c_19f4b8f10b98 (tommy-mor)
message
[b5e9bc03] cleaner
diff preview
diff --git a/server/src/html/forum.rs b/server/src/html/forum.rs
index a173e7aea7a81c7cfab5f2f6a5549e0db560fb2b..670f5209c1e172b75156ef1b88ea382c70242062 100644
--- a/server/src/html/forum.rs
+++ b/server/src/html/forum.rs
@@ -465,41 +465,23 @@ fn new_thread_form_public(show: bool) -> Markup {
return html! {};
}
html! {
- button
- type="button"
- class="form-toggle"
- data-toggle-target="#public-new-thread-compose"
- data-open-label="new public thread"
- data-close-label="hide new public thread"
- aria-expanded="false"
- {
- "new public thread"
- }
- section class="compose" id="public-new-thread-compose" hidden {
- h3 { "new public thread" }
- p class="muted" { "Set thread tag and body. Example: start with a title line or use the CLI-shaped DSL." }
+ section class="compose" id="public-new-thread-compose" {
div id="public-new-thread-errors" {}
form id="public-new-thread-form" method="POST" action="/ui" data-check-action="/ui" data-check-rpc=(template_json_compact(&json!({
"action": "check_ingest",
"room": "public",
"thread_tag": {"$form": "thread_tag"},
"text": {"$form": "text"},
- "error_target": "public-new-thread-errors",
- "form_id": "public-new-thread-form",
})).unwrap()) {
input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&json!({
"action": "post_ingest",
"room": "public",
"thread_tag": {"$form": "thread_tag"},
"text": {"$form": "text"},
- "error_target": "public-new-thread-errors",
- "form_id": "public-new-thread-form",
})).unwrap());
- label for="new-thread-tag" { "thread tag" }
- input type="text" id="new-thread-tag" name="thread_tag" pattern="[a-z0-9_\\-]{1,64}" placeholder="my-topic";
- label for="new-thread-text" { "text" }
- textarea id="new-thread-text" name="text" rows="4" placeholder="#my-topic\n\nYour first post…" {}
- p { button type="submit" { "create / post" } }
+ input type="text" id="new-thread-tag" name="thread_tag" pattern="[a-z0-9_\\-]{1,64}" placeholder="thread-title-slug-here";
+ textarea id="new-thread-text" name="text" rows="4" placeholder="Hello threadgoers!! Behold my new thread!" {}
+ p { button type="submit" { "create thread / make first post" } }
}
}
}
B — c_cf0a514b261a (tommy-mor)
message
[047b82bd] Remove redundant zero-ratio guard from reducer. Zeros are already rejected at the DSL parser and browser handler; the guard in apply_vote was dead code. The negative clamping stays since add_edge_weight already skips weight-0 edges correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
diff preview
diff --git a/server/src/reducer.rs b/server/src/reducer.rs
index 0e36979abe0f051493038ff7e652efc7f7a0ac80..efbf7f67ff24c7a2989102fe62879b2794a27c5f 100644
--- a/server/src/reducer.rs
+++ b/server/src/reducer.rs
@@ -112,11 +112,6 @@ impl GroupState {
if vote.ratio_right < 0 {
vote.ratio_right = 0;
}
- if vote.ratio_left == 0 || vote.ratio_right == 0 {
- // Zero on either side produces no valid edge; drop before registering items or pair.
- return;
- }
-
let a_idx = self.ensure_item(&vote.a);
let b_idx = self.ensure_item(&vote.b);
diff --git a/server/tests/basic.rs b/server/tests/basic.rs
index 08159f4a7f0850fd165817a4a1af4f31ced2ad76..1748769ccf7196b2d81cf556d5368c7e723f6a4e 100644
--- a/server/tests/basic.rs
+++ b/server/tests/basic.rs
@@ -533,7 +533,7 @@ fn dsl_parse_rejects_zero_zero_vote_ratio() {
#[test]
fn reducer_negative_ratio_clamped_to_zero() {
let _state = ReducerState::default();
- // GroupState::apply_vote clamps negatives to 0; when either side is 0 the vote is dropped.
+ // apply_vote clamps negatives to 0; add_edge_weight skips zero-weight edges.
let mut group = GroupState::new();
group.apply_vote(slugsocial_server::reducer::VoteData {
ts: 1,
@@ -546,10 +546,9 @@ fn reducer_negative_ratio_clamped_to_zero() {
delegate: Some("00000000-0000-0000-0000-000000000000:test:local/test".to_string()),
thread_tag: "t".to_string(),
});
- // Nothing registered: zero-clamped vote is dropped before ensure_item.
- assert!(group.idx_to_item.is_empty());
+ // Items and pair are registered; edges are absent because weight 0 is skipped.
+ assert_eq!(group.idx_to_item.len(), 2);
assert!(group.edges.is_empty());
- assert!(group.voted_pairs.is_empty());
}
Hardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.