constitution · epochs · watch · epoch 3

comparison

c_f6d0fed9bf9a (tommy-mor) vs c_59974b9da42a (tommy-mor)

download prompt · raw event · cmp_d4dadcaf9aab97

council reasoning

~anthropic/claude-sonnet-latest · winner A · 3:2 · permalink

Side A introduces substantial new functionality (rank-centrality ranking engine with regression tests, form-template substitution system, a URL parser/graph engine, and a large vote-comparison UI module) that provides lasting algorithmic and product value. Side B is a pure refactor (splitting forum.rs into submodules plus an unrelated macOS sampling script) that reorganizes existing code without adding new capability, and even reintroduces some inline duplication that the original had factored out.

~x-ai/grok-latest · winner A · 4:1 · permalink

Side A introduces substantial product systems—rank centrality with regression tests, the event reducer/state model, vote-compare UI, form-template/UI actions, and a large URL parser—whereas Side B mostly splits existing forum HTML into submodules and adds a small macOS sample-fixture helper. Even with noise (shell paste in forms.rs/ranking.rs, .tdsl notes), A’s lasting design and behavior far outweigh B’s organizational churn.

openai/gpt-chat-latest · winner A · 5:1 · permalink

Side A introduces substantial new project capabilities: a parser graph with extensive tests, ranking and reducer infrastructure, UI action/form templating, vote handling, browser plumbing, and supporting test scripts. Although it includes some accidental terminal-output noise in files like `forms.rs` and `ranking.rs`, the commit still establishes core functionality, whereas Side B is primarily a code organization refactor that splits forum code into modules and adds a developer profiling script without introducing comparable new behavior.

sides

A — c_f6d0fed9bf9a (tommy-mor)

message

[1d9d8ade] init seed

diff preview

diff --git a/TEST.sh b/TEST.sh
new file mode 100755
index 0000000000000000000000000000000000000000..266b71f29259f5c2cad2617476ebe2ebc9596d39
--- /dev/null
+++ b/TEST.sh
@@ -0,0 +1,4 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cargo test --all
+./scripts/clj-test.sh
diff --git a/bundle.js b/bundle.js
new file mode 100644
index 0000000000000000000000000000000000000000..8d316f9a57cc7c379fe4bd8e42e092c7eac5d265
--- /dev/null
+++ b/bundle.js
@@ -0,0 +1,52 @@
+/**
+ * Slug web UI: only plumbing — fetch/eval/SSE. No product UI logic here.
+ */
+(function () {
+  function evalJs(js) {
+    if (js && String(js).trim()) {
+      eval(js);
+    }
+  }
+
+  // Theme cookie sync (runs before paint; full reload if localStorage disagrees with cookie)
+
+  function initSlugUi() {
+    // POST forms → eval response (except theme + full-navigation forms)
+    document.addEventListener('submit', async function (e) {
+      var f = e.target;
+      if (!f || f.tagName !== 'FORM') return;
+      if ((f.method || 'get').toLowerCase() !== 'post') return;
+      if (f.id === 'slug-theme-form') return;
+      if (f.getAttribute('data-navigate') === 'full') return;
+      e.preventDefault();
+      var resp = await fetch(f.action, {
+        method: 'POST',
+        body: new URLSearchParams(new FormData(f)),
+        headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
+        credentials: 'same-origin',
+      });
+      evalJs(await resp.text());
+    });
+
+    // SSE: server-pushed JS
+    function connectSSE() {
+      var ssePath = window.location.pathname + window.location.search;
+      var es = new EventSource('/sse?path=' + encodeURIComponent(ssePath));
+      es.onmessage = function (e) {
+        evalJs(e.data);
+      };
+      es.onerror = function () {
+        es.close();
+        setTimeout(connectSSE, 3000);
+      };
+    }
+    connectSSE();
+  }
+
+  if (document.readyState === 'loading') {
+    document.addEventListener('DOMContentLoaded', initSlugUi);
+  } else {
+    initSlugUi();
+  }
+})();
+
diff --git a/clj-test.sh b/clj-test.sh
new file mode 100755
index 0000000000000000000000000000000000000000..b62a49b98ed60a65a46807b7ad80fa3142f14952
--- /dev/null
+++ b/clj-test.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cd "$(dirname "$0")/.."
+mkdir -p target
+exec clojure -M:kaocha
diff --git a/forms.rs b/forms.rs
new file mode 100644
index 0000000000000000000000000000000000000000..d509fd889fde3fed2662ce0a39006b7a51ae762a
--- /dev/null
+++ b/forms.rs
@@ -0,0 +1,145 @@
+tommy@Tommys-Laptop:~/programming/slug-star/slug|main ⇒  cat server/src/form_template.rs
+//! Plan2-style JSON templates with `{"$form": "field_name"}` holes, filled from
+//! `application/x-www-form-urlencoded` (or any `String` → `String` map) **before**
+//! deserializing into a typed struct.
+//!
+//! # Wire format
+//!
+//! Templates are **compact JSON** (`serde_json::to_string`): one line, no pretty
+//! printing, strings escaped per JSON rules (`\"`, `\n`, etc.). Embed that string
+//! in HTML attributes or text nodes with normal HTML escaping (e.g. maud), not
+//! bespoke encodings.
+//!
+//! # Power vs flat hidden fields
+//!
+//! A form is always a string→string map. You can fake depth with dotted keys (`a.b.c`),
+//! but one structured blob (`__rpc__` = compact JSON) gives you nested objects,
+//! arrays, and optional fields without inventing a new naming scheme each time.
+//!
+//! # Security
+//!
+//! Substitution runs **before** `serde` into your command type. It does not fix
+//! authorization: if the client can replace the hidden `__rpc__` value, they can
+//! change the command shape unless you validate (signed blob, server-side session
+//! context, or treat the blob as hints only). Same threat model as any hidden field.
+
+use serde::Serialize;
+use serde_json::Value;
+use std::collections::HashMap;
+
+/// Serialize a value to compact JSON for a hidden `__rpc__` (or similar) field.
+pub fn template_json_compact<T: Serialize>(v: &T) -> serde_json::Result<String> {
+    serde_json::to_string(v)
+}
+
+/// Recursively walk the JSON AST and replace `{"$form": "key"}` with the submitted
+/// string for `key` (empty if missing). Other keys are unchanged.
+pub fn substitute_form_vars(val: &mut Value, form_data: &HashMap<String, String>) {
+    match val {
+        Value::Object(map) => {
+            if map.len() == 1 {
+                if let Some(Value::String(field_name)) = map.get("$form") {
+                    let submitted = form_data
+                        .get(field_name.as_str())
+                        .map(|s| s.as_str())
+                        .unwrap_or("");
+                    *val = Value::String(submitted.to_string());
+                    return;
+                }
+            }
+            for v in map.values_mut() {
+                substitute_form_vars(v, form_data);
+            }
+        }
+        Value::Array(arr) => {
+            for v in arr.iter_mut() {
+                substitute_form_vars(v, form_data);
+            }
+        }
+        _ => {}
+    }
+}
+
+/// Parse JSON, apply [`substitute_form_vars`], return the mutated value.
+pub fn fill_template_from_form(
+    template_json: &str,
+    form_data: &HashMap<String, String>,
+) -> Result<Value, serde_json::Error> {
+    let mut v: Value = serde_json::from_str(template_json)?;
+    substitute_form_vars(&mut v, form_data);
+    Ok(v)
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+    use serde::Deserialize;
+
+    #[derive(Debug, Deserialize, PartialEq, Eq)]
+    struct Demo {
+        room: String,
+        thread_tag: String,
+        nested: Nested,
+    }
+
+    #[derive(Debug, Deserialize, PartialEq, Eq)]
+    struct Nested {
+        text: String,
+    }
+
+    #[test]
+    fn holes_become_strings() {
+        let json = r#"{
+            "room": "public",
+            "thread_tag": {"$form": "tag"},
+            "nested": {"text": {"$form": "body"}}
+        }"#;
+        let mut form = HashMap::new();
+        form.insert("tag".into(), "foo".into());
+        form.insert("body".into(), "hello\nworld".into());
+
+        let v = fill_template_from_form(json, &form).unwrap();
+        let d: Demo = serde_json::from_value(v).unwrap();
+        assert_eq!(
+            d,
+            Demo {
+                room: "public".into(),
+                thread_tag: "foo".into(),
+                nested: Nested {
+                    text: "hello\nworld".into(),
+                },
+            }
+        );
+    }
+
+    #[test]
+    fn missing_form_key_is_empty_string() {
+        let json = r#"{"x": {"$form": "nope"}}"#;
+        let mut form = HashMap::new();
+        form.insert("other".into(), "y".into());
+        let v = fill_template_from_form(json, &form).unwrap();
+        assert_eq!(v["x"], "");
+    }
+
+    #[test]
+    fn array_of_holes() {
+        let json = r#"{"items": [{"$form": "a"}, {"$form": "b"}]}"#;
+        let mut form = HashMap::new();
+        form.insert("a".into(), "1".into());
+        form.insert("b".into(), "2".into());
+        let v = fill_template_from_form(json, &form).unwrap();
+        assert_eq!(v["items"], serde_json::json!(["1", "2"]));
+    }
+
+    #[test]
+    fn template_json_compact_escapes_and_single_line() {
+        let s = template_json_compact(&serde_json::json!({
+            "x": "quote\"and\nnewline"
+        }))
+        .unwrap();
+        assert!(!s.contains('\n'));
+        assert!(s.contains("\\\"") || s.contains("\\n"));
+    }
+}
+tommy@Tommys-Laptop:~/programming/slug-star/slug|main ⇒  
+
diff --git a/gameifying.tdsl b/gameifying.tdsl
new file mode 100644
index 0000000000000000000000000000000000000000..93d2a61d94fcba4370c82d9612e6bb0f0318cc15
--- /dev/null
+++ b/gameifying.tdsl
@@ -0,0 +1,2 @@
+consider gating certain views (top all time?) by a 10 day usage streak.. or something like that. 
+or like a path, on homepage(?), that shows day 1: r/amitheasshole, day2: r/aww, day3: gaming, or something like that.  progressive revelation + usage incentive.
diff --git a/pagerank_streaming.tdsl b/pagerank_streaming.tdsl
new file mode 100644
index 0000000000000000000000000000000000000000..0f2231b94936c17610adf653ca26b0faa6f2ac3a
--- /dev/null
+++ b/pagerank_streaming.tdsl
@@ -0,0 +1,11 @@
+eventually i want to have ranking histories.
+like "visionary" and "fraud" waxing and waning in a uplot graph over time for #elon-musk. 
+there are too many query combinations to precomupte the ranking histories 
+(arbitrary user filters, and tag overlap combinations maybe), 
+so we're just going to have to calculate them all on demand. 
+computers are fast, its okay. for each vote, we need to calculate rank centrality again. 
+i was thinking, for n votes we calculate the rank centrality, 
+and get node weights. we then output that data to the client (over websocket, or testable barrier). 
+then we calculate n+1 votes, _but we keep the node weights in memory_ 
+so the rank centrality process converges faster. 
+this also has the side effect of making the ranking stream in satisfyingly as you load the page.
diff --git a/parser.rs b/parser.rs
new file mode 100644
index 0000000000000000000000000000000000000000..2b87b974f8d1dd93bee35681d87668a94e4ef349
--- /dev/null
+++ b/parser.rs
@@ -0,0 +1,1808 @@
+use std::collections::HashMap;
+use std::rc::Rc;
+use std::cell::RefCell;
+use crate::ui::action::UIAction;
+use crate::ui::types::{Suggestion, GuideOption, ScrollingSuggestion};
+
+// --- Core Abstractions ---
+
+/// Unique identifier for nodes in the graph
+type NodeId = &'static str;
+
+/// Pattern matching for edges
+#[derive(Debug, Clone)]
+pub enum EdgePattern {
+    /// Matches exact literal string
+    Literal(&'static str),
+    
+    /// Matches any prefix of a string and suggests the full string
+    /// e.g., PrefixOf("reddit.com") matches "r", "re", "red", "reddit", "reddit.com"
+    PrefixOf(&'static str),
+    
+    /// Captures a variable segment (e.g., subreddit name, username)
+    Variable(&'static str),
+    
+    /// Matches any string (wildcard)
+    Any,
+}
+
+impl EdgePattern {
+    /// Try to match this pattern against input, return (consumed_chars, captured_value)
+    fn matches(&self, input: &str) -> Option<(usize, Option<String>)> {
+        match self {
+            EdgePattern::Literal(lit) => {
+                if input.starts_with(lit) {
+                    Some((lit.len(), None))
+                } else {
+                    None
+                }
+            }
+            EdgePattern::PrefixOf(target) => {
+                // Check if input is a prefix of target
+                if target.starts_with(input) && !input.is_empty() {
+                    // It's a valid prefix
+                    Some((input.len(), None))
+                } else if input.starts_with(target) {
+                    // Full match
+                    Some((target.len(), None))
+                } else {
+                    None
+                }
+            }
+            EdgePattern::Variable(var_name) => {
+                // Consume until next '/' or end of string
+                let end = input.find('/').unwrap_or(input.len());
+                if end > 0 {
+                    let captured = input[..end].to_string();
+                    // Validate based on variable type
+                    if is_valid_variable(var_name, &captured) {
+                        Some((end, Some(captured)))
+                    } else {
+                        None
+                    }
+                } else {
+                    None
+                }
+            }
+            EdgePattern::Any => {
+                // Match everything until next '/' or end
+                let end = input.find('/').unwrap_or(input.len());
+                if end > 0 {
+                    Some((end, Some(input[..end].to_string())))
+                } else {
+                    None
+                }
+            }
+        }
+    }
+    
+    /// G

… preview truncated; 148,978 characters omitted

download full diff A

B — c_59974b9da42a (tommy-mor)

message

[c99adc26] refactor forum into files

diff preview

diff --git a/bb.edn b/bb.edn
index 4680e82d4227057d2eea6041dc5647beb759131d..ce0f6fcd45a67ead3295b90db2a301e9b304f3da 100644
--- a/bb.edn
+++ b/bb.edn
@@ -51,6 +51,11 @@
    :requires ([test.walkthrough-fixture :as walkthrough-fixture])
    :task (walkthrough-fixture/run-fixture)}
 
+  sample-fixture
+  {:doc "macOS: run `sample` on process(es) listening on the fixture TCP port (default 8080). Usage: bb sample-fixture [PORT] [DURATION_SEC] [OUT_DIR]"
+   :requires ([scripts.sample-fixture :as sample-fixture])
+   :task (apply sample-fixture/-main *command-line-args*)}
+
   perf
   {:doc "Performance test: concurrent HTTP requests to detect blocking I/O"
    :requires ([scripts.perf :as perf])
diff --git a/scripts/sample_fixture.bb b/scripts/sample_fixture.bb
new file mode 100644
index 0000000000000000000000000000000000000000..ac2368623c5043ba6e027afef6b5b37d392767b0
--- /dev/null
+++ b/scripts/sample_fixture.bb
@@ -0,0 +1,70 @@
+(ns scripts.sample-fixture
+  "Find process(es) listening on the fixture port (default 8080) and run macOS `sample`."
+  (:require [babashka.fs :as fs]
+            [babashka.process :as p]
+            [clojure.string :as str]))
+
+(defn- usage []
+  (println "Usage: bb sample-fixture [PORT] [DURATION_SEC] [OUT_DIR]")
+  (println "")
+  (println "  Finds PIDs bound to TCP LISTEN on PORT (default 8080), then runs")
+  (println "  `sample` for each PID. OUT_DIR defaults to the current directory.")
+  (println "")
+  (println "  Example:  bb sample-fixture")
+  (println "            bb sample-fixture 8080 10")
+  (println "            bb sample-fixture 8080 5 /tmp")
+  (println "")
+  (println "  Requires macOS (the `sample` tool)."))
+
+(defn- parse-long* [s]
+  (try (Long/parseLong s)
+       (catch NumberFormatException _ nil)))
+
+(defn- listen-pids [port]
+  (let [spec (str "TCP:" port)
+        {:keys [out exit]}
+        @(p/process ["lsof" "-nP" (str "-i" spec) "-sTCP:LISTEN" "-t"]
+                    {:out :string :err :string})]
+    (when (zero? exit)
+      (->> (str/split-lines out)
+           (map str/trim)
+           (remove str/blank?)
+           (distinct)
+           vec))))
+
+(defn- sample-bin []
+  (or (fs/which "sample")
+      (throw (ex-info "macOS `sample` not found on PATH" {}))))
+
+(defn- run-sample! [sample duration-sec pid out-file]
+  (println (str "sampling PID " pid " for " duration-sec "s → " out-file))
+  (let [{:keys [exit err]} @(p/process [sample (str pid) (str duration-sec) "-file" out-file]
+                                      {:out :inherit :err :inherit})]
+    (when-not (zero? exit)
+      (binding [*out* *err*]
+        (println "sample failed:" err))
+      (System/exit exit))))
+
+(defn -main [& args]
+  (when (some #{"-h" "--help" "help"} args)
+    (usage)
+    (System/exit 0))
+  (let [port (or (some-> (first args) parse-long*) 8080)
+        duration-sec (or (some-> (second args) parse-long*) 5)
+        out-dir (or (nth args 2 nil) ".")
+        pids (listen-pids port)]
+    (when (or (nil? pids) (empty? pids))
+      (binding [*out* *err*]
+        (println (str "No process listening on TCP " port " (LISTEN). Is `bb fixture` running?")))
+      (System/exit 1))
+    (when-not (fs/exists? out-dir)
+      (binding [*out* *err*]
+        (println "Output directory does not exist:" out-dir))
+      (System/exit 1))
+    (let [sample (sample-bin)
+          ts (str (System/currentTimeMillis))]
+      (println (str "port " port " → PIDs " (str/join ", " pids)))
+      (doseq [pid pids]
+        (let [out-file (str (fs/path out-dir) "/slug-sample-" port "-" pid "-" ts ".txt")]
+          (run-sample! sample duration-sec pid (str out-file))))
+      (println "done."))))
diff --git a/server/src/html/forum.rs b/server/src/html/forum.rs
index a55fc1f79d03719eb74b216865b2c15199c48ea7..5ad8dfc84dd735d589432e2c613ff687a75f2e61 100644
--- a/server/src/html/forum.rs
+++ b/server/src/html/forum.rs
@@ -380,22 +380,6 @@ fn room_members_inner(members: &[RoomMemberRow]) -> Markup {
     }
 }
 
-pub(crate) fn set_room_members_expanded_rpc(room_wire: &str, expanded: bool) -> String {
-    template_json_compact(&HtmlUiAction::SetRoomMembersExpanded {
-        room_wire: room_wire.to_string(),
-        expanded,
-    })
-    .expect("static json")
-}
-
-pub(crate) fn set_room_new_thread_compose_expanded_rpc(nav: &ThreadNav, expanded: bool) -> String {
-    template_json_compact(&HtmlUiAction::SetRoomNewThreadComposeExpanded {
-        room_wire: nav.room_wire.clone(),
-        expanded,
-    })
-    .expect("static json")
-}
-
 /// Fragment for `#room-members-section` — expand/collapse is server-driven via `POST /ui`.
 pub(crate) fn room_members_section_markup(
     reduced: &ReducerState,
@@ -406,13 +390,14 @@ pub(crate) fn room_members_section_markup(
     if members.is_empty() {
         return html! {};
     }
-    let rpc_open = set_room_members_expanded_rpc(room_id, true);
-    let rpc_close = set_room_members_expanded_rpc(room_id, false);
     html! {
         div id="room-members-section" {
             @if members_expanded {
                 form method="POST" action="/ui" {
-                    input type="hidden" name=(UI_RPC_FIELD) value=(rpc_close);
+                    input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&HtmlUiAction::SetRoomMembersExpanded {
+                        room_wire: room_id.to_string(),
+                        expanded: false,
+                    }).expect("static json"));
                     button type="submit" class="form-toggle" aria-expanded="true" {
                         "hide members & permissions"
                     }
@@ -422,7 +407,10 @@ pub(crate) fn room_members_section_markup(
                 }
             } @else {
                 form method="POST" action="/ui" {
-                    input type="hidden" name=(UI_RPC_FIELD) value=(rpc_open);
+                    input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&HtmlUiAction::SetRoomMembersExpanded {
+                        room_wire: room_id.to_string(),
+                        expanded: true,
+                    }).expect("static json"));
                     button type="submit" class="form-toggle" aria-expanded="false" {
                         "members & permissions"
                     }
@@ -514,28 +502,24 @@ fn compose_form(nav: &ThreadNav, thread_tag: &str, show: bool) -> Markup {
     if !show {
         return html! {};
     }
-    let rpc_post = template_json_compact(&json!({
-        "action": "post_ingest",
-        "room": nav.room_wire,
-        "thread_tag": thread_tag,
-        "text": {"$form": "text"},
-        "error_target": "thread-compose-errors",
-        "form_id": "thread-compose-form",
-    }))
-    .unwrap();
-    let rpc_check = template_json_compact(&json!({
-        "action": "check_ingest",
-        "room": nav.room_wire,
-        "thread_tag": thread_tag,
-        "text": {"$form": "text"},
-        "error_target": "thread-compose-errors",
-        "form_id": "thread-compose-form",
-    }))
-    .unwrap();
     html! {
         section class="compose" id="thread-compose" {
-            form id="thread-compose-form" method="POST" action="/ui" data-check-action="/ui" data-check-rpc=(rpc_check) {
-                input type="hidden" name=(UI_RPC_FIELD) value=(rpc_post);
+            form id="thread-compose-form" method="POST" action="/ui" data-check-action="/ui" data-check-rpc=(template_json_compact(&json!({
+                "action": "check_ingest",
+                "room": nav.room_wire,
+                "thread_tag": thread_tag,
+                "text": {"$form": "text"},
+                "error_target": "thread-compose-errors",
+                "form_id": "thread-compose-form",
+            })).unwrap()) {
+                input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&json!({
+                    "action": "post_ingest",
+                    "room": nav.room_wire,
+                    "thread_tag": thread_tag,
+                    "text": {"$form": "text"},
+                    "error_target": "thread-compose-errors",
+                    "form_id": "thread-compose-form",
+                })).unwrap());
                 textarea name="text" rows="5" cols="80" placeholder="prose or ~/items and votes…" {}
                 p {
                     button type="submit" { "post" }
@@ -712,7 +696,7 @@ pub async fn home(
             p class="muted" { "dark = time-ordered · light = vote-ranked" }
             div class="thread-feed-toolbar" {
                 form method="POST" action="/ui" {
-                    input type="hidden" name=(UI_RPC_FIELD) value=(expand_public_new_thread_rpc_value());
+                    input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&HtmlUiAction::ExpandPublicNewThreadForm).expect("static json"));
                     button type="submit" class="section-add-btn" { "+" }
                 }
             }
@@ -1002,14 +986,15 @@ fn new_thread_form_for_room(nav: &ThreadNav, show: bool, compose_expanded: bool)
     if !show {
         return html! {};
     }
-    let rpc_open = set_room_new_thread_compose_expanded_rpc(nav, true);
-    let rpc_close = set_room_new_thread_compose_expanded_rpc(nav, false);
     // Single root for Idiomorph when morphing `#room-new-thread-ui-slot` (expanded has form + section).
     html! {
         div class="room-new-thread-slot-inner" {
             @if compose_expanded {
                 form method="POST" action="/ui" {
-                    input type="hidden" name=(UI_RPC_FIELD) value=(rpc_close);
+                    input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&HtmlUiAction::SetRoomNewThreadComposeExpanded {
+                        room_wire: nav.room_wire.clone(),
+                        expanded: false,
+                    }).expect("static json"));
                     button type="submit" class="form-toggle" aria-expanded="true" {
                         "-"
                     }
@@ -1039,7 +1024,10 @@ fn new_thread_form_for_room(nav: &ThreadNav, show: bool, compose_expanded: bool)
                 }
             } @else {
                 form method="POST" action="/ui" {
-                    input type="hidden" name=(UI_RPC_FIELD) value=(rpc_open);
+                    input type="hidden" name=(UI_RPC_FIELD) value=(template_json_compact(&HtmlUiAction::SetRoomNewThreadComposeExpanded {
+                        room_wire: nav.room_wire.clone(),
+                        expanded: true,
+                    }).expect("static json"));
                     button type="submit" class="form-toggle" aria-expanded="false" {
                         "+"
                     }
@@ -1049,10 +1037,6 @@ fn new_thread_form_for_room(nav: &ThreadNav, show: bool, compose_expanded: bool)
     }
 }
 
-pub(crate) fn expand_public_new_thread_rpc_value() -> String {
-    template_json_compact(&HtmlUiAction::ExpandPublicNewThreadForm).expect("static json")
-}
-
 pub(crate) fn login_to_post_hint_markup() -> Markup {
     html! {
         p class="muted" { "log in to post" }
diff --git a/server/src/html/forum/access.rs b/server/src/html/forum/access.rs
new file mode 100644
index 0000000000000000000000000000000000000000..f9f7139b63442a6ef3a927b77a72805f15feec3f
--- /dev/null
+++ b/server/src/html/forum/access.rs
@@ -0,0 +1,16 @@
+use crate::events::ThreadCapability;
+use crate::reducer::ReducerState;
+
+pub(crate) fn user_can_view_room(reduced: &ReducerState, room_id: &str, username: Option<&str>) -> bool {
+    if !reduced.rooms.contains(room_id) {
+        return false;
+    }
+    let Some(u) = username else {
+        return false;
+    };
+    reduced.user_has_cap(room_id, u, ThreadCapability::View)
+}
+
+pub(crate) fn user_can_post_room(reduced: &ReducerState, room_id: &str, username: &str) -> bool {
+    reduced.user_has_cap(room_id, username, ThreadCapability::Post)
+}
diff --git a/server/src/html/forum/ingest

… preview truncated; 19,729 characters omitted

download full diff B

Hardlinks — judgments / attempts / prompt

prompt download

judgments

attempts

Prompt text is loaded only by the download route.