interplane.Get Omega
Read in your language

aienos.com

Source of www.aienos.com, served from my own hardware

Brought by drakestapleton

branch main Branches Tags History

aienos.com / crates / site-builder / src / components / hubs.rs

502 lines · 23877 bytes Raw Blame History
1//! Section hub pages: /experiments/, /evidence/, /philosophy/ (NARR-NAV).
2//!
3//! Short generated pages that share the site header and footer through
4//! `render_page_layout`. No status word is written in this file. The
5//! experiments hub renders its ladder and cards from the canonical status
6//! source (`research_status`, data/research_status.json); the other hubs
7//! carry no status values at all and only link to that record.
8
9use std::fs;
10use std::path::Path;
11
12use maud::{html, Markup};
13
14use crate::components::boxlink::{foot, source_dir_href, source_href, Target};
15use crate::components::research_status as rs;
16use crate::layouts::base::render_page_layout;
17
18/// The paper's folder in this repository, where its artifacts live.
19const PAPER_SOURCE: &str = "public/research/computing-machinery-and-understanding";
20/// The data file behind the research status record.
21const STATUS_DATA_FILE: &str = "crates/site-builder/data/research_status.json";
22/// This file, for a card whose text has no other home on the forge.
23const THIS_FILE: &str = "crates/site-builder/src/components/hubs.rs";
24
25const PAPER: &str = "/research/computing-machinery-and-understanding/";
26const QUALIFICATION_RECORD: &str =
27 "https://interplane.io/drakestapleton/omega-mv/blob/main/docs/turing/TURING_SCIENTIFIC_QUALIFICATION_STATE.md";
28const STATUS_PAGE: &str = "/research/status/";
29const STATUS_JSON: &str = "/research-status.json";
30
31/// Markup each hub must carry. verify_hub_pages and the tests check it.
32pub const EXPERIMENTS_SLOT: &str = "<section id=\"experiment-cards\"";
33/// The wrapper render_cards emits around the experiment cards.
34pub const CARDS_MARKUP: &str = "<div class=\"rs-cards\">";
35/// The full-record button on the experiments hub.
36pub const STATUS_BUTTON: &str = "<a class=\"hub-button\" href=\"/research/status/\">";
37pub const EVIDENCE_PHRASE: &str = "Failure is evidence.";
38pub const STATUS_PAGE_LINK: &str = "href=\"/research/status/\"";
39pub const STATUS_JSON_LINK: &str = "href=\"/research-status.json\"";
40pub const PHILOSOPHY_PHRASE: &str = "Position, not evidence";
41
42/// Where a hub's status values come from.
43#[derive(Clone, Copy, PartialEq, Eq, Debug)]
44pub enum StatusSource {
45 /// Every status on the page is rendered from research_status data.
46 Data,
47 /// The page shows no status values at all.
48 Absent,
49}
50
51pub struct Hub {
52 pub slug: &'static str,
53 pub title: &'static str,
54 pub description: &'static str,
55 pub required: &'static [&'static str],
56 pub status: StatusSource,
57 pub render: fn() -> Markup,
58}
59
60pub static HUBS: [Hub; 3] = [
61 Hub {
62 slug: "experiments",
63 title: "Experiments | AienOS",
64 description: "Every experiment on the Aien research ladder, failures included, rendered from one canonical status source.",
65 required: &[EXPERIMENTS_SLOT, CARDS_MARKUP, STATUS_BUTTON],
66 status: StatusSource::Data,
67 render: render_experiments_hub,
68 },
69 Hub {
70 slug: "evidence",
71 title: "Evidence | AienOS",
72 description: "What counts as evidence for Aien, which source wins when two disagree, and where to inspect the receipts, frozen profiles and status records.",
73 required: &[EVIDENCE_PHRASE, STATUS_PAGE_LINK, STATUS_JSON_LINK],
74 status: StatusSource::Absent,
75 render: render_evidence_hub,
76 },
77 Hub {
78 slug: "philosophy",
79 title: "Philosophy | AienOS",
80 description: "Position papers behind Aien: the Stapleton Doctrine and the Case for Verified Learning. These argue a stance and are not experimental results.",
81 required: &[PHILOSOPHY_PHRASE],
82 status: StatusSource::Absent,
83 render: render_philosophy_hub,
84 },
85];
86
87pub fn render_experiments_hub() -> Markup {
88 let d = rs::data();
89 html! {
90 div class="container hub-wrap hub-wrap-wide" {
91 p class="hub-kicker" { "Experiments" }
92 h1 class="hub-title" { "Experiments" }
93 p class="hub-standfirst" {
94 "Every experiment on the Aien research ladder, with its scope, its receipt and its outcome, failures included. Everything below is rendered from one data file, so this page cannot drift from the record."
95 }
96 section class="hub-data" aria-labelledby="experiments-ladder" {
97 h2 id="experiments-ladder" class="hub-h2" { "Where the research stands" }
98 (rs::render_research_status_summary())
99 }
100 section id="experiment-cards" class="hub-data" data-source="research_status.json" aria-labelledby="experiment-cards-title" {
101 h2 id="experiment-cards-title" class="hub-h2" { "Experiment cards" }
102 p class="hub-lede" {
103 "One card per result. The badge is the verdict; the lines below say what it covers, what it does not, and what it waits on."
104 }
105 (rs::render_cards(d))
106 p class="hub-data-foot" {
107 a class="hub-button" href=(STATUS_PAGE) { "Open the full research status record" }
108 }
109 }
110 section class="hub-section" aria-labelledby="experiments-more" {
111 h2 id="experiments-more" class="hub-h2" { "Check it yourself" }
112 p {
113 "An experiment is frozen before it is scored, and its record stays public whatever the outcome. The same record is published as "
114 a href=(STATUS_JSON) { "machine-readable data" }
115 ", the protocols sit with the "
116 a href=(PAPER) { "Turing paper" }
117 ", and the "
118 a href="/evidence/" { "Evidence" }
119 " page explains which sources count and where to find them."
120 }
121 }
122 }
123 }
124}
125
126pub fn render_evidence_hub() -> Markup {
127 let ladder: [(&str, &str); 7] = [
128 ("Code", "The source that actually runs."),
129 ("Tests", "Checks that run the code and are able to fail."),
130 ("Receipts", "Hashed records of a specific run and what it produced."),
131 ("Frozen profiles", "Experiment protocols fixed before any scoring happens."),
132 ("Qualification records", "The running ledger of what has qualified, and in what scope."),
133 ("Current docs", "Design notes and plans. They describe intent."),
134 ("Website prose", "Including this page. The weakest source on the list."),
135 ];
136 let artifacts: [(&str, &str, String, String); 5] = [
137 ("SHA256SUMS", "Checksums for every published artifact of the Turing paper.", format!("{PAPER}SHA256SUMS"), source_href(&format!("{PAPER_SOURCE}/SHA256SUMS"))),
138 ("EXP-001 frozen profile", "The protocol for EXP-001, as frozen before scoring.", format!("{PAPER}profiles/EXP-001.json"), source_href(&format!("{PAPER_SOURCE}/profiles/EXP-001.json"))),
139 ("EXP-002 frozen profile", "The protocol for EXP-002, as frozen before scoring.", format!("{PAPER}profiles/EXP-002.json"), source_href(&format!("{PAPER_SOURCE}/profiles/EXP-002.json"))),
140 ("EXP-003 frozen profile", "The protocol for EXP-003, as published.", format!("{PAPER}profiles/EXP-003.json"), source_href(&format!("{PAPER_SOURCE}/profiles/EXP-003.json"))),
141 ("The Turing paper (PDF)", "Definitions, proofs, measurement protocol, and falsification criteria.", format!("{PAPER}paper.pdf"), source_href(&format!("{PAPER_SOURCE}/paper.pdf"))),
142 ];
143 html! {
144 div class="container hub-wrap" {
145 p class="hub-kicker" { "Evidence" }
146 h1 class="hub-title" { "Evidence" }
147 p class="hub-standfirst" {
148 "Every claim on this site should trace back to something you can inspect yourself. When two sources disagree, the one higher on this list wins."
149 }
150 section class="hub-section" aria-labelledby="evidence-order" {
151 h2 id="evidence-order" class="hub-h2" { "What counts as evidence" }
152 ol class="hub-ladder" {
153 @for (name, what) in ladder {
154 li {
155 strong { (name) }
156 span { (what) }
157 }
158 }
159 }
160 p class="hub-note" { "Website prose never overrides code, tests, or receipts." }
161 }
162 section class="hub-section" aria-labelledby="evidence-where" {
163 h2 id="evidence-where" class="hub-h2" { "Where to inspect it" }
164 ul class="hub-cards" {
165 li class="hub-card" {
166 a href=(STATUS_PAGE) { "Research status record" }
167 p { "Every experiment with its verdict, receipt, scope and limits, plus the research ladder. Rendered from one data file." }
168 (foot(&source_href(STATUS_DATA_FILE), Target::Source))
169 }
170 li class="hub-card" {
171 a href=(STATUS_JSON) { "Research status data (JSON)" }
172 p { "The same record in machine-readable form: the file the status pages are built from." }
173 (foot(&source_href(STATUS_DATA_FILE), Target::Source))
174 }
175 @for (name, what, href, github) in &artifacts {
176 li class="hub-card" {
177 a href=(href) { (name) }
178 p { (what) }
179 (foot(github, Target::Evidence))
180 }
181 }
182 li class="hub-card" {
183 a href=(QUALIFICATION_RECORD) target="_blank" rel="noopener noreferrer" { "Omega qualification record" }
184 p { "The canonical record of what has qualified and in what scope, kept in the Omega repository on the forge." }
185 (foot(QUALIFICATION_RECORD, Target::Evidence))
186 }
187 }
188 }
189 section class="hub-section hub-callout" aria-labelledby="evidence-failure" {
190 h2 id="evidence-failure" class="hub-h2" { (EVIDENCE_PHRASE) }
191 p {
192 "Failed and incomplete experiments stay on the record. They are never deleted, hidden, or rewritten into success. A meter you cannot fail is not a meter."
193 }
194 }
195 }
196 }
197}
198
199pub fn render_philosophy_hub() -> Markup {
200 // Position papers have no evidence; each card links to the source of
201 // its text on the forge and says so.
202 let cards: [(&str, &str, &str, bool, String); 4] = [
203 (
204 "Intelligence should be owned",
205 "/owned/",
206 "Why a language model is a common inheritance, why running one yourself is a right and a responsibility, and what Aien does about it.",
207 false,
208 source_href("crates/site-builder/src/components/owned.rs"),
209 ),
210 (
211 "The Stapleton Doctrine",
212 "/research/the-stapleton-doctrine/",
213 "English is the conversation, not the language. The universal artifact is the verified program.",
214 false,
215 source_dir_href("public/research/the-stapleton-doctrine"),
216 ),
217 (
218 "The Case for Verified Learning",
219 "/post-llm-case/",
220 "A proposal for a learning machine that proposes programs, checks them, and keeps knowledge as inspectable programs.",
221 false,
222 source_dir_href("public/post-llm-case"),
223 ),
224 (
225 "Drake Stapleton on philosophy",
226 "/engineer/philosophy/",
227 "Longer essays on ownership, sovereignty, and how machines should earn trust, in About the engineer.",
228 false,
229 source_href(THIS_FILE),
230 ),
231 ];
232 html! {
233 div class="container hub-wrap" {
234 p class="hub-label hub-label-position" { (PHILOSOPHY_PHRASE) }
235 h1 class="hub-title" { "Philosophy" }
236 p class="hub-standfirst" {
237 "These pages argue a stance and are not experimental results. For what has been measured, see "
238 a href="/evidence/" { "Evidence" }
239 "."
240 }
241 section class="hub-section" aria-labelledby="philosophy-argument" {
242 h2 id="philosophy-argument" class="hub-h2" { "What these papers argue" }
243 p {
244 "The Stapleton Doctrine argues that the artifact worth keeping is the verified program, not the prompt or the fluent answer. English is the conversation. The program is the thing that can be checked, reused and composed."
245 }
246 p {
247 "The Case for Verified Learning proposes a machine that proposes programs, verifies them against held-out reality, and keeps what survives as inspectable structure."
248 }
249 p {
250 "These are positions, not measurements. The research status record and the evidence hub carry what has been tested. The philosophy pages state the stance behind the design, including where the design has not been established."
251 }
252 }
253 ul class="hub-cards" {
254 @for (name, href, what, external, github) in cards {
255 li class="hub-card" {
256 @if external {
257 a href=(href) target="_blank" rel="noopener noreferrer" { (name) }
258 } @else {
259 a href=(href) { (name) }
260 }
261 p { (what) }
262 (foot(&github, Target::Source))
263 }
264 }
265 }
266 }
267 }
268}
269
270fn render_hub_document(hub: &Hub) -> String {
271 render_page_layout(
272 hub.title,
273 hub.description,
274 &format!("https://www.aienos.com/{}/", hub.slug),
275 "website",
276 html! {},
277 (hub.render)(),
278 )
279 .into_string()
280}
281
282/// Writes every hub page to `<dist>/<slug>/index.html`.
283pub fn emit_hub_pages(dist: &Path) {
284 for hub in &HUBS {
285 let dir = dist.join(hub.slug);
286 fs::create_dir_all(&dir).unwrap_or_else(|_| panic!("Failed to create {}", dir.display()));
287 fs::write(dir.join("index.html"), render_hub_document(hub))
288 .unwrap_or_else(|_| panic!("Failed to write /{}/index.html", hub.slug));
289 println!(" [PAGE] Emitted /{}/ (index.html)", hub.slug);
290 }
291}
292
293/// Fails the build if a hub page is missing, lacks its required markup,
294/// lacks any of the six nav sections, contains an em or en dash, shows a
295/// status word on a hub that must carry none, or (for the data hub) misses
296/// a card for any row of the canonical status source.
297pub fn verify_hub_pages(dist: &Path) {
298 for hub in &HUBS {
299 let path = dist.join(hub.slug).join("index.html");
300 let page = fs::read_to_string(&path)
301 .unwrap_or_else(|_| panic!("Missing hub page {}", path.display()));
302 check_hub_document(hub, &page).unwrap_or_else(|e| panic!("{}: {e}", path.display()));
303 }
304}
305
306/// Where the shared site footer starts. The footer links the status record
307/// and its data on every page, so required links are checked before it.
308pub const FOOTER_START: &str = "<footer";
309
310/// The page before the shared footer: header, nav and the hub's own body.
311/// Required markup must be found here, so a link that only the footer
312/// carries does not satisfy a hub.
313fn hub_body(page: &str) -> &str {
314 page.split(FOOTER_START).next().unwrap_or(page)
315}
316
317fn check_hub_document(hub: &Hub, page: &str) -> Result<(), String> {
318 let body = hub_body(page);
319 for required in hub.required {
320 if !body.contains(required) {
321 return Err(format!("missing required markup {required:?}"));
322 }
323 }
324 if page.contains('\u{2014}') || page.contains('\u{2013}') {
325 return Err("forbidden em or en dash".to_string());
326 }
327 crate::components::boxlink::check_boxes(page)?;
328 crate::components::navbar::check_destinations(page)?;
329 match hub.status {
330 StatusSource::Absent => {
331 for status in rs::ALLOWED_STATUSES {
332 if page.contains(status) {
333 return Err(format!("status value {status} on a hub that must carry none"));
334 }
335 }
336 }
337 StatusSource::Data => {
338 for row in &rs::data().turing_rows {
339 let card = format!("data-row=\"{}\" data-status=\"{}\"", row.id, row.status);
340 if !page.contains(&card) {
341 return Err(format!("card for {} missing or not from data", row.id));
342 }
343 }
344 }
345 }
346 Ok(())
347}
348
349#[cfg(test)]
350mod tests {
351 use super::*;
352
353 fn doc(slug: &str) -> String {
354 let hub = HUBS.iter().find(|h| h.slug == slug).expect("hub registered");
355 render_hub_document(hub)
356 }
357
358 /// The part of a source file before its test module.
359 fn non_test_source(src: &str) -> &str {
360 src.split("#[cfg(test)]").next().unwrap_or(src)
361 }
362
363 #[test]
364 fn three_hubs_are_registered() {
365 let slugs: Vec<&str> = HUBS.iter().map(|h| h.slug).collect();
366 assert_eq!(slugs, ["experiments", "evidence", "philosophy"]);
367 }
368
369 #[test]
370 fn experiments_hub_renders_the_cards_from_data() {
371 let page = doc("experiments");
372 assert!(page.contains(EXPERIMENTS_SLOT), "experiment-cards section missing");
373 assert!(page.contains(CARDS_MARKUP), "render_cards markup missing");
374 assert!(page.contains("data-row=\"EXP-001\""), "EXP-001 card missing");
375 let d = rs::data();
376 let cards = rs::render_cards(d).into_string();
377 assert!(page.contains(&cards), "cards differ from research_status::render_cards");
378 for row in &d.turing_rows {
379 let card = format!("data-row=\"{}\" data-status=\"{}\"", row.id, row.status);
380 assert!(page.contains(&card), "card for {} missing", row.id);
381 }
382 }
383
384 #[test]
385 fn experiments_hub_embeds_the_ladder_and_links_the_full_record() {
386 let page = doc("experiments");
387 let body = hub_body(&page);
388 assert!(body.contains(&rs::render_research_status_summary().into_string()), "ladder summary missing");
389 assert!(body.contains(STATUS_BUTTON), "full record button missing");
390 assert!(body.contains(STATUS_JSON_LINK), "data file link missing outside the footer");
391 let ladder = page.find("experiments-ladder").expect("ladder section");
392 let cards = page.find(EXPERIMENTS_SLOT).expect("cards section");
393 assert!(ladder < cards, "ladder comes before the cards");
394 }
395
396 #[test]
397 fn evidence_hub_says_failure_is_evidence() {
398 let page = doc("evidence");
399 assert!(page.contains("Failure is evidence."), "required phrase missing");
400 assert!(page.contains("Failed and incomplete experiments stay on the record."));
401 assert!(page.contains(QUALIFICATION_RECORD), "qualification record link missing");
402 assert!(page.contains("SHA256SUMS"), "checksum link missing");
403 }
404
405 #[test]
406 fn evidence_hub_links_the_status_record_and_its_data() {
407 let page = doc("evidence");
408 assert!(page.contains(FOOTER_START), "footer missing, so the body check would be vacuous");
409 let body = hub_body(&page);
410 assert!(body.contains(STATUS_PAGE_LINK), "/research/status/ link missing outside the footer");
411 assert!(body.contains(STATUS_JSON_LINK), "/research-status.json link missing outside the footer");
412 }
413
414 #[test]
415 fn evidence_hierarchy_is_in_order() {
416 let page = doc("evidence");
417 let order = ["Code", "Tests", "Receipts", "Frozen profiles", "Qualification records", "Current docs", "Website prose"];
418 let mut last = 0usize;
419 for name in order {
420 let needle = format!("<strong>{name}</strong>");
421 let pos = page[last..]
422 .find(&needle)
423 .unwrap_or_else(|| panic!("evidence level {name} missing or out of order"));
424 last += pos + needle.len();
425 }
426 }
427
428 #[test]
429 fn philosophy_hub_is_labelled_position_not_evidence() {
430 let page = doc("philosophy");
431 assert!(page.contains("Position, not evidence"), "required label missing");
432 assert!(page.contains("are not experimental results"), "stance sentence missing");
433 for href in ["/research/the-stapleton-doctrine/", "/post-llm-case/", "/engineer/philosophy/"] {
434 assert!(page.contains(&format!("href=\"{href}\"")), "philosophy card {href} missing");
435 }
436 }
437
438 #[test]
439 fn every_hub_passes_the_build_check() {
440 for hub in &HUBS {
441 let page = render_hub_document(hub);
442 check_hub_document(hub, &page).unwrap_or_else(|e| panic!("/{}/: {e}", hub.slug));
443 }
444 }
445
446 #[test]
447 fn every_hub_card_links_to_the_forge() {
448 assert_eq!(crate::components::boxlink::check_boxes(&doc("evidence")), Ok(8), "two record cards, five artifacts, the qualification record");
449 assert_eq!(crate::components::boxlink::check_boxes(&doc("philosophy")), Ok(4));
450 let d = rs::data();
451 assert_eq!(crate::components::boxlink::check_boxes(&doc("experiments")), Ok(d.ladder.len() + d.turing_rows.len()));
452 let philosophy = doc("philosophy");
453 assert_eq!(philosophy.matches("box-link-source").count(), 4, "position papers are source links, not evidence");
454 assert!(check_hub_document(&HUBS[2], &philosophy.replacen("class=\"box-link box-link-source\"", "class=\"x\"", 1)).is_err());
455 }
456
457 #[test]
458 fn hubs_contain_no_em_or_en_dash() {
459 for hub in &HUBS {
460 let page = render_hub_document(hub);
461 assert!(!page.contains('\u{2014}'), "/{}/ contains an em dash", hub.slug);
462 assert!(!page.contains('\u{2013}'), "/{}/ contains an en dash", hub.slug);
463 }
464 }
465
466 #[test]
467 fn nav_and_hub_source_has_no_hand_written_status() {
468 let sources = [
469 ("hubs.rs", include_str!("hubs.rs")),
470 ("navbar.rs", include_str!("navbar.rs")),
471 ("footer.rs", include_str!("footer.rs")),
472 ];
473 for (name, src) in sources {
474 let body = non_test_source(src);
475 for status in rs::ALLOWED_STATUSES {
476 assert!(!body.contains(status), "{name} hand-writes the status word {status}");
477 }
478 }
479 }
480
481 #[test]
482 fn build_check_rejects_bad_pages() {
483 let evidence = &HUBS[1];
484 let page = render_hub_document(evidence);
485 assert!(check_hub_document(evidence, &page.replace("Failure is evidence.", "")).is_err());
486 // A status link that survives only in the footer does not count. The
487 // shared footer no longer links the data, so the test plants one there.
488 let footer = page.find(FOOTER_START).expect("footer present");
489 let (head, foot) = page.split_at(footer);
490 let open = foot.find('>').expect("footer tag closes") + 1;
491 let foot = format!("{}<a {STATUS_JSON_LINK}>data</a>{}", &foot[..open], &foot[open..]);
492 let unlinked = format!("{}{foot}", head.replace(STATUS_JSON_LINK, "href=\"/x\""));
493 assert!(foot.contains(STATUS_JSON_LINK), "footer still links the data");
494 assert!(check_hub_document(evidence, &unlinked).is_err());
495 assert!(check_hub_document(evidence, &format!("{page}\u{2014}")).is_err());
496 let status = rs::ALLOWED_STATUSES[0];
497 assert!(check_hub_document(evidence, &format!("{page}{status}")).is_err());
498 let experiments = &HUBS[0];
499 let page = render_hub_document(experiments);
500 assert!(check_hub_document(experiments, &page.replace("data-row=\"EXP-001\"", "data-row=\"X\"")).is_err());
501 }
502}