From 80cd5a74364045176dc51289b36b27ac406c4b46 Mon Sep 17 00:00:00 2001 From: oxa agent Date: Tue, 17 Nov 2026 23:22:58 +0100 Subject: [PATCH 1/8] Render the default-off lead view in a mobile frame (#1030) --- oxa/oxa-cli/src/lead_page.rs | 17 +++------- oxa/oxa-cli/src/lead_page/style.css | 50 +++++++++++++++++++++++++++++ oxa/oxa-cli/tests/lead_serve.rs | 2 +- 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 oxa/oxa-cli/src/lead_page/style.css diff --git a/oxa/oxa-cli/src/lead_page.rs b/oxa/oxa-cli/src/lead_page.rs index aebe83e0..2e94178b 100644 --- a/oxa/oxa-cli/src/lead_page.rs +++ b/oxa/oxa-cli/src/lead_page.rs @@ -58,12 +58,12 @@ fn subject(value: &Subject) -> String { /// Full server-rendered page; scripts/styles are same-origin resources, without a CDN. pub fn document(view: &View<'_>, now: u64) -> String { - format!("oxa lead
oxa leadSnapshot
{}", content(view, now)) + format!("oxa lead
oxa leadSnapshot
{}", content(view, now)) } /// Allow-listed HTML fragment, also used by SSE. No worktrees, sessions, errors or headers. pub fn content(view: &View<'_>, now: u64) -> String { - let mut html = String::from("

Work in motion

"); + let mut html = String::from("

Status

"); let ask_count = view.situation.map_or(0, |s| s.asks.len()); let overdue: Vec<_> = view .queue @@ -110,7 +110,7 @@ pub fn content(view: &View<'_>, now: u64) -> String { } html.push_str(""); } - html.push_str("

Board

"); + html.push_str("

Board

"); if let Some(board) = view.board { let stale = board.observed_at > now.saturating_add(60) || now.saturating_sub(board.observed_at) > 900; let _ = write!( @@ -229,16 +229,7 @@ pub fn content(view: &View<'_>, now: u64) -> String { html } -pub const STYLE: &str = r#" -:root{color-scheme:dark;font:16px/1.6 system-ui,sans-serif;background:#10171e;color:#e2e9ed} -body{max-width:1100px;margin:auto;padding:0 24px}header{display:flex;justify-content:space-between;padding:28px 0;border-bottom:1px solid #34414a} -a{color:#e9c785;text-decoration:none}a:focus-visible{outline:2px solid #e9c785}header a{font-size:22px;color:inherit}header b{color:#e9c785} -h1{font-size:clamp(32px,5vw,48px);letter-spacing:-.04em;margin:40px 0 0}h2{font-size:22px}h3{font-size:18px;margin:6px 0} -.muted,footer,#connection{color:#a3b4bf}nav{display:flex;gap:24px;overflow:auto;padding:20px 0}nav a{white-space:nowrap} -section{padding:16px 0 28px;border-top:1px solid #34414a;scroll-margin:16px}.scroll{overflow:auto}table{border-collapse:collapse;width:100%;text-align:left;font-size:14px} -th{color:#a3b4bf;font-weight:500}td,th{padding:12px;border-bottom:1px solid #28343d}article{background:#19242d;padding:16px 20px;margin:12px 0;border-radius:8px}article p{margin:4px 0}footer{padding:24px 0 40px}li{margin:10px 0} -@media(max-width:600px){body{padding:0 16px}nav{gap:18px}td,th{padding:10px}header{padding:20px 0}} -"#; +pub const STYLE: &str = include_str!("lead_page/style.css"); pub const SCRIPT: &str = r#"const badge=document.getElementById('connection'); const stream=new EventSource('/events'); diff --git a/oxa/oxa-cli/src/lead_page/style.css b/oxa/oxa-cli/src/lead_page/style.css new file mode 100644 index 00000000..64beec1a --- /dev/null +++ b/oxa/oxa-cli/src/lead_page/style.css @@ -0,0 +1,50 @@ +:root{ + color-scheme:light dark;font:16px/1.45 system-ui,-apple-system,"Segoe UI",sans-serif; + --bg:#f4f5f8;--surface:#fff;--raised:#f0f2f6;--ink:#131720;--muted:#5d6676; + --line:#dfe3ea;--accent:#2b59c9;--accent-soft:#e6edfc;--warn:#8a5200;--warn-soft:#fdf0d7; + --radius:14px;--nav-height:62px;background:var(--bg);color:var(--ink) +} +@media(prefers-color-scheme:dark){:root{ + --bg:#0d1015;--surface:#161a21;--raised:#1e232c;--ink:#e9ecf1;--muted:#98a2b1; + --line:#2a303b;--accent:#86aaff;--accent-soft:#1b2740;--warn:#eab055;--warn-soft:#2e2412 +}} +*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scroll-padding-top:88px} +body{margin:0;padding-bottom:calc(var(--nav-height) + env(safe-area-inset-bottom) + 24px)} +a{color:var(--accent);text-decoration:none;overflow-wrap:anywhere} +a:hover{text-decoration:underline} +:focus-visible{outline:3px solid var(--accent);outline-offset:3px;border-radius:6px} +.skip{position:fixed;top:8px;left:16px;z-index:20;min-height:44px;padding:10px;background:var(--surface);transform:translateY(-160%)} +.skip:focus{transform:none} +.top{position:sticky;top:0;z-index:5;display:flex;justify-content:space-between;align-items:center;gap:12px; + min-height:62px;padding:8px 16px;padding-top:calc(8px + env(safe-area-inset-top)); + border-bottom:1px solid var(--line);background:var(--bg)} +.top>a{display:flex;align-items:center;gap:6px;min-height:44px;font-size:20px;color:var(--ink)} +.age,.muted,footer{color:var(--muted)}.age{font-size:13px;text-align:right;overflow-wrap:anywhere} +main{max-width:720px;min-width:0;margin:0 auto;padding:16px} +h1,h2,h3,p{margin:0}h1{font-size:22px;line-height:1.3;margin:4px 0 14px} +h2{font-size:18px;margin-bottom:12px}h3{font-size:17px;line-height:1.3} +p{margin:6px 0;overflow-wrap:anywhere}.muted{font-size:13px;font-variant-numeric:tabular-nums} +section{padding:18px 0;scroll-margin-top:88px;border-top:1px solid var(--line)} +#attention{padding:16px;border:0;border-radius:var(--radius);background:var(--warn-soft);margin-bottom:18px} +#attention h2{color:var(--warn)}ul{margin:8px 0;padding-left:22px}li{margin:8px 0;overflow-wrap:anywhere} +li a,summary{display:inline-flex;align-items:center;min-height:44px} +details>summary{cursor:pointer}details[open]>summary{margin-bottom:8px} +article{margin:10px 0;padding:14px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface);overflow-wrap:anywhere} +article p{margin-top:6px}.scroll{max-width:100%;overflow:auto;overscroll-behavior-x:contain;border:1px solid var(--line);border-radius:var(--radius)} +table{width:100%;border-collapse:collapse;text-align:left;font-size:14px;background:var(--surface)} +th,td{padding:12px;border-bottom:1px solid var(--line);vertical-align:top}th{font-weight:600;color:var(--muted)} +tr:last-child td{border-bottom:0}th:first-child,td:first-child{white-space:nowrap} +nav.tabs{position:fixed;left:0;right:0;bottom:0;z-index:10;display:flex;background:var(--surface); + border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)} +nav.tabs a{display:flex;flex:1;align-items:center;justify-content:center;min-width:0;min-height:var(--nav-height); + padding:8px 4px;font-size:12px;font-weight:600;text-align:center;color:var(--muted)} +nav.tabs a:hover,nav.tabs a:focus-visible{color:var(--accent);background:var(--accent-soft)} +footer{padding:18px 0;font-size:13px;overflow-wrap:anywhere} +@media(min-width:900px){ + body{padding-left:184px;padding-bottom:24px}main{max-width:1080px;padding:24px} + .top{padding-left:24px;padding-right:24px} + nav.tabs{right:auto;top:0;bottom:0;width:184px;flex-direction:column;justify-content:center; + padding:16px 12px;border-top:0;border-right:1px solid var(--line);gap:8px} + nav.tabs a{flex:none;justify-content:flex-start;min-height:48px;padding:12px;border-radius:12px;font-size:14px;text-align:left} +} +@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto;transition:none!important}} diff --git a/oxa/oxa-cli/tests/lead_serve.rs b/oxa/oxa-cli/tests/lead_serve.rs index 5f781308..45f31ea4 100644 --- a/oxa/oxa-cli/tests/lead_serve.rs +++ b/oxa/oxa-cli/tests/lead_serve.rs @@ -142,7 +142,7 @@ fn real_server_is_user_enabled_authorized_and_rereads_private_board() { .starts_with("HTTP/1.1 403")); std::fs::set_permissions(&sample, std::fs::Permissions::from_mode(0o644)).unwrap(); let event = get(port, "/events", &authority, ""); - assert!(event.contains("event: snapshot\ndata:
")); + assert!(event.contains("event: snapshot\ndata: Date: Tue, 17 Nov 2026 23:23:58 +0100 Subject: [PATCH 2/8] Use the approved worker heading in the mobile frame (#1030) --- oxa/oxa-cli/src/lead_page.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oxa/oxa-cli/src/lead_page.rs b/oxa/oxa-cli/src/lead_page.rs index 2e94178b..4ab3a695 100644 --- a/oxa/oxa-cli/src/lead_page.rs +++ b/oxa/oxa-cli/src/lead_page.rs @@ -149,7 +149,7 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

Board unavailable.

"); } - html.push_str("

Lanes

"); + html.push_str("

Workers

"); if let Some(s) = view.situation { let _ = write!( html, From dfb68b2c3746686b0b0b6afe448744dfca12eb4b Mon Sep 17 00:00:00 2001 From: oxa agent Date: Tue, 17 Nov 2026 23:31:27 +0100 Subject: [PATCH 3/8] Focus the status heading while preserving snapshot framing (#1030) --- oxa/oxa-cli/src/lead_page.rs | 2 +- oxa/oxa-cli/tests/lead_serve.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/oxa/oxa-cli/src/lead_page.rs b/oxa/oxa-cli/src/lead_page.rs index 4ab3a695..03f342db 100644 --- a/oxa/oxa-cli/src/lead_page.rs +++ b/oxa/oxa-cli/src/lead_page.rs @@ -63,7 +63,7 @@ pub fn document(view: &View<'_>, now: u64) -> String { /// Allow-listed HTML fragment, also used by SSE. No worktrees, sessions, errors or headers. pub fn content(view: &View<'_>, now: u64) -> String { - let mut html = String::from("

Status

"); + let mut html = String::from("

Status

"); let ask_count = view.situation.map_or(0, |s| s.asks.len()); let overdue: Vec<_> = view .queue diff --git a/oxa/oxa-cli/tests/lead_serve.rs b/oxa/oxa-cli/tests/lead_serve.rs index 45f31ea4..5f781308 100644 --- a/oxa/oxa-cli/tests/lead_serve.rs +++ b/oxa/oxa-cli/tests/lead_serve.rs @@ -142,7 +142,7 @@ fn real_server_is_user_enabled_authorized_and_rereads_private_board() { .starts_with("HTTP/1.1 403")); std::fs::set_permissions(&sample, std::fs::Permissions::from_mode(0o644)).unwrap(); let event = get(port, "/events", &authority, ""); - assert!(event.contains("event: snapshot\ndata: ")); assert!(event.contains("Board unavailable")); assert!(!event.contains(sample.to_str().unwrap())); drop(child); From 73be8b340ea167a72ae7b3653b0b264578bd0053 Mon Sep 17 00:00:00 2001 From: oxa agent Date: Tue, 17 Nov 2026 23:32:27 +0100 Subject: [PATCH 4/8] Exercise real no-JS lead page URLs and authorized fragments (#1030) --- oxa/oxa-cli/tests/lead_serve.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/oxa/oxa-cli/tests/lead_serve.rs b/oxa/oxa-cli/tests/lead_serve.rs index 5f781308..1bfad5b2 100644 --- a/oxa/oxa-cli/tests/lead_serve.rs +++ b/oxa/oxa-cli/tests/lead_serve.rs @@ -132,6 +132,26 @@ fn real_server_is_user_enabled_authorized_and_rereads_private_board() { let page = get(port, "/", &authority, ""); assert!(page.starts_with("HTTP/1.1 200")); assert!(page.contains("No open PRs in this snapshot")); + for (path, title) in [ + ("/", "Status"), + ("/asks", "Asks"), + ("/board", "Board"), + ("/workers", "Workers"), + ("/usage", "Usage"), + ] { + for fragment in [false, true] { + let path = if fragment { + format!("{path}?fragment=1") + } else { + path.into() + }; + let response = get(port, &path, &authority, ""); + assert!(response.starts_with("HTTP/1.1 200"), "{path}"); + assert!(response.contains(&format!(">{title}")), "{path}"); + assert_eq!(response.contains(""), !fragment, "{path}"); + } + assert!(get(port, path, "attacker.invalid", "").starts_with("HTTP/1.1 403")); + } assert!(get(port, "/", "attacker.invalid", "").starts_with("HTTP/1.1 403")); assert!(get( port, From f54483c042f6c37905a8b69221307359d3094120 Mon Sep 17 00:00:00 2001 From: oxa agent Date: Tue, 17 Nov 2026 23:50:30 +0100 Subject: [PATCH 5/8] Route authorized lead pages through shared bounded projections (#1030) --- oxa/oxa-cli/src/lead_http.rs | 28 +++++--- oxa/oxa-cli/src/lead_page.rs | 103 ++++++++++++++++++++++++---- oxa/oxa-cli/src/lead_page/pages.rs | 60 ++++++++++++++++ oxa/oxa-cli/src/lead_page/style.css | 2 +- oxa/oxa-cli/src/lead_serve.rs | 14 ++-- 5 files changed, 179 insertions(+), 28 deletions(-) create mode 100644 oxa/oxa-cli/src/lead_page/pages.rs diff --git a/oxa/oxa-cli/src/lead_http.rs b/oxa/oxa-cli/src/lead_http.rs index a14c559a..fbe0e6e6 100644 --- a/oxa/oxa-cli/src/lead_http.rs +++ b/oxa/oxa-cli/src/lead_http.rs @@ -1,5 +1,6 @@ //! Registry-neutral HTTP adapter. No listener, identity policy or command is declared here. //! The owner-approved caller binds the listener and supplies verified request authorization. +use crate::lead_page::Page; use std::{ io::{Read, Write}, net::{TcpListener, TcpStream}, @@ -23,7 +24,7 @@ impl Drop for Slot { pub fn serve( listener: TcpListener, authorize: impl Fn(&TcpStream, &Request<'_>) -> bool + Send + Sync + 'static, - render: impl Fn(bool) -> String + Send + Sync + 'static, + render: impl Fn(Page, bool) -> String + Send + Sync + 'static, ) -> std::io::Result<()> { if !listener.local_addr()?.ip().is_loopback() { return Err(std::io::ErrorKind::PermissionDenied.into()); @@ -39,7 +40,11 @@ pub fn serve( let (authorize, render, slot) = (authorize.clone(), render.clone(), Slot(active.clone())); std::thread::spawn(move || { let _slot = slot; - let _ = connection(stream, |s, r| authorize(s, r), |fragment| render(fragment)); + let _ = connection( + stream, + |s, r| authorize(s, r), + |page, fragment| render(page, fragment), + ); }); } Ok(()) @@ -60,7 +65,7 @@ pub struct Request<'a> { pub fn connection( mut stream: TcpStream, authorize: impl FnOnce(&TcpStream, &Request<'_>) -> bool, - render: impl FnOnce(bool) -> String, + render: impl FnOnce(Page, bool) -> String, ) -> std::io::Result<()> { let start = Instant::now(); let mut bytes = Vec::new(); @@ -86,15 +91,20 @@ pub fn connection( Ok(r.path) }); let (status, kind, body) = match allowed { - Ok("/") => ("200 OK", "text/html", render(false)), Ok("/events") => ( "200 OK", "text/event-stream", - format!("retry: 5000\nevent: snapshot\ndata: {}\n\n", render(true)), + format!( + "retry: 5000\nevent: snapshot\ndata: {}\n\n", + render(Page::Home, true) + ), ), Ok("/style.css") => ("200 OK", "text/css", crate::lead_page::STYLE.into()), Ok("/live.js") => ("200 OK", "text/javascript", crate::lead_page::SCRIPT.into()), - Ok(_) => ("404 Not Found", "text/plain", "Not found".into()), + Ok(path) => match Page::request(path) { + Some((page, fragment)) => ("200 OK", "text/html", render(page, fragment)), + None => ("404 Not Found", "text/plain", "Not found".into()), + }, Err(status) => (status, "text/plain", "Request refused".into()), }; let headers = format!("HTTP/1.1 {status}\r\nContent-Type: {kind}; charset=utf-8\r\nContent-Length: {}\r\nConnection: close\r\nCache-Control: no-store\r\nX-Content-Type-Options: nosniff\r\nContent-Security-Policy: default-src 'none'; script-src 'self'; style-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'\r\nReferrer-Policy: no-referrer\r\n\r\n", body.len()); @@ -186,7 +196,7 @@ mod tests { connection( server, |_, _| permitted, - |fragment| { + |page, fragment| { count.fetch_add(1, Ordering::SeqCst); let board = oxa_work::board::Board::default(); let view = crate::lead_page::View { @@ -194,9 +204,9 @@ mod tests { ..Default::default() }; if fragment { - crate::lead_page::content(&view, 100) + crate::lead_page::content_for(page, &view, 100) } else { - crate::lead_page::document(&view, 100) + crate::lead_page::document_for(page, &view, 100) } }, ) diff --git a/oxa/oxa-cli/src/lead_page.rs b/oxa/oxa-cli/src/lead_page.rs index 03f342db..1b52096f 100644 --- a/oxa/oxa-cli/src/lead_page.rs +++ b/oxa/oxa-cli/src/lead_page.rs @@ -3,6 +3,9 @@ use oxa_proto::work::{IncidentKind, PullRequest, Snapshot, Subject}; use oxa_work::board::{Action, Board}; use std::fmt::Write; +mod pages; +pub use pages::Page; + /// Borrowed presentation inputs, not a second runner state store. None means unavailable. #[derive(Default)] pub struct View<'a> { @@ -58,12 +61,51 @@ fn subject(value: &Subject) -> String { /// Full server-rendered page; scripts/styles are same-origin resources, without a CDN. pub fn document(view: &View<'_>, now: u64) -> String { - format!("oxa lead
oxa leadSnapshot
{}", content(view, now)) + document_for(Page::Home, view, now) +} + +pub fn document_for(page: Page, view: &View<'_>, now: u64) -> String { + let refresh = if page == Page::Home { + "" + } else { + "" + }; + format!("oxa lead{refresh}
oxa leadSnapshot
{}", content_for(page, view, now)) } /// Allow-listed HTML fragment, also used by SSE. No worktrees, sessions, errors or headers. pub fn content(view: &View<'_>, now: u64) -> String { - let mut html = String::from("

Status

"); + content_for(Page::Home, view, now) +} + +pub fn content_for(page: Page, view: &View<'_>, now: u64) -> String { + let mut html = format!("

{}

", page.title()); + if page == Page::Home { + attention(&mut html, view); + } + html.push_str(&page.navigation()); + match page { + Page::Home => { + board(&mut html, view, now); + workers(&mut html, view); + queue(&mut html, view); + release(&mut html, view); + asks(&mut html, view); + } + Page::Board => { + board(&mut html, view, now); + queue(&mut html, view); + } + Page::Workers => workers(&mut html, view), + Page::Asks => asks(&mut html, view), + Page::Usage => html + .push_str("

Plans and quotas

Usage observations unavailable.

"), + } + html.push_str("
Read-only · Chat with the lead is not connected yet.
"); + html +} + +fn attention(html: &mut String, view: &View<'_>) { let ask_count = view.situation.map_or(0, |s| s.asks.len()); let overdue: Vec<_> = view .queue @@ -110,7 +152,10 @@ pub fn content(view: &View<'_>, now: u64) -> String { } html.push_str("
"); } - html.push_str("

Board

"); +} + +fn board(html: &mut String, view: &View<'_>, now: u64) { + html.push_str("

Board

"); if let Some(board) = view.board { let stale = board.observed_at > now.saturating_add(60) || now.saturating_sub(board.observed_at) > 900; let _ = write!( @@ -149,7 +194,11 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

Board unavailable.

"); } - html.push_str("

Workers

"); + html.push_str("
"); +} + +fn workers(html: &mut String, view: &View<'_>) { + html.push_str("

Workers

"); if let Some(s) = view.situation { let _ = write!( html, @@ -188,7 +237,11 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

Lane status unavailable.

"); } - html.push_str("

Merge queue

"); + html.push_str("
"); +} + +fn queue(html: &mut String, view: &View<'_>) { + html.push_str("

Merge queue

"); if let Some(queue) = view.queue { for (index, pr) in queue.iter().enumerate() { let _ = write!(html, "
{}. PR #{}
", index + 1, pr.number); @@ -199,7 +252,11 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

Merge queue unavailable. Ready to land does not establish queue membership.

"); } - html.push_str("

Release checklist

"); + html.push_str("
"); +} + +fn release(html: &mut String, view: &View<'_>) { + html.push_str("

Release checklist

"); if let Some((number, items)) = view.release { let _ = write!(html, "

Issue #{number} · {} / {} reported complete; validation requires merge evidence.

    ", items.iter().filter(|i| i.0).count(), items.len()); for (checked, text) in items { @@ -214,7 +271,11 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

    Release checklist unavailable.

    "); } - html.push_str("

For your decision

"); + html.push_str("
"); +} + +fn asks(html: &mut String, view: &View<'_>) { + html.push_str("

For your decision

"); if let Some(s) = view.situation { for ask in &s.asks { let _ = write!(html, "

{}

{}

Options, recommendation and meanwhile are unavailable in these facts.

", subject(&ask.subject), escape(&ask.question)); @@ -225,16 +286,34 @@ pub fn content(view: &View<'_>, now: u64) -> String { } else { html.push_str("

Owner asks unavailable.

"); } - html.push_str("
Read-only · Chat with the lead is not connected yet.
"); - html + html.push_str(""); } pub const STYLE: &str = include_str!("lead_page/style.css"); pub const SCRIPT: &str = r#"const badge=document.getElementById('connection'); -const stream=new EventSource('/events'); -stream.addEventListener('snapshot',event=>{document.querySelector('main').outerHTML=event.data;badge.textContent='Live';}); -stream.onerror=()=>{badge.textContent='Disconnected · reconnecting';}; +let timer,pending; +async function refresh(){ + clearTimeout(timer); + if(document.hidden)return; + if(document.querySelector('main').contains(document.activeElement)&&document.activeElement.matches('a,button,input,textarea,select,summary')){timer=setTimeout(refresh,15000);return;} + if(pending)pending.abort(); + const active=new AbortController();pending=active; + const target=new URL(location.href);target.searchParams.set('fragment','1'); + try{ + const response=await fetch(target,{cache:'no-store',signal:active.signal}); + if(!response.ok)throw new Error('refresh refused'); + const doc=new DOMParser().parseFromString(await response.text(),'text/html'); + const next=doc.querySelector('main'); + if(!next)throw new Error('refresh unavailable'); + if(pending===active){document.querySelector('main').replaceWith(next);badge.textContent='Live';} + }catch(error){if(!active.signal.aborted)badge.textContent='Refresh unavailable';} + finally{if(pending===active){pending=null;if(!document.hidden)timer=setTimeout(refresh,15000);}} +} +document.addEventListener('visibilitychange',()=>{ + clearTimeout(timer);if(pending)pending.abort();if(!document.hidden)refresh(); +}); +timer=setTimeout(refresh,15000); "#; #[cfg(test)] diff --git a/oxa/oxa-cli/src/lead_page/pages.rs b/oxa/oxa-cli/src/lead_page/pages.rs new file mode 100644 index 00000000..afad075f --- /dev/null +++ b/oxa/oxa-cli/src/lead_page/pages.rs @@ -0,0 +1,60 @@ +use std::fmt::Write; + +/// Read-only destinations; request text never becomes a renderer instruction. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub enum Page { + Home, + Asks, + Board, + Workers, + Usage, +} + +impl Page { + const ALL: [Self; 5] = [Self::Home, Self::Asks, Self::Board, Self::Workers, Self::Usage]; + + pub fn title(self) -> &'static str { + match self { + Self::Home => "Status", + Self::Asks => "Asks", + Self::Board => "Board", + Self::Workers => "Workers", + Self::Usage => "Usage", + } + } + + fn path(self) -> &'static str { + match self { + Self::Home => "/", + Self::Asks => "/asks", + Self::Board => "/board", + Self::Workers => "/workers", + Self::Usage => "/usage", + } + } + + pub(crate) fn request(path: &str) -> Option<(Self, bool)> { + let (path, fragment) = path + .strip_suffix("?fragment=1") + .map_or((path, false), |path| (path, true)); + Self::ALL + .into_iter() + .find(|page| page.path() == path) + .map(|page| (page, fragment)) + } + + pub(super) fn navigation(self) -> String { + let mut html = String::from(""); + html + } +} diff --git a/oxa/oxa-cli/src/lead_page/style.css b/oxa/oxa-cli/src/lead_page/style.css index 64beec1a..80e72e7b 100644 --- a/oxa/oxa-cli/src/lead_page/style.css +++ b/oxa/oxa-cli/src/lead_page/style.css @@ -38,7 +38,7 @@ nav.tabs{position:fixed;left:0;right:0;bottom:0;z-index:10;display:flex;backgrou border-top:1px solid var(--line);padding-bottom:env(safe-area-inset-bottom)} nav.tabs a{display:flex;flex:1;align-items:center;justify-content:center;min-width:0;min-height:var(--nav-height); padding:8px 4px;font-size:12px;font-weight:600;text-align:center;color:var(--muted)} -nav.tabs a:hover,nav.tabs a:focus-visible{color:var(--accent);background:var(--accent-soft)} +nav.tabs a[aria-current=page],nav.tabs a:hover,nav.tabs a:focus-visible{color:var(--accent);background:var(--accent-soft)} footer{padding:18px 0;font-size:13px;overflow-wrap:anywhere} @media(min-width:900px){ body{padding-left:184px;padding-bottom:24px}main{max-width:1080px;padding:24px} diff --git a/oxa/oxa-cli/src/lead_serve.rs b/oxa/oxa-cli/src/lead_serve.rs index 91200a88..7dde8ced 100644 --- a/oxa/oxa-cli/src/lead_serve.rs +++ b/oxa/oxa-cli/src/lead_serve.rs @@ -68,7 +68,7 @@ impl Source { Ok(Self { uid, board }) } - fn render(&self, fragment: bool) -> String { + fn render(&self, page: crate::lead_page::Page, fragment: bool) -> String { // The existing bounded reader revalidates owner-only files/directories on every read. // Missing, stale and refused data remain explicit in the shared renderer. let board = self @@ -83,9 +83,9 @@ impl Source { .duration_since(UNIX_EPOCH) .map_or(0, |d| d.as_secs()); if fragment { - crate::lead_page::content(&view, now) + crate::lead_page::content_for(page, &view, now) } else { - crate::lead_page::document(&view, now) + crate::lead_page::document_for(page, &view, now) } } } @@ -111,7 +111,7 @@ pub fn run(dirs: &Dirs, cwd: &Path, env: &Env, out: &mut dyn Write) -> Result Date: Tue, 17 Nov 2026 23:57:54 +0100 Subject: [PATCH 6/8] Exercise item drill-down through the real lead listener (#1030) --- oxa/oxa-cli/tests/lead_serve.rs | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/oxa/oxa-cli/tests/lead_serve.rs b/oxa/oxa-cli/tests/lead_serve.rs index 1bfad5b2..8a2ce81e 100644 --- a/oxa/oxa-cli/tests/lead_serve.rs +++ b/oxa/oxa-cli/tests/lead_serve.rs @@ -152,6 +152,41 @@ fn real_server_is_user_enabled_authorized_and_rereads_private_board() { } assert!(get(port, path, "attacker.invalid", "").starts_with("HTTP/1.1 403")); } + let record = serde_json::json!({"schema_version":1,"observed_at":10,"board":{ + "observed_at":10,"entries":[{"number":17,"head":"private-head-marker", + "release_pinned":true,"action":"fix_findings","lease":null, + "attempts_today":2,"eligible":false}]}}); + std::fs::write(&sample, format!("{record}\n")).unwrap(); + assert!(get(port, "/board", &authority, "").contains("href=/items/17")); + for path in ["/items/17", "/items/17?fragment=1"] { + let response = get(port, path, &authority, ""); + assert!(response.starts_with("HTTP/1.1 200"), "{path}"); + for text in [ + "Item #17", + "Fix findings", + "Release", + "Unleased", + "2", + "aria-current=page>Board", + ] { + assert!(response.contains(text), "{text}"); + } + assert!(!response.contains("private-head-marker")); + assert!(get(port, path, "attacker.invalid", "").starts_with("HTTP/1.1 403")); + } + assert!(get(port, "/items/18", &authority, "").contains("Item unavailable")); + for path in [ + "/items/0", + "/items/01", + "/items/-1", + "/items/18446744073709551616", + "/items/17/x", + ] { + assert!( + get(port, path, &authority, "").starts_with("HTTP/1.1 404"), + "{path}" + ); + } assert!(get(port, "/", "attacker.invalid", "").starts_with("HTTP/1.1 403")); assert!(get( port, From 7af30c3e34fcbef780c80022e6ac9b30473a91db Mon Sep 17 00:00:00 2001 From: oxa agent Date: Wed, 18 Nov 2026 00:07:26 +0100 Subject: [PATCH 7/8] Render item details from the shared authorized board view (#1030) --- oxa/oxa-cli/src/lead_page.rs | 48 ++++++++++++++++++++++------- oxa/oxa-cli/src/lead_page/pages.rs | 19 ++++++++++-- oxa/oxa-cli/src/lead_page/style.css | 1 + 3 files changed, 55 insertions(+), 13 deletions(-) diff --git a/oxa/oxa-cli/src/lead_page.rs b/oxa/oxa-cli/src/lead_page.rs index 1b52096f..7bf34d59 100644 --- a/oxa/oxa-cli/src/lead_page.rs +++ b/oxa/oxa-cli/src/lead_page.rs @@ -1,6 +1,6 @@ //! Read-only web projection. Never serialize runner records or arbitrary GitHub payloads. use oxa_proto::work::{IncidentKind, PullRequest, Snapshot, Subject}; -use oxa_work::board::{Action, Board}; +use oxa_work::board::{Action, Board, Entry}; use std::fmt::Write; mod pages; @@ -79,7 +79,11 @@ pub fn content(view: &View<'_>, now: u64) -> String { } pub fn content_for(page: Page, view: &View<'_>, now: u64) -> String { - let mut html = format!("

{}

", page.title()); + let title = match page { + Page::Item(number) => format!("Item #{number}"), + _ => page.title().into(), + }; + let mut html = format!("

{title}

"); if page == Page::Home { attention(&mut html, view); } @@ -98,6 +102,7 @@ pub fn content_for(page: Page, view: &View<'_>, now: u64) -> String { } Page::Workers => workers(&mut html, view), Page::Asks => asks(&mut html, view), + Page::Item(number) => item(&mut html, view, number, now), Page::Usage => html .push_str("

Plans and quotas

Usage observations unavailable.

"), } @@ -170,17 +175,10 @@ fn board(html: &mut String, view: &View<'_>, now: u64) { ); html.push_str("
"); for row in &board.entries { - let lease = row.lease.as_ref().map_or("Unleased".into(), |l| { - format!( - "{} · expires {}{}", - escape(&l.holder), - l.expires_at, - if l.expires_at <= now { " (expired)" } else { "" } - ) - }); + let lease = lease(row, now); let _ = write!( html, - "", + "", row.number, action(row.action), if row.release_pinned { "Release" } else { "Normal" }, @@ -197,6 +195,34 @@ fn board(html: &mut String, view: &View<'_>, now: u64) { html.push_str(""); } +fn lease(row: &Entry, now: u64) -> String { + row.lease.as_ref().map_or("Unleased".into(), |l| { + format!( + "{} · expires {}{}", + escape(&l.holder), + l.expires_at, + if l.expires_at <= now { " (expired)" } else { "" } + ) + }) +} + +fn item(html: &mut String, view: &View<'_>, number: u64, now: u64) { + html.push_str("

Back to Board

"); + let Some(board) = view.board else { + html.push_str("

Board unavailable.

"); + return; + }; + let Some(row) = board.entries.iter().find(|row| row.number == number) else { + html.push_str("

Item unavailable in this snapshot.

"); + return; + }; + let _ = write!(html, + "

Next action

{}

State

{}

{}

Attempts today: {}

Observed at {} (Unix seconds)

", + action(row.action), if row.release_pinned { "Release" } else { "Normal priority" }, + lease(row, now), row.attempts_today, board.observed_at); + html.push_str("

Details and changes

Title, checks, findings and diff observations unavailable.

"); +} + fn workers(html: &mut String, view: &View<'_>) { html.push_str("

Workers

"); if let Some(s) = view.situation { diff --git a/oxa/oxa-cli/src/lead_page/pages.rs b/oxa/oxa-cli/src/lead_page/pages.rs index afad075f..34ced9a2 100644 --- a/oxa/oxa-cli/src/lead_page/pages.rs +++ b/oxa/oxa-cli/src/lead_page/pages.rs @@ -8,6 +8,7 @@ pub enum Page { Board, Workers, Usage, + Item(u64), } impl Page { @@ -20,6 +21,7 @@ impl Page { Self::Board => "Board", Self::Workers => "Workers", Self::Usage => "Usage", + Self::Item(_) => "Item", } } @@ -27,7 +29,7 @@ impl Page { match self { Self::Home => "/", Self::Asks => "/asks", - Self::Board => "/board", + Self::Board | Self::Item(_) => "/board", Self::Workers => "/workers", Self::Usage => "/usage", } @@ -37,6 +39,10 @@ impl Page { let (path, fragment) = path .strip_suffix("?fragment=1") .map_or((path, false), |path| (path, true)); + if let Some(number) = path.strip_prefix("/items/") { + let parsed: u64 = number.parse().ok()?; + return (parsed > 0 && parsed.to_string() == number).then_some((Self::Item(parsed), fragment)); + } Self::ALL .into_iter() .find(|page| page.path() == path) @@ -45,12 +51,21 @@ impl Page { pub(super) fn navigation(self) -> String { let mut html = String::from("
PRNext actionPriorityLeaseAttempts today
#{}{}{}{lease}{}
#{0}{1}{2}{lease}{3}