Commit A introduces substantial new functionality and infrastructure. It adds a new vote comparison page, pair-selection algorithms, dynamic UI morphing after votes, item ID normalization improvements, integration and unit tests, CSS/JS updates, and refactors related request handling. These changes materially expand the project's capabilities and improve correctness. Commit B is a formatting/refactoring pass that reorganizes imports, wraps lines, and adjusts code layout without changing behavior. While useful for readability and consistency, it contributes far less to the project's functionality.
constitution · epochs · watch · epoch 3
c_af08bd851e49 (tommy-mor) vs c_995cbd9de96d (tommy-mor)
download prompt · raw event · cmp_e6bc86c957e0cd
council reasoning
Side A introduces a substantial new feature set: a full vote-compare UI flow, pair selection algorithm, dynamic DOM morphing, new modules (vote.rs, pair.rs), API changes, normalization improvements, CSS/JS updates, and integration tests. Side B is purely formatting and minor code reorganization with no functional changes. The impact difference is large.
Side A introduces a substantial new feature: a full pairwise vote compare UI (/vote), new HTML rendering module, pair selection algorithm with prioritization and tests, integration tests, storage normalization improvements, JS/CSS updates, and backend changes to support morphing edge history. It spans many new files and meaningful logic (~1000+ lines). Side B is purely formatting and import reordering with no behavioral changes. Therefore, Side A contributes overwhelmingly more.
sides
A — c_af08bd851e49 (tommy-mor)
message
[2bc302c3] refactor
diff preview
diff --git a/server/src/api/ui_html.rs b/server/src/api/ui_html.rs
index 06001212820101e0cc953d3687dea64f85e60787..d2f9769108def7ca2c5857aec8b4319426188a66 100644
--- a/server/src/api/ui_html.rs
+++ b/server/src/api/ui_html.rs
@@ -47,7 +47,7 @@ pub async fn post_ui_html(
ratio_left,
ratio_right,
scope,
- next,
+ vote_compare,
} => {
let parent = parent_from_scope(&scope);
if let Err(e) = state
@@ -57,14 +57,12 @@ pub async fn post_ui_html(
return ui_js_warn(&e).into_response();
}
let tree = state.tree.read().await;
- if !next.trim().is_empty() {
+ if vote_compare {
+ let left = parse_item_param(&a);
+ let right = parse_item_param(&b);
+ let morph = crate::html::vote::vote_recorded_morph(&tree, &parent, &left, &right);
drop(tree);
- return JsBuilder::new()
- .raw(&format!(
- "window.location.href={};",
- js_string_literal(next.trim())
- ))
- .into_response();
+ return morph.into_response();
}
let empty = crate::reducer::NodeState::default();
let node = tree.get(&parent).unwrap_or(&empty);
@@ -137,7 +135,7 @@ mod tests {
ratio_left: 3,
ratio_right: 1,
scope: String::new(),
- next: String::new(),
+ vote_compare: false,
}
);
}
diff --git a/server/src/html/mod.rs b/server/src/html/mod.rs
index 61cdbc094819ddedb755572c59456ec0d6617619..cd578a5fea46a9a1d49e238d08a80c2caf18708d 100644
--- a/server/src/html/mod.rs
+++ b/server/src/html/mod.rs
@@ -65,6 +65,15 @@ impl JsBuilder {
self
}
+ pub(crate) fn morph_inner_selector(mut self, selector: &str, markup: Markup) -> Self {
+ let html = js_string_literal(&markup.into_string());
+ self.snippets.push(format!(
+ "var __el = document.querySelector({sel}); if (__el) {{ Idiomorph.morph(__el, {html}, {{ morphStyle: 'innerHTML' }}); }}",
+ sel = js_string_literal(selector),
+ ));
+ self
+ }
+
pub(crate) fn raw(mut self, js: &str) -> Self {
if !js.is_empty() {
self.snippets.push(js.to_string());
diff --git a/server/src/html/vote.rs b/server/src/html/vote.rs
new file mode 100644
index 0000000000000000000000000000000000000000..89ed621ad861214e147add2062224fc4137ff8ad
--- /dev/null
+++ b/server/src/html/vote.rs
@@ -0,0 +1,306 @@
+//! Pairwise vote UI — `/vote?parent=` with optional `left` / `right`.
+
+use axum::{
+ extract::{Query, State},
+ response::{Html, IntoResponse},
+};
+use maud::{html, Markup};
+use serde::Deserialize;
+
+use crate::{
+ form_template::template_json_compact,
+ html::JsBuilder,
+ pair::{children_of, resolve_pair, suggest_next_pair_in_pool},
+ path_types::ItemId,
+ reducer::{GlobalTree, GroupState, NodeState, VoteData},
+ state::{parse_item_param, AppState},
+ ui_action::UI_RPC_FIELD,
+};
+
+use super::{breadcrumb_path, item_href, layout};
+
+#[derive(Debug, Deserialize)]
+pub struct VoteQuery {
+ pub parent: String,
+ #[serde(default)]
+ pub left: Option<String>,
+ #[serde(default)]
+ pub right: Option<String>,
+}
+
+pub fn vote_href(parent: &ItemId) -> String {
+ format!(
+ "/vote?parent={}",
+ urlencoding::encode(parent.as_str())
+ )
+}
+
+fn vote_compare_href(parent: &ItemId, left: &ItemId, right: &ItemId) -> String {
+ format!(
+ "/vote?parent={}&left={}&right={}",
+ urlencoding::encode(parent.as_str()),
+ urlencoding::encode(left.as_str()),
+ urlencoding::encode(right.as_str()),
+ )
+}
+
+fn display_label(id: &ItemId) -> String {
+ id.segments()
+ .last()
+ .map_or("item".into(), |v| v.to_string())
+}
+
+fn child_title(tree: &GlobalTree, id: &ItemId) -> String {
+ tree.get(id)
+ .and_then(|n| n.data.as_ref())
+ .map(|d| d.title.clone())
+ .unwrap_or_else(|| display_label(id))
+}
+
+fn ratio_pct(ratio_left: i32, ratio_right: i32) -> f64 {
+ let l = ratio_left.max(0) as f64;
+ let r = ratio_right.max(0) as f64;
+ let sum = l + r;
+ if sum <= 0.0 {
+ 50.0
+ } else {
+ (l / sum) * 100.0
+ }
+}
+
+fn ratios_for_page(v: &VoteData, page_left: &ItemId, page_right: &ItemId) -> (i32, i32) {
+ match (v.a.as_str(), v.b.as_str()) {
+ (a, b) if a == page_left.as_str() && b == page_right.as_str() => {
+ (v.ratio_left, v.ratio_right)
+ }
+ (a, b) if a == page_right.as_str() && b == page_left.as_str() => {
+ (v.ratio_right, v.ratio_left)
+ }
+ _ => (v.ratio_left, v.ratio_right),
+ }
+}
+
+fn edge_votes(group: &GroupState, left: &ItemId, right: &ItemId) -> Vec<VoteData> {
+ group
+ .recent_votes
+ .iter()
+ .filter(|v| {
+ (v.a.as_str() == left.as_str() && v.b.as_str() == right.as_str())
+ || (v.a.as_str() == right.as_str() && v.b.as_str() == left.as_str())
+ })
+ .cloned()
+ .collect()
+}
+
+fn vote_edge_history(tree: &GlobalTree, group: &GroupState, left: &ItemId, right: &ItemId) -> Markup {
+ let mut votes = edge_votes(group, 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);
+ html! {
+ @if votes.is_empty() {
+ p class="muted vote-edge-empty" { "no votes on this pair yet" }
+ } @else {
+ h3 class="vote-edge-history-title" {
+ "votes on this pair"
+ span class="vote-edge-history-axis muted" { " · " (legend_left) " : " (legend_right) }
+ }
+ ul class="vote-edge-history" {
+ @for v in &votes {
+ @let (r_left, r_right) = ratios_for_page(v, left, right);
+ @let pct = ratio_pct(r_left, r_right);
+ li class="vote-edge-history-row" {
+ div class="vote-edge-meta" {
+ span class="vote-edge-ratio" { (format!("{}:{}", r_left, r_right)) }
+ }
+ div class="ratio-bar vote-edge-bar" aria-hidden="true" {
+ div class="ratio-left" style={(format!("width: {:.3}%;", pct))} {}
+ div class="ratio-right" style={(format!("width: {:.3}%;", 100.0 - pct))} {}
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+fn vote_back_nav(parent: &ItemId) -> Markup {
+ html! {
+ div class="vote-compare-nav" {
+ a class="vote-compare-back muted" href=(item_href(parent)) { "← back to " (display_label(parent)) }
+ }
+ }
+}
+
+fn vote_compare_actions(parent: &ItemId, next: Option<&(ItemId, ItemId)>) -> Markup {
+ let next_href = next.map(|(l, r)| vote_compare_href(parent, l, r));
+ html! {
+ div id="vote-compare-actions" class="vote-compare-actions" {
+ button type="submit" class="btn-primary" data-testid="vote-post" { "post vote" }
+ @if let Some(href) = &next_href {
+ a class="btn-secondary vote-compare-next" data-testid="vote-next-pair" href=(href) { "next pair" }
+ } @else {
+ span class="btn-secondary vote-compare-next is-disabled" { "no next pair" }
+ }
+ }
+ }
+}
+
+/// After recording a vote on the compare page: refresh edge history and next-pair link.
+pub(crate) fn vote_recorded_morph(
+ tree: &GlobalTree,
+ parent: &ItemId,
+ left: &ItemId,
+ right: &ItemId,
+) -> 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 actions = vote_compare_actions(parent, next_pair.as_ref());
+ JsBuilder::new()
+ .morph_inner_selector("#vote-edge-history-region", edge_history)
+ .morph_selector("#vote-compare-actions", actions)
+}
+
+fn vote_compare_item_card(tree: &GlobalTree, item: &ItemId, side_class: &str) -> Markup {
+ let href = item_href(item);
+ let title = child_title(tree, item);
+ html! {
+ div class=(format!("vote-compare-side {side_class}")) {
+ a class=(format!("vote-compare-item {side_class}")) href=(href) {
+ @if let Some(row) = crate::render::reddit::child_row_markup(tree, item, &href) {
+ (row)
+ } @else {
+ strong { (title) }
+ }
+ }
+ @if let Some(node) = tree.get(item) {
+ @if crate::render::reddit::is_reddit_post(item) {
+ @if let Some(data) = &node.data {
+ @if let Some(src) = data.image_url.as_ref().or(data.thumb_url.as_ref()) {
+ figure class="vote-compare-figure" {
+ img class="vote-compare-image" src=(src) alt="" loading="lazy";
+ }
+ }
+ @if let Some(author) = &data.author {
+ p class="muted small" { "by " (author) }
+ }
+ }
+ } @else if let Some(data) = &node.data {
+ @if let Some(body) = &data.body_html {
+ div class="vote-compare-item-body" {
+ (maud::PreEscaped(body))
+ }
+ }
+ }
+ }
+ }
+ }
+}
+
+
+fn suggest_next(group: &GroupState, left: &ItemId, right: &ItemId, pool: &[ItemId]) -> Option<(ItemId, ItemId)> {
+ suggest_next_pair_in_pool(group, pool, Some((left, right)))
+}
+
+pub async fn vote_page(
+ State(state): State<AppState>,
+ Query(q): Query<VoteQuery>,
+) -> impl IntoResponse {
+ let parent = parse_item_param(&q.parent);
+ let left_param = q.left.as_deref().map(parse_item_param);
+ let right_param = q.right.as_deref().map(parse_item_param);
+
+ let tree = state.tree.read().await;
+ let empty = NodeState::default();
+ let parent_node = tree.get(&parent).unwrap_or(&empty);
+
+ let (left, right) = match resolve_pair(
+ &tree,
+ &parent,
+ left_param.as_ref(),
+ right_param.as_ref(),
+ ) {
+ Ok(p) => p,
+ Err(e) => {
+ let (msg, status) = e.status_message();
+ return (status, msg).into_response();
+ }
+ };
+
+ 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 rpc_json = template_json_compact(&serde_json::json!({
+ "action": "record_vote",
+ "a": left.as_str(),
+ "b": right.as_str(),
+ "ratio_left": {"$form:i32": "ratio_left"},
+ "ratio_right": {"$form:i32": "ratio_right"},
+ "scope": parent.as_str(),
+ "vote_compare": true,
+ }))
+ .expect("vote rpc json");
+
+ let title = format!(
+ "vote — {} vs {}",
+ child_title(&tree, &left),
+ child_title(&tree, &right)
+ );
+
+ let body = html! {
+ section class="vote-compare-shell" {
+ h1 { "compare" }
+ (breadcrumb_path(&parent))
+ p class="muted vote-compare-scope" {
+ "ranking children of "
+ a href=(item_href(&par
… preview truncated; 32,381 characters omittedB — c_995cbd9de96d (tommy-mor)
message
[2e4be477] format
diff preview
diff --git a/server/src/html/garden.rs b/server/src/html/garden.rs
index 76ba96e45c9e16291a6ccd8096fdd01b274c1560..2d5fcd903fe8f56800ad2c5564b704bd25f9b18d 100644
--- a/server/src/html/garden.rs
+++ b/server/src/html/garden.rs
@@ -9,30 +9,28 @@ use serde::Deserialize;
use serde_json::json;
use std::collections::HashSet;
-use base64::{engine::general_purpose::URL_SAFE_NO_PAD as B64_ENGINE, Engine as _};
+use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD as B64_ENGINE};
use crate::{
api::optional_principal,
canonical_path::{canonicalize_item, canonicalize_tag},
- form_template::template_json_compact,
- html::{
- ui_action::UI_RPC_FIELD,
- user_can_post_room,
- JsBuilder,
- },
events::ThreadCapability,
+ form_template::template_json_compact,
+ html::{JsBuilder, ui_action::UI_RPC_FIELD, user_can_post_room},
path_types::ItemId,
- reducer::{scope_from_room_wire, ContentState, ReducerState, ScopeId},
- scope_rank::{build_children_rankings, ChildrenRankings},
+ reducer::{ContentState, ReducerState, ScopeId, scope_from_room_wire},
+ scope_rank::{ChildrenRankings, build_children_rankings},
state::AppState,
timeago,
};
use super::{
- bc_path, bc_path_external, bc_segment, cli_panel, layout, layout_full_bleed_chromeless, now_ms,
- ratio_pct, render_linkified_with_embeds_in_scope, theme_from_jar, theme_next_from_uri,
+ bc_path, bc_path_external, bc_segment,
breadcrumb_path::{ExternalOntologyPath, OntologyPath},
- forum::{ingest_entry_markup, ThreadNav},
+ cli_panel,
+ forum::{ThreadNav, ingest_entry_markup},
+ layout, layout_full_bleed_chromeless, now_ms, ratio_pct, render_linkified_with_embeds_in_scope,
+ theme_from_jar, theme_next_from_uri,
};
/// `GET /vote/compare` — pairs `left` / `right` query params with optional `thread`.
@@ -90,7 +88,11 @@ fn canonical_edge_items(a: &ItemId, b: &ItemId) -> (ItemId, ItemId) {
}
/// All votes whose endpoints are exactly this unordered pair (unsorted).
-fn edge_vote_entries_for_pair(content: &ContentState, a: &ItemId, b: &ItemId) -> Vec<crate::reducer::VoteData> {
+fn edge_vote_entries_for_pair(
+ content: &ContentState,
+ a: &ItemId,
+ b: &ItemId,
+) -> Vec<crate::reducer::VoteData> {
let (lo, hi) = canonical_edge_items(a, b);
let lo_s = lo.as_str();
let hi_s = hi.as_str();
@@ -107,7 +109,11 @@ fn edge_vote_entries_for_pair(content: &ContentState, a: &ItemId, b: &ItemId) ->
.collect()
}
-fn ratios_for_compare_page(v: &crate::reducer::VoteData, page_left: &ItemId, page_right: &ItemId) -> (i32, i32) {
+fn ratios_for_compare_page(
+ v: &crate::reducer::VoteData,
+ page_left: &ItemId,
+ page_right: &ItemId,
+) -> (i32, i32) {
let pl = page_left.as_str();
let pr = page_right.as_str();
match (v.a.as_str(), v.b.as_str()) {
@@ -121,11 +127,7 @@ fn left_share_normalized(ratio_left: i32, ratio_right: i32) -> f64 {
let l = ratio_left.max(0) as f64;
let r = ratio_right.max(0) as f64;
let sum = l + r;
- if sum <= 0.0 {
- 0.5
- } else {
- l / sum
- }
+ if sum <= 0.0 { 0.5 } else { l / sum }
}
/// Stronger preference for **`page_left` first**; ties **newer first**.
@@ -177,11 +179,7 @@ fn vote_thread_tags_for_pair(content: &ContentState, a: &ItemId, b: &ItemId) ->
v.into_iter().map(|t| canonicalize_tag(&t)).collect()
}
-fn vote_edge_history_markup(
- content: &ContentState,
- left: &ItemId,
- right: &ItemId,
-) -> maud::Markup {
+fn vote_edge_history_markup(content: &ContentState, left: &ItemId, right: &ItemId) -> maud::Markup {
let votes = edge_vote_entries_for_pair(content, left, right);
let votes = sort_votes_for_compare_display(votes, left, right);
let legend_left = item_display_path(left.as_str());
@@ -276,7 +274,12 @@ fn item_code_label(item: &str) -> String {
item_display_path(item)
}
-fn vote_compare_href(nav: &ThreadNav, left: &ItemId, right: &ItemId, thread_override: Option<&str>) -> String {
+fn vote_compare_href(
+ nav: &ThreadNav,
+ left: &ItemId,
+ right: &ItemId,
+ thread_override: Option<&str>,
+) -> String {
let left_q = urlencoding::encode(left.as_str());
let right_q = urlencoding::encode(right.as_str());
let base = format!(
@@ -299,7 +302,8 @@ fn ont_pin_vote_controls(
next_path: &str,
) -> maud::Markup {
let room_wire = nav.room_wire.clone();
- let current = ItemId::parse(current_storage).unwrap_or_else(|| ItemId::opaque(current_storage.to_string()));
+ let current = ItemId::parse(current_storage)
+ .unwrap_or_else(|| ItemId::opaque(current_storage.to_string()));
let pin_matches_scope = pinned_room_and_item
.map(|(r, _)| r == nav.room_wire.as_str())
.unwrap_or(false);
@@ -307,26 +311,22 @@ fn ont_pin_vote_controls(
.filter(|_| pin_matches_scope)
.map(|(_, i)| i);
- let pin_rpc = template_json_compact(
- &json!({
- "action": "set_garden_pin",
- "clear": false,
- "room_wire": room_wire,
- "item_storage": current.as_str(),
- "next": next_path,
- "form_action": "/ui",
- }),
- )
+ let pin_rpc = template_json_compact(&json!({
+ "action": "set_garden_pin",
+ "clear": false,
+ "room_wire": room_wire,
+ "item_storage": current.as_str(),
+ "next": next_path,
+ "form_action": "/ui",
+ }))
.expect("pin rpc json");
- let unpin_rpc = template_json_compact(
- &json!({
- "action": "set_garden_pin",
- "clear": true,
- "room_wire": "",
- "next": next_path,
- "form_action": "/ui",
- }),
- )
+ let unpin_rpc = template_json_compact(&json!({
+ "action": "set_garden_pin",
+ "clear": true,
+ "room_wire": "",
+ "next": next_path,
+ "form_action": "/ui",
+ }))
.expect("unpin rpc json");
html! {
@@ -497,9 +497,9 @@ fn room_scope_has_garden_content(reduced: &ReducerState, nav: &ThreadNav) -> boo
fn content_for_garden_view<'a>(reduced: &'a ReducerState, scope: &ScopeId) -> &'a ContentState {
match scope {
ScopeId::Public => reduced.public(),
- ScopeId::Room(_) => reduced.content_for_scope(scope).expect(
- "room garden only renders after room_scope_has_garden_content returned true",
- ),
+ ScopeId::Room(_) => reduced
+ .content_for_scope(scope)
+ .expect("room garden only renders after room_scope_has_garden_content returned true"),
}
}
@@ -723,10 +723,8 @@ pub async fn room_external_garden_index(
}
let ext_path = ExternalOntologyPath::from_input("");
let parent = ItemId::parse("https://.").unwrap();
- let child_rankings = build_children_rankings(
- content_for_garden_view(&reduced, &nav.scope()),
- &parent,
- );
+ let child_rankings =
+ build_children_rankings(content_for_garden_view(&reduced, &nav.scope()), &parent);
drop(reduced);
let page = layout(
@@ -953,48 +951,74 @@ fn build_rank_history(
None => return vec![],
Some(e) => e,
};
- entries.iter().map(|e| {
- // Resolve caused_by: votes from this ingest that directly touched this item.
- let caused_by: Vec<crate::reducer::VoteData> = reduced.ingests_by_id
- .get(&e.post_id)
- .and_then(|ing| crate::dsl::parse_full(&ing.raw).ok())
- .map(|doc| {
- doc.statements.into_iter().filter_map(|s| {
- if let crate::dsl::Stmt::Vote { item1, item2, ratio_left, ratio_right, explanation } = s {
- let a_str = crate::canonical_path::canonicalize_item(&item1);
- let b_str = crate::canonical_path::canonicalize_item(&item2);
- if a_str == item || b_str == item {
- Some(crate::reducer::VoteData {
- ts: e.ts,
- a: ItemId::parse(&a_str).unwrap_or_else(|| ItemId::opaque(a_str)),
- b: ItemId::parse(&b_str).unwrap_or_else(|| ItemId::opaque(b_str)),
- ratio_left, ratio_right,
- body: explanation,
- principal: reduced.ingests_by_id.get(&e.post_id)
- .map(|ing| ing.principal.clone())
- .unwrap_or_default(),
- delegate: reduced.ingests_by_id.get(&e.post_id).and_then(|ing| ing.delegate.clone()),
- thread_tag: e.thread.clone(),
- })
- } else { None }
- } else { None }
- }).collect()
- })
- .unwrap_or_default();
-
- let thread_post_index =
- reduced.thread_post_index_chronological(scope, &e.thread, &e.post_id);
-
- RankHistoryEntryView {
- ts: e.ts,
- scope_rank: e.scope_rank,
- scope_total: e.scope_total,
- scope_rank_delta: e.scope_rank_delta,
- thread: e.thread.clone(),
- thread_post_index,
- caused_by,
- }
- }).collect()
+ entries
+ .iter()
+ .map(|e| {
+ // Resolve caused_by: votes from this ingest that directly touched this item.
+ let caused_by: Vec<crate::reducer::VoteData> = reduced
+ .ingests_by_id
+ .get(&e.post_id)
+ .and_then(|ing| crate::dsl::parse_full(&ing.raw).ok())
+ .map(|doc| {
+ doc.statements
+ .into_iter()
+ .filter_map(|s| {
+ if let crate::dsl::Stmt::Vote {
+ item1,
+ item2,
+ ratio_left,
+ ratio_right,
+ explanation,
+ } = s
+ {
+ let a_str = crate::canonical_path::canonicalize_item(&item1);
+ let b_str = crate::canonical_path::canonicalize_item(&item2);
+ if a_str == item || b_str == item {
+ Some(crate::reducer::VoteData {
+ ts: e.ts,
+ a: ItemId::parse(&a_str)
+ .unwrap_or_else(|| ItemId::opaque(a_str)),
+ b: ItemId::parse(&b_str)
+ .unwrap_or_else(|| ItemId::opaque(b_str)),
+ ratio_left,
+ ratio_right,
+ body: explanation,
+ principal: reduced
+ .ingests_by_id
+ .get(&e.post_id)
+ .map(|ing| ing.principal.clone())
+ .unwrap_or_default(),
+ delegate: reduced
+ .ingests_by_id
+ .get(&e.post_id)
+ .and_then(|ing| ing.delegate.clone()),
+ thread_tag: e.thread.clone(),
+ })
+ } else {
+ None
+ }
+ } else {
+
… preview truncated; 4,089 characters omittedHardlinks — judgments / attempts / prompt
judgments
attempts
Prompt text is loaded only by the download route.