aienos.com
Source of www.aienos.com, served from my own hardware
Brought by drakestapleton
aienos.com / crates / site-builder / src / components / status.rs
| 1 | use maud::{html, Markup}; |
| 2 | |
| 3 | use crate::facts::Facts; |
| 4 | |
| 5 | use super::boxlink::{foot, source_href, Target}; |
| 6 | use super::research_status as rs; |
| 7 | |
| 8 | /// The file that holds a layer's words, for a layer with no receipt yet. |
| 9 | const THIS_FILE: &str = "crates/site-builder/src/components/status.rs"; |
| 10 | |
| 11 | /// The canonical public state of the project. This list is the single |
| 12 | /// source of truth: the homepage status section, /status.json, and |
| 13 | /// /llms.txt all render from it. Statuses are a small fixed set: |
| 14 | /// IMPLEMENTED, QUALIFIED, EXPERIMENTAL, BLOCKED, PLANNED. |
| 15 | /// Bump UPDATED when a state changes; states change when the evidence |
| 16 | /// changes, not when the copy does. |
| 17 | pub const UPDATED: &str = "2026-10-01"; |
| 18 | |
| 19 | pub struct LayerState { |
| 20 | pub name: &'static str, |
| 21 | pub status: &'static str, |
| 22 | pub note: &'static str, |
| 23 | pub receipt_label: Option<&'static str>, |
| 24 | pub receipt_url: Option<&'static str>, |
| 25 | } |
| 26 | |
| 27 | pub fn layer_states() -> Vec<LayerState> { |
| 28 | vec![ |
| 29 | LayerState { |
| 30 | name: "Omega foundation gates", |
| 31 | status: "QUALIFIED", |
| 32 | note: "Gates 1 through 14 closed with one combined admission receipt: 230 checks, 0 failures.", |
| 33 | receipt_label: Some("omega PR #111"), |
| 34 | receipt_url: None, |
| 35 | }, |
| 36 | LayerState { |
| 37 | name: "Turing instrument", |
| 38 | status: rs::turing_instrument_status(), |
| 39 | note: rs::turing_instrument_note(), |
| 40 | receipt_label: Some("omega PR #88"), |
| 41 | receipt_url: None, |
| 42 | }, |
| 43 | LayerState { |
| 44 | name: "Native C kernel", |
| 45 | status: "IMPLEMENTED", |
| 46 | note: "Freestanding C kernel on main. Boots via UEFI in emulation, with NVMe, ARGUS capability checks, and the sealed Store in the boot path.", |
| 47 | receipt_label: Some("aien-dev/aienux · PR #194"), |
| 48 | receipt_url: Some("https://interplane.io/drakestapleton/aienux/commit/34c60536da7a"), |
| 49 | }, |
| 50 | LayerState { |
| 51 | name: "Native machine qualification (M5)", |
| 52 | status: "BLOCKED", |
| 53 | note: "First qualification receipt: NOT QUALIFIED, 10 blocked, 6 missing. Published, and being worked down in public.", |
| 54 | receipt_label: Some("aien-dev/aienux · PR #187"), |
| 55 | receipt_url: Some("https://interplane.io/drakestapleton/aienux/commit/929a720b6f89"), |
| 56 | }, |
| 57 | LayerState { |
| 58 | name: "Turing experiments (EXP-001 / 002 / 003)", |
| 59 | status: "EXPERIMENTAL", |
| 60 | note: rs::experiments_note(), |
| 61 | receipt_label: Some("omega PR #119"), |
| 62 | receipt_url: None, |
| 63 | }, |
| 64 | LayerState { |
| 65 | name: "Aien, the persistent agent", |
| 66 | status: "EXPERIMENTAL", |
| 67 | note: "Runs in the lab on the DGX Spark. The learning loop, learning from verified experience, is the active build.", |
| 68 | receipt_label: Some("aien-dev/aienux"), |
| 69 | receipt_url: Some("https://interplane.io/drakestapleton/aienux"), |
| 70 | }, |
| 71 | LayerState { |
| 72 | name: "Atlas, the awakening layer", |
| 73 | status: "PLANNED", |
| 74 | note: "The seed that wakes AienOS on new hardware. Doctrine published in the architecture repository; implementation ahead.", |
| 75 | receipt_label: Some("aien-architecture"), |
| 76 | receipt_url: None, |
| 77 | }, |
| 78 | LayerState { |
| 79 | name: "Public release", |
| 80 | status: "EXPERIMENTAL", |
| 81 | note: "Alpha testing for Linux arm64 and NVIDIA GB10. The side-by-side Omega installer is experimental. Its engine is byte for byte the 35B build my Spark served until that model was retired on 2026-11-06; nothing serves it now. A real install from this installer through first token and three-pass physical qualification are NOT_RUN. Inspect versions, hashes, signatures and limits before running.", |
| 82 | receipt_label: Some("Alpha release and evidence"), |
| 83 | receipt_url: Some("https://interplane.io/drakestapleton/sovereign-intelligence/tree/alpha-20261026.2"), |
| 84 | }, |
| 85 | ] |
| 86 | } |
| 87 | |
| 88 | fn chip_style(status: &str) -> &'static str { |
| 89 | match status { |
| 90 | "QUALIFIED" => "border: 1px solid rgba(0, 229, 153, 0.4); color: var(--accent-green); background: rgba(0, 229, 153, 0.08);", |
| 91 | "IMPLEMENTED" => "border: 1px solid rgba(45, 127, 249, 0.4); color: var(--accent-blue); background: rgba(45, 127, 249, 0.08);", |
| 92 | "EXPERIMENTAL" => "border: 1px solid rgba(245, 158, 11, 0.4); color: #f5a623; background: rgba(245, 158, 11, 0.08);", |
| 93 | "BLOCKED" => "border: 1px solid rgba(248, 113, 113, 0.4); color: #f87171; background: rgba(248, 113, 113, 0.08);", |
| 94 | _ => "border: 1px solid var(--border-subtle); color: var(--text-muted); background: var(--bg-surface);", |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | pub fn render_status(facts: &Facts) -> Markup { |
| 99 | let layers = layer_states(); |
| 100 | |
| 101 | html! { |
| 102 | section id="status" style="padding: 80px 0; border-bottom: 1px solid var(--border-subtle);" { |
| 103 | div class="container" { |
| 104 | div style="max-width: 760px; margin-bottom: 36px;" { |
| 105 | div class="badge badge-amber" style="margin-bottom: 12px;" { |
| 106 | "CANONICAL PROJECT STATE" |
| 107 | } |
| 108 | h2 style="font-size: 32px; font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary);" { |
| 109 | "Where it honestly stands" |
| 110 | } |
| 111 | p style="color: var(--text-secondary); margin-top: 8px; line-height: 1.6;" { |
| 112 | "One state of the project, published once and consumed everywhere. This section, " |
| 113 | a href="/status.json" style="color: var(--accent-green); font-weight: 600;" { "status.json" } |
| 114 | ", and " |
| 115 | a href="/llms.txt" style="color: var(--accent-green); font-weight: 600;" { "llms.txt" } |
| 116 | " all render from the same source, so they cannot drift apart. Last updated " (UPDATED) "." |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | div style="display: flex; flex-direction: column;" { |
| 121 | @for layer in &layers { |
| 122 | div class="status-row" style="display: flex; gap: 20px; padding: 18px 0; border-top: 1px solid var(--border-subtle); align-items: flex-start; flex-wrap: wrap;" { |
| 123 | span class="badge" style=(format!("font-size: 10px; min-width: 118px; justify-content: center; {}", chip_style(layer.status))) { |
| 124 | (layer.status) |
| 125 | } |
| 126 | div style="flex: 1; min-width: 260px;" { |
| 127 | div style="font-weight: 700; color: var(--text-primary); font-size: 16px;" { |
| 128 | (super::omega::link_first(layer.name)) |
| 129 | } |
| 130 | p style="color: var(--text-secondary); font-size: 14.5px; line-height: 1.6; margin: 4px 0 0 0;" { |
| 131 | (layer.note) |
| 132 | } |
| 133 | @match (layer.receipt_label, layer.receipt_url) { |
| 134 | (Some(label), Some(url)) => { |
| 135 | div style="margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);" { |
| 136 | "RECEIPT " (label) (crate::forge::receipt_code(url)) |
| 137 | } |
| 138 | (foot(url, Target::Evidence)) |
| 139 | } |
| 140 | (Some(label), None) => { |
| 141 | // A receipt with no Radicle copy: named, never linked. |
| 142 | div style="margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);" { |
| 143 | "RECEIPT " code { (label) } |
| 144 | } |
| 145 | (foot(&source_href(THIS_FILE), Target::Source)) |
| 146 | } |
| 147 | _ => { |
| 148 | div style="margin-top: 6px; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted);" { |
| 149 | "No receipt yet: there is nothing to show until a release exists." |
| 150 | } |
| 151 | (foot(&source_href(THIS_FILE), Target::Source)) |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // The live readings are a second idea; they open on request. |
| 160 | details class="status-live" style="margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border-subtle);" { |
| 161 | summary style="cursor: pointer; font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary);" { "Live readings from the machines" } |
| 162 | (super::live::render_live(facts)) |
| 163 | } |
| 164 | |
| 165 | div style="display: flex; gap: 12px; flex-wrap: wrap; margin-top: 32px;" { |
| 166 | a href="https://interplane.io/drakestapleton" target="_blank" rel="noopener noreferrer" style="background: var(--accent-green); color: var(--bg-base); border-radius: 4px; padding: 10px 20px; font-family: var(--font-mono); font-size: 13px; font-weight: 700;" { |
| 167 | "Follow the work on the forge" |
| 168 | } |
| 169 | a href="#research" style="background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-subtle); border-radius: 4px; padding: 10px 20px; font-family: var(--font-mono); font-size: 13px; font-weight: 600;" { |
| 170 | "Read the research" |
| 171 | } |
| 172 | a href="#follow" style="background: transparent; color: var(--text-secondary); border: 1px solid var(--border-subtle); border-radius: 4px; padding: 10px 20px; font-family: var(--font-mono); font-size: 13px; font-weight: 600;" { |
| 173 | "Follow the work" |
| 174 | } |
| 175 | } |
| 176 | } |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | fn json_escape(s: &str) -> String { |
| 182 | s.replace('\\', "\\\\") |
| 183 | .replace('"', "\\\"") |
| 184 | .replace('\n', "\\n") |
| 185 | } |
| 186 | |
| 187 | /// The same canonical state as /status.json, for machines, badges, |
| 188 | /// external agents, and eventually AIEN itself. |
| 189 | pub fn status_json() -> String { |
| 190 | let layers = layer_states(); |
| 191 | let mut out = String::new(); |
| 192 | out.push_str("{\n"); |
| 193 | out.push_str(" \"project\": \"AIENOS\",\n"); |
| 194 | out.push_str(&format!(" \"updated\": \"{}\",\n", UPDATED)); |
| 195 | out.push_str(" \"canonical\": \"https://www.aienos.com/#status\",\n"); |
| 196 | out.push_str(" \"statuses\": [\"IMPLEMENTED\", \"QUALIFIED\", \"EXPERIMENTAL\", \"BLOCKED\", \"PLANNED\"],\n"); |
| 197 | out.push_str(" \"layers\": [\n"); |
| 198 | for (i, layer) in layers.iter().enumerate() { |
| 199 | let receipt = match (layer.receipt_url, layer.receipt_label) { |
| 200 | (Some(url), _) => format!("\"{}\"", json_escape(url)), |
| 201 | (None, Some(label)) => format!("\"{}\"", json_escape(label)), |
| 202 | (None, None) => "null".to_string(), |
| 203 | }; |
| 204 | let comma = if i + 1 < layers.len() { "," } else { "" }; |
| 205 | out.push_str(&format!( |
| 206 | " {{\"name\": \"{}\", \"status\": \"{}\", \"note\": \"{}\", \"receipt\": {}}}{}\n", |
| 207 | json_escape(layer.name), |
| 208 | layer.status, |
| 209 | json_escape(layer.note), |
| 210 | receipt, |
| 211 | comma |
| 212 | )); |
| 213 | } |
| 214 | out.push_str(" ]\n}\n"); |
| 215 | out |
| 216 | } |
| 217 | |
| 218 | /// /llms.txt: the project in plain text for AI readers and crawlers, in |
| 219 | /// the llms.txt convention (see `seo::llms_txt`), with the layer states. |
| 220 | pub fn llms_txt() -> String { |
| 221 | let lines: Vec<String> = layer_states() |
| 222 | .iter() |
| 223 | .map(|l| { |
| 224 | let target = l.receipt_url.unwrap_or("https://www.aienos.com/status.json"); |
| 225 | format!("[{}]({}): {}. {}", l.name, target, l.status, l.note) |
| 226 | }) |
| 227 | .collect(); |
| 228 | crate::seo::llms_txt(&lines, &rs::current_level_sentence()) |
| 229 | } |
| 230 | |
| 231 | #[cfg(test)] |
| 232 | mod wording_tests { |
| 233 | use super::*; |
| 234 | |
| 235 | const STALE: [&str; 5] = [ |
| 236 | "in preparation", |
| 237 | "profile holds", |
| 238 | "yield log", |
| 239 | "actually understood", |
| 240 | "first unit written down", |
| 241 | ]; |
| 242 | |
| 243 | fn stale_hit(text: &str) -> Option<&'static str> { |
| 244 | STALE.iter().copied().find(|s| text.contains(s)) |
| 245 | } |
| 246 | |
| 247 | #[test] |
| 248 | fn experiments_note_follows_the_status_file() { |
| 249 | let layers = layer_states(); |
| 250 | let l = layers |
| 251 | .iter() |
| 252 | .find(|l| l.name.starts_with("Turing experiments")) |
| 253 | .expect("experiments layer present"); |
| 254 | for want in ["EXP-001 FAIL", "EXP-001R PASS", "EXP-002D INCOMPLETE", "EXP-003 BLOCKED", "Failures stay on the record"] { |
| 255 | assert!(l.note.contains(want), "missing: {want}"); |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | #[test] |
| 260 | fn every_layer_row_links_to_interplane() { |
| 261 | let mut facts = Facts::default(); |
| 262 | facts.receipt.repo = "aien-dev/aien-sovereign-core-mv".into(); |
| 263 | let page = render_status(&facts).into_string(); |
| 264 | let rows = page.matches("class=\"status-row\"").count(); |
| 265 | assert_eq!(rows, layer_states().len()); |
| 266 | // The receipt aside and the live rows render too; count only up to the live block. |
| 267 | let before_live = page.split("id=\"live\"").next().unwrap(); |
| 268 | assert_eq!(crate::components::boxlink::check_boxes(before_live), Ok(rows), "every layer row links to the forge"); |
| 269 | assert_eq!(before_live.matches("box-link-source").count(), 4, "the four receipts with no Radicle copy link this file"); |
| 270 | assert!(before_live.contains("RECEIPT <code>omega PR #111</code>") && !before_live.contains("github.com")); |
| 271 | } |
| 272 | |
| 273 | #[test] |
| 274 | fn published_status_has_no_stale_wording() { |
| 275 | assert_eq!(stale_hit(&(status_json() + &llms_txt())), None); |
| 276 | } |
| 277 | |
| 278 | #[test] |
| 279 | fn counterexample_stale_wording_is_caught() { |
| 280 | assert_eq!(stale_hit("how much a machine actually understood"), Some("actually understood")); |
| 281 | assert_eq!(stale_hit("Measurement profiles in preparation"), Some("in preparation")); |
| 282 | } |
| 283 | |
| 284 | // Repo-wide stale scan. Mirrors the receipt grep (phrases below, skips |
| 285 | // target, node_modules, .git, dist and *.tex). The only exclusion is the |
| 286 | // named source file, by path. Content is never used to exclude a hit. |
| 287 | const REPO_STALE: [&str; 2] = ["actually understood", "first unit written down"]; |
| 288 | |
| 289 | // Every pattern on a line is reported, so two stale phrases on one line |
| 290 | // count as two hits. |
| 291 | fn line_is_stale(line: &str) -> Vec<String> { |
| 292 | let mut out: Vec<String> = REPO_STALE |
| 293 | .iter() |
| 294 | .filter(|s| line.contains(**s)) |
| 295 | .map(|s| (*s).to_string()) |
| 296 | .collect(); |
| 297 | // The stale claim is the TY-2 gain figure presented as Turing yield. |
| 298 | // Checked per sentence (split on ". "), in either order, so a sentence |
| 299 | // that gives the gain and a later sentence saying yield is not yet |
| 300 | // measured is honest, while "Turing yield of 2,559,679" and |
| 301 | // "2,559,679.825 bits of Turing yield" are caught. |
| 302 | if line |
| 303 | .split(". ") |
| 304 | .any(|s| s.contains("Turing yield") && s.contains("2,559,679")) |
| 305 | { |
| 306 | out.push("Turing yield.*2,559,679".to_string()); |
| 307 | } |
| 308 | out |
| 309 | } |
| 310 | |
| 311 | #[test] |
| 312 | fn yield_claim_is_caught_per_sentence() { |
| 313 | // Stale claims, either order, one sentence: caught. |
| 314 | for bad in [ |
| 315 | "a Turing yield of 2,559,679 bits", |
| 316 | "2,559,679.825 bits of Turing yield", |
| 317 | "Turing yield: +2,559,679.825 T/J under profile V0.", |
| 318 | "Gain recorded. The Turing yield was 2,559,679.825 T.", |
| 319 | ] { |
| 320 | assert_eq!(line_is_stale(bad), vec!["Turing yield.*2,559,679".to_string()], "{bad}"); |
| 321 | } |
| 322 | // Honest wording from the research page (lines 95 and 218): gain |
| 323 | // figure and the "yield not yet measured" note are separate sentences. |
| 324 | for ok in [ |
| 325 | "<p>The empirical-results section records the first canonical measurement: TY-1+TY-2 PASS, +2,559,679.825 T under measurement profile V0 (omega PR #85, 2026-09-29). What it does not claim: Turing yield (T/J) is not yet measured; joining energy measurements to Turing-gain receipts is the next step.</p>", |
| 326 | "Version 1.0 reports the first canonical Turing measurement: TY-1+TY-2 PASS, +2,559,679.825 T under measurement profile V0 (omega PR #85, 2026-09-29). Turing yield in T/J is not yet reported; joining energy measurements to Turing-gain receipts is the next step.", |
| 327 | ] { |
| 328 | assert!(line_is_stale(ok).is_empty(), "{ok}"); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | // Exact-path match after resolving "..", so a root such as |
| 333 | // "crates/site-builder/../.." still matches the skipped file. |
| 334 | fn same_file(a: &std::path::Path, b: &std::path::Path) -> bool { |
| 335 | match (a.canonicalize(), b.canonicalize()) { |
| 336 | (Ok(x), Ok(y)) => x == y, |
| 337 | _ => false, |
| 338 | } |
| 339 | } |
| 340 | |
| 341 | // Scans text files; returns Err on any directory or file read error |
| 342 | // (non-UTF-8 binary files such as png are the only thing not read as text). |
| 343 | // `scanned` records every text file actually read. |
| 344 | fn scan_tree( |
| 345 | dir: &std::path::Path, |
| 346 | skip: &[std::path::PathBuf], |
| 347 | hits: &mut Vec<String>, |
| 348 | scanned: &mut Vec<std::path::PathBuf>, |
| 349 | ) -> Result<(), String> { |
| 350 | let rd = std::fs::read_dir(dir).map_err(|e| format!("read_dir {}: {e}", dir.display()))?; |
| 351 | for e in rd { |
| 352 | let e = e.map_err(|e| format!("entry in {}: {e}", dir.display()))?; |
| 353 | let p = e.path(); |
| 354 | let name = e.file_name().to_string_lossy().to_string(); |
| 355 | if p.is_dir() { |
| 356 | if ["target", "node_modules", ".git", "dist"].contains(&name.as_str()) { |
| 357 | continue; |
| 358 | } |
| 359 | scan_tree(&p, skip, hits, scanned)?; |
| 360 | } else if p.extension().map_or(false, |x| x == "tex") { |
| 361 | continue; |
| 362 | } else if skip.iter().any(|s| same_file(s, &p)) { |
| 363 | continue; |
| 364 | } else { |
| 365 | match std::fs::read_to_string(&p) { |
| 366 | Ok(text) => { |
| 367 | scanned.push(p.clone()); |
| 368 | for (i, line) in text.lines().enumerate() { |
| 369 | for w in line_is_stale(line) { |
| 370 | hits.push(format!("{}:{}: {}", p.display(), i + 1, w)); |
| 371 | } |
| 372 | } |
| 373 | } |
| 374 | Err(err) if err.kind() == std::io::ErrorKind::InvalidData => {} |
| 375 | Err(err) => return Err(format!("read {}: {err}", p.display())), |
| 376 | } |
| 377 | } |
| 378 | } |
| 379 | Ok(()) |
| 380 | } |
| 381 | |
| 382 | #[test] |
| 383 | fn repo_has_no_stale_wording_outside_this_source_file() { |
| 384 | let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../.."); |
| 385 | let me = std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("src/components/status.rs"); |
| 386 | let mut hits = Vec::new(); |
| 387 | let mut scanned = Vec::new(); |
| 388 | scan_tree(&root, &[me], &mut hits, &mut scanned).expect("scan must read every directory and file"); |
| 389 | check_floor(&root, &scanned).expect("scan floor"); |
| 390 | assert!(hits.is_empty(), "stale wording: {hits:?}"); |
| 391 | } |
| 392 | |
| 393 | fn check_floor(root: &std::path::Path, scanned: &[std::path::PathBuf]) -> Result<(), String> { |
| 394 | if scanned.is_empty() { |
| 395 | return Err("scan read zero files".into()); |
| 396 | } |
| 397 | for must in ["AGENTS.md", "public/turing/index.html", "public/research/index.html"] { |
| 398 | let want = root.join(must).canonicalize().ok(); |
| 399 | if !scanned.iter().any(|p| p.canonicalize().ok() == want) { |
| 400 | return Err(format!("required page not scanned: {must}")); |
| 401 | } |
| 402 | } |
| 403 | Ok(()) |
| 404 | } |
| 405 | |
| 406 | #[test] |
| 407 | fn counterexample_empty_or_missing_directory_fails() { |
| 408 | let missing = std::env::temp_dir().join(format!("stalegrep-missing-{}", std::process::id())); |
| 409 | let mut hits = Vec::new(); |
| 410 | let mut scanned = Vec::new(); |
| 411 | assert!(scan_tree(&missing, &[], &mut hits, &mut scanned).is_err()); |
| 412 | let empty = std::env::temp_dir().join(format!("stalegrep-empty-{}", std::process::id())); |
| 413 | std::fs::create_dir_all(&empty).unwrap(); |
| 414 | let r = scan_tree(&empty, &[], &mut hits, &mut scanned); |
| 415 | let _ = std::fs::remove_dir_all(&empty); |
| 416 | assert!(r.is_ok()); |
| 417 | assert!(check_floor(&empty, &scanned).is_err(), "empty scan must fail the floor"); |
| 418 | } |
| 419 | |
| 420 | #[test] |
| 421 | fn counterexample_quoted_phrase_in_public_page_is_caught() { |
| 422 | let d = std::env::temp_dir().join(format!("stalegrep-{}", std::process::id())); |
| 423 | let public = d.join("public"); |
| 424 | std::fs::create_dir_all(&public).unwrap(); |
| 425 | let page = public.join("x.html"); |
| 426 | let src = d.join("status.rs"); |
| 427 | std::fs::write(&page, "<p>\"Turing yield of 2,559,679\" and \"actually understood\"</p>\n").unwrap(); |
| 428 | std::fs::write(&src, "const A: &str = \"first unit written down\";\n").unwrap(); |
| 429 | let mut hits = Vec::new(); |
| 430 | let mut scanned = Vec::new(); |
| 431 | scan_tree(&d, &[src.clone()], &mut hits, &mut scanned).unwrap(); |
| 432 | // Same tree through a ".." root, as the repo test uses: the exclusion |
| 433 | // must still hold and the page must still be caught. |
| 434 | let mut hits2 = Vec::new(); |
| 435 | let mut scanned2 = Vec::new(); |
| 436 | scan_tree(&public.join(".."), &[src.clone()], &mut hits2, &mut scanned2).unwrap(); |
| 437 | // Without the exclusion the source file is caught as well. |
| 438 | let mut hits3 = Vec::new(); |
| 439 | let mut scanned3 = Vec::new(); |
| 440 | scan_tree(&d, &[], &mut hits3, &mut scanned3).unwrap(); |
| 441 | let _ = std::fs::remove_dir_all(&d); |
| 442 | assert_eq!(hits.len(), 2, "{hits:?}"); |
| 443 | assert!(hits.iter().all(|h| h.contains("x.html")), "{hits:?}"); |
| 444 | assert_eq!(hits2.len(), 2, "{hits2:?}"); |
| 445 | assert!(hits2.iter().all(|h| h.contains("x.html")), "{hits2:?}"); |
| 446 | assert_eq!(hits3.len(), 3, "{hits3:?}"); |
| 447 | } |
| 448 | } |