From 40c6e11ea06e3815265ebf30fd799ffb6af5710a Mon Sep 17 00:00:00 2001 From: OpenReplicant <122761100+OpenReplicant@users.noreply.github.com> Date: Fri, 27 Nov 2026 15:44:37 -0800 Subject: [PATCH] Site kit: external links in the header; funding on the queue and claim pages [nav] pages accepts { text, href }: absolute http(s) URLs and /paths stay as written (URLs get rel="noopener"), relative ones take --base. [funding] url_template and label add a "fund this" link. The queue and each claim's trial plan show a bar, price, share funded and a ready badge from queue.json, and nothing when a row has no price. Demo queue.json regenerated with the existing example funding.yaml. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01KhsqyyPmp7iKCkTFcXs6sh --- demos/research-loop/research/queue.json | 123 +++++++++++++++++++++++- site/README.md | 12 ++- site/config.toml | 4 + site/public/assets/style.css | 5 + site/src/components/Assessment.astro | 2 + site/src/components/Funding.astro | 20 ++++ site/src/layouts/Base.astro | 6 +- site/src/lib/config.mjs | 38 +++++++- site/src/lib/data.mjs | 1 + site/src/pages/queue.astro | 2 + tests/test_site.py | 68 ++++++++++++- 11 files changed, 267 insertions(+), 14 deletions(-) create mode 100644 site/src/components/Funding.astro diff --git a/demos/research-loop/research/queue.json b/demos/research-loop/research/queue.json index cfd7e9c..7677ce4 100644 --- a/demos/research-loop/research/queue.json +++ b/demos/research-loop/research/queue.json @@ -1,7 +1,7 @@ { "system": "system:default/metasoar", "date": "2026-11-27", - "how": "score = bits of information in the outcome, H(p_transfer), times 2 if prioritised by steering, divided by the trial's cost in hours; rejected or uncosted claims have no score", + "how": "score = bits of information in the outcome, H(p_transfer), times 2 if prioritised by steering, times 1 + 3 x the fraction funded (research/funding.yaml: pledged plus received over the trial's cost at rate_per_hour, at most 1), divided by the trial's cost in hours; rejected or uncosted claims have no score. ready: received covers the whole cost; those come first", "queue": [ { "claim": "pd-program-beats-ppo", @@ -15,7 +15,14 @@ "prioritised_by": [], "rejected_by": [], "disputed_by": [], - "score": 0.9341, + "score": 1.868, + "currency": "USD", + "cost_money": 12.0, + "pledged": 4.0, + "received": 0.0, + "funded_fraction": 0.3333, + "funding_source": "example: GitHub Sponsors, one-time, ref EXAMPLE-1", + "ready": false, "reason": "The mechanism is the handler ladder's top rung, so the question is whether it carries over, not whether it applies. Against it: the teachers are frontier API models, our handler writer is Inkling 2 Mini at Q4_K; the score is an environment reward on control tasks, our handlers are scored by agreement with the large model on table questions; E-17b's handlers lost 5.3 points on fresh cases. For it: E-17 to E-17d show that handlers written by Inkling do answer many cases with no model. The claim is held to transfer if a program revised against scores beats the large model per case on cost at no loss of accuracy, which E-18 is testing." }, { @@ -31,6 +38,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.4855, + "currency": "USD", + "cost_money": 24.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A property of revising a program against a score, which E-18's handler writing also does (up to 4 tries a class, each after 3 more labels). Different models and task, but the claim is about the shape of the curve, which is less tied to model size than the score is. If it holds, a class needs one good rewrite, not many." }, { @@ -46,6 +60,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.4855, + "currency": "USD", + "cost_money": 24.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "The handler ladder already has routes (handler, template, large model) and E-18's falsifier depends on the cheap ones being right on different cases from where they fail. Complementarity between a program and direct reading is likely at any model size, since programs fail on grounding and models on arithmetic, as the paper finds. Our tables are short, where the gap may be smaller than on WTQ-L." }, { @@ -61,6 +82,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.3114, + "currency": "USD", + "cost_money": 36.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "Our own gates point the same way: in E-04b and E-04c a learned front (logistic, TabICL, embeddings) was no better than d1-2B's own confidence. The setting differs (coding agents, an outcome check, an oracle router), but the claim, that a learned router adds little over a simple signal, has already held twice here." }, { @@ -76,6 +104,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.25, + "currency": "USD", + "cost_money": 48.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A second, independent paper on the same option (see tablerouter-statistics-double-accuracy), and on WTQ itself. The gain is small for large models; for our smaller ones it may be larger, but that is the other paper's evidence, not this one's." }, { @@ -91,6 +126,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.2482, + "currency": "USD", + "cost_money": 48.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "Our template rung has LFM3 1.7B follow a plan over the table, and E-17c's two shuffle errors were LFM3 reading a table by row position: the kind of evidence-use failure the statistics fix. The models here are 7B to 9B and ours smaller, which the paper's own gradient (largest gain for the weaker models) favours. Against it: WTQ's tables are short, the 45 questions were picked so the statistics help, and many WTQ questions are lookups." }, { @@ -106,6 +148,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.1655, + "currency": "USD", + "cost_money": 72.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "E-18 rewrites a class's handler up to 4 times; whether each try sees the earlier failed replies or starts fresh from the best handler is a choice we have not measured. The gain is small (3.6%) and from one model on control tasks, single runs, so it may not survive our noise; a fresh context also suits a small local model whose context fills quickly." }, { @@ -121,6 +170,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.1102, + "currency": "USD", + "cost_money": 96.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "The gate escalates on an outcome check, as E-16 (Haiku to Opus on outcome triggers) and the handler ladder's fallback do. But its check is a test suite, which says whether an answer is right; our checks (type, choices, non-answers) only say whether it is well formed, and E-17b showed a weak check lets wrong cheap answers through. Our models are 1.7B to Inkling 2 Mini, not 30B and 355B. It would transfer where a task brings its own check: E-16's recorded tasks with their own checks." }, { @@ -136,6 +192,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.0507, + "currency": "USD", + "cost_money": 192.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "The same dataset as E-18 and the same evaluator, which is rare. But the base models are 70B or an API model, ours 1.7B to Inkling 2 Mini at Q4_K; the gain on WikiTQ is 2.1 points, small enough to vanish in our noise; and the method is several calls a question, where ours aims at none. Code is not yet released." }, { @@ -151,6 +214,13 @@ "rejected_by": [], "disputed_by": [], "score": 0.0361, + "currency": "USD", + "cost_money": 240.0, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A real held-out evaluation, which counts for it; but its gain comes from tables far beyond the context window, and E-18's WikiTableQuestions tables fit in Inkling's and LFM3's context whole. Our role sees little of what it fixes. Kept for the day the system meets long tables." }, { @@ -166,6 +236,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "The collapse was task-dependent on an 8B model, and nothing about a smaller one makes a typed question about its own thinking more reliable. This is the observer the note says has the weakest evidence, so E-04 puts it last." }, { @@ -181,6 +258,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A property of temperature scaling, not of the model's size, so it should hold here. E-04a fits one temperature per slice and left BANKING77 (77 options) out, so it neither tests nor depends on it yet; it matters as soon as one temperature is shared across tasks with different option counts." }, { @@ -196,6 +280,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A limit of one forward pass, not of model size, so it should hold for a small model too. Consistent but not a test: E-04a's untuned readout was already far below Jev on MedQA, MedMCQA and MMLU-Pro." }, { @@ -211,6 +302,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "A failure out of distribution is a property of training on few labels, not of the answering model, so it should hold here; E-04 is to separate slices in and out of the training distribution for this reason." }, { @@ -226,6 +324,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "The method does not depend on our generative models: BGE-small and logistic regression run cheaply on any hardware, so the conditions that differ are only the tasks and the labels. Against it: we have no labels yet, and arXiv 2605.02241 saw the same kind of classifier fall out of distribution (zsconf-embedding-router-ood)." }, { @@ -241,6 +346,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "Zero-shot and measured on 7 to 8B models, the nearest size class of any claim here. E-04a's readout margin is the same kind of signal and costs nothing extra (the note's E-04 step 2). The AUROC is modest, and our questions are typed decisions, not MMLU-Pro and TriviaQA answers." }, { @@ -256,6 +368,13 @@ "rejected_by": [], "disputed_by": [], "score": null, + "currency": "USD", + "cost_money": null, + "pledged": 0.0, + "received": 0.0, + "funded_fraction": 0.0, + "funding_source": null, + "ready": false, "reason": "Training-free, and its first-stage signal held down to 0.6B, so our models' size is not the obstacle. Against it: the gains are on Qwen3 and DeepSeek-V3.2 with their own thinking modes; our slow model is Inkling 2 Mini at Q4_K on llama.cpp, and E-04's questions are typed decisions, not those benchmarks; the numbers are the method's authors' own. Code is released (js-lee-AI/DART), so the paper's own number can be reproduced first." } ] diff --git a/site/README.md b/site/README.md index 332ddd2..2062dc3 100644 --- a/site/README.md +++ b/site/README.md @@ -69,8 +69,18 @@ logo = "brand/logo.svg" # .svg, .png, .webp or .jpg; in the header and as th # search; `{ page = "search", text = "Find" }` renames one. Markdown pages with `nav: N` follow. Every page is # built either way. pages = ["claims", "queue", "predictions", "roles", "map", "notes"] +# Other links go in the same list as `{ text, href }`. An absolute http(s) URL or a path starting with `/` is written +# as it is (a URL gets rel="noopener"); anything else is relative to the site and gets the base path from `--base`. +# pages = ["claims", "queue", { text = "Lab", href = "https://example.org/lab" }, { text = "Home", href = "/" }] + +[funding] # optional: the "fund this" link on the queue and the claim pages +url_template = "https://example.org/fund/{id}/" # {id} is the claim's id; an http(s) URL or a /path; no link without it +label = "Fund this" # the link's text (default "Fund this") ``` +The funding figures themselves (a bar, price, share funded, a "ready" badge and the source) come from `queue.json` +(`research/funding.yaml`, `morphogen.research rank`): a claim whose row has no `cost_money` shows none of it. + Morphogen's own demo builds from [config.toml](config.toml), which points at [demos/research-loop](../demos/research-loop). ## Working on the templates @@ -153,7 +163,7 @@ questions (`watch.yaml`), what has been tested and what is next in the queue. | Page | What it shows | | --- | --- | | `index.html` | the feed, newest first, filtered in the page by search, role, source and status (kept in the address); without JavaScript, unfiltered | -| `queue.html` | next to test: `queue.json`, best first, with plan, cost, score, steering, and buttons to prioritise or reject | +| `queue.html` | next to test: `queue.json`, best first, with plan, cost, score, funding (when there is a `funding.yaml`), steering, and buttons to prioritise or reject | | `predictions.html` | predictions waiting for a trial, and a calibration chart with the Brier score once predictions written before an outcome have one | | `roles.html` | what the agent watches (`watch.yaml`, `seen.jsonl`), the roles, the options for each, and this system's conditions | | `map.html` | the relations graph, laid out at build time (`src/lib/layout.mjs`); a static SVG of links, with highlighting and filters in Alpine | diff --git a/site/config.toml b/site/config.toml index 062c2fa..5387fc6 100644 --- a/site/config.toml +++ b/site/config.toml @@ -49,3 +49,7 @@ propose-option = ["research:question"] # The header's pages, in order: claims, queue, predictions, roles, map, notes (shown once there is a note), search. # A Markdown page with `nav: ` in its front matter is added after these. pages = ["claims", "queue", "predictions", "roles", "map", "notes"] + +# [funding] +# url_template = "https://openreplicant.com/fund/{id}/" # a "fund this" link carrying the claim's id +# label = "Fund this" diff --git a/site/public/assets/style.css b/site/public/assets/style.css index 03027a1..cf70642 100644 --- a/site/public/assets/style.css +++ b/site/public/assets/style.css @@ -346,3 +346,8 @@ details ul { margin-top: 8px; font-size: 0.88rem; } .graph .off { display: none; } .results td:nth-last-child(2) { white-space: nowrap; } .top-in { max-width: 1200px; } + +/* Funding: a bar, the price and a ready badge, on the queue and beside a trial plan. */ +.funding { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 0.9rem; margin: 6px 0; } +.fund-bar { width: 120px; } +.tag-ready { background: var(--good-bg); color: var(--good); border-color: currentColor; font-weight: 650; } diff --git a/site/src/components/Assessment.astro b/site/src/components/Assessment.astro index 0f87627..9ccc380 100644 --- a/site/src/components/Assessment.astro +++ b/site/src/components/Assessment.astro @@ -3,6 +3,7 @@ import ClaimRef from "./ClaimRef.astro"; import ExtLink from "./ExtLink.astro"; import Meter from "./Meter.astro"; +import Funding from "./Funding.astro"; import StatusBadge from "./StatusBadge.astro"; import { refName, up } from "../lib/text.mjs"; const { site, c, a } = Astro.props; @@ -25,6 +26,7 @@ const by = { morphogen: "the judge", falsifier: "a falsifier registered before t {plan &&

The cheapest trial that would settle it

{plan.plan || ""}

Cost
about {plan.cost_hours} hours, setting up included
{(plan.needs || []).length > 0 && <>
Needs
    {plan.needs.map((n) =>
  • {n}
  • )}
}{plan.code && <>
Code
}
+{ranked && } {ranked &&

Number {ranked[0]} of {site.queue().length} in the queue.

}
} {out &&

Outcome

Trial {trialEnt ? {t.id} : {t.id || ""}}{t.url && <> ()}{out.date && <> · {out.date}} · {out.comparison === "our-setup" ? "a transfer test on our setup" : "the source's own setup reproduced"}

diff --git a/site/src/components/Funding.astro b/site/src/components/Funding.astro new file mode 100644 index 0000000..b847d42 --- /dev/null +++ b/site/src/components/Funding.astro @@ -0,0 +1,20 @@ +--- +// What a trial costs in money and how much of it is funded: a bar, the price, the fraction and a "ready" badge, from +// the queue row's currency, cost_money, pledged, received, funded_fraction, funding_source and ready (research/funding.yaml, +// morphogen.research rank). Nothing at all when the row has no price, i.e. when there is no funding file. The link +// comes from [funding] url_template in the config and is left out without one. +import { fundUrl } from "../lib/config.mjs"; +const { site, row } = Astro.props; +const shown = row && typeof row.cost_money === "number"; +const money = (v) => `${Number(v || 0).toLocaleString("en-US", { maximumFractionDigits: 2 })} ${row.currency || ""}`.trim(); +const frac = shown ? Math.max(0, Math.min(1, Number(row.funded_fraction) || 0)) : 0; +const pct = (frac * 100).toFixed(1); +const href = shown ? fundUrl(site.funding.url_template, row.claim) : null; +--- +{shown &&
{Math.round(frac * 100)}% funded +price {money(row.cost_money)} +pledged {money(row.pledged)} +received {money(row.received)} +{row.ready && ready} +{row.funding_source && Source: {row.funding_source}} +{href && {site.funding.label}}
} diff --git a/site/src/layouts/Base.astro b/site/src/layouts/Base.astro index d45d084..810143b 100644 --- a/site/src/layouts/Base.astro +++ b/site/src/layouts/Base.astro @@ -8,8 +8,8 @@ import { safeUrl, up } from "../lib/text.mjs"; const { site, title, description = "", depth = 0, current = "" } = Astro.props; const u = up(depth); const listed = site.pages.filter((p) => p.kind !== "page"); -const fixed = site.nav.filter((n) => n.id !== "notes" || listed.length).map((n) => [n.href, n.text]); -const extra = site.pages.filter((p) => typeof p.nav === "number").sort((a, b) => a.nav - b.nav).map((p) => [`${p.slug}.html`, p.title]); +const fixed = site.nav.filter((n) => n.id !== "notes" || listed.length).map((n) => [n.asIs ? n.href : `${u}${n.href}`, n.text, n.offsite, n.asIs ? null : n.href]); +const extra = site.pages.filter((p) => typeof p.nav === "number").sort((a, b) => a.nav - b.nav).map((p) => [`${u}${p.slug}.html`, p.title, false, `${p.slug}.html`]); const nav = [...fixed, ...extra]; const fullTitle = title && title !== site.title ? `${title} · ${site.title}` : site.title; const desc = description || site.description; @@ -41,7 +41,7 @@ const iconType = { ".svg": "image/svg+xml", ".png": "image/png", ".webp": "image
{logo ? : } {site.title} - + diff --git a/site/src/lib/config.mjs b/site/src/lib/config.mjs index 5a0afd3..3bc0aaf 100644 --- a/site/src/lib/config.mjs +++ b/site/src/lib/config.mjs @@ -10,6 +10,7 @@ import fs from "node:fs"; import path from "node:path"; import { fileURLToPath } from "node:url"; import { parse as parseToml } from "smol-toml"; +import { safeUrl } from "./text.mjs"; const HERE = path.dirname(fileURLToPath(import.meta.url)); // site/: astro.config.mjs sets SITE_DIR, since a bundled page no longer sits where this file does. @@ -28,6 +29,31 @@ export const NAV_PAGES = { const DEFAULT_NAV = ["claims", "queue", "predictions", "roles", "map", "notes"]; const ACTIONS = ["prioritise", "reject", "dispute", "question", "propose-role", "propose-option"]; +/** One `[nav] pages` entry: a page id (or `{page, text}`), or `{text, href}` for any other link. A link is external + * when it is an absolute URL (http or https), or starts with `/` (a path on this host, written as it is): neither + * gets the base path. Anything else is relative to the site and does. Other schemes (`javascript:`) stop the build. */ +function navEntry(x) { + if (x && typeof x === "object" && x.href != null) { + const href = String(x.href).trim(); + if (!x.text) throw new Error(`site: [nav] pages: a link needs text, ${href} has none`); + const absolute = /^https?:\/\//i.test(href), rooted = /^\//.test(href); + if (absolute ? !safeUrl(href) : /^[a-z][a-z0-9+.-]*:/i.test(href) || /[\s"'<>\\]/.test(href) || !href) { + throw new Error(`site: [nav] pages: ${href} must be an http(s) URL, a /path or a path in the site`); + } + return { id: null, href, text: String(x.text), asIs: absolute || rooted, offsite: absolute || href.startsWith("//") }; + } + const id = typeof x === "string" ? x : x?.page; + if (!NAV_PAGES[id]) throw new Error(`site: [nav] pages: ${id} is not one of ${Object.keys(NAV_PAGES).join(", ")}, or {text, href}`); + return { id, href: NAV_PAGES[id][0], text: (typeof x === "object" && x.text) || NAV_PAGES[id][1] }; +} + +/** The "fund this" link for an id from `[funding] url_template` (`{id}` is replaced, URL-encoded), or null. */ +export function fundUrl(template, id) { + if (!template) return null; + const url = template.replaceAll("{id}", encodeURIComponent(String(id))); + return /^\/(?!\/)/.test(url) ? url : safeUrl(url); +} + /** `/research` -> `/research/`; empty -> "" (relative links). */ export function normalizeBase(base) { const b = String(base || "").trim(); @@ -64,11 +90,12 @@ export function loadConfig(file = process.env.MORPHOGEN_SITE_CONFIG || path.join for (const k of Object.keys(labels)) { if (!ACTIONS.includes(k)) throw new Error(`site: [labels] ${k} is not one of ${ACTIONS.join(", ")}`); } - const nav = list(raw.nav?.pages ?? DEFAULT_NAV).map((x) => { - const id = typeof x === "string" ? x : x?.page; - if (!NAV_PAGES[id]) throw new Error(`site: [nav] pages: ${id} is not one of ${Object.keys(NAV_PAGES).join(", ")}`); - return { id, href: NAV_PAGES[id][0], text: (typeof x === "object" && x.text) || NAV_PAGES[id][1] }; - }); + const nav = list(raw.nav?.pages ?? DEFAULT_NAV).map(navEntry); + const f = raw.funding || {}; + if (f.url_template != null && (typeof f.url_template !== "string" || !f.url_template.includes("{id}") || !fundUrl(f.url_template, "x"))) { + throw new Error(`site: [funding] url_template must be an http(s) URL or a /path containing {id}, not ${f.url_template}`); + } + const funding = { url_template: f.url_template || null, label: f.label || "Fund this" }; const files = { css: at(theme.css), logo: at(theme.logo) }; for (const [k, f] of Object.entries(files)) { if (f && !fs.existsSync(f)) throw new Error(`site: [theme] ${k} = ${theme[k]}: no such file`); @@ -94,6 +121,7 @@ export function loadConfig(file = process.env.MORPHOGEN_SITE_CONFIG || path.join }, theme: files, nav, + funding, base: normalizeBase(process.env.MORPHOGEN_SITE_BASE), }; } diff --git a/site/src/lib/data.mjs b/site/src/lib/data.mjs index d32f3b3..6e2c7eb 100644 --- a/site/src/lib/data.mjs +++ b/site/src/lib/data.mjs @@ -149,6 +149,7 @@ export class Site { this.system = cfg.system; this.labels = cfg.labels; this.nav = cfg.nav; + this.funding = cfg.funding; this.theme = cfg.theme; this.root = cfg.root; this.entities = new Map(); // id -> entity diff --git a/site/src/pages/queue.astro b/site/src/pages/queue.astro index 99eefed..0209fdd 100644 --- a/site/src/pages/queue.astro +++ b/site/src/pages/queue.astro @@ -2,6 +2,7 @@ // Next to test: the agent's queue.json, best first, with its plan, cost, score and steering. import Base from "../layouts/Base.astro"; import Meter from "../components/Meter.astro"; +import Funding from "../components/Funding.astro"; import { getSite } from "../lib/site.mjs"; import { issue, issueBody } from "../lib/steer.mjs"; import { refName, link } from "../lib/text.mjs"; @@ -30,6 +31,7 @@ const items = site.queue().map((it, i) => {
{x.role ? {refName(x.it.role)} : refName(x.it.role)} · option {x.about ? {refName(x.it.about)} : refName(x.it.about)}{typeof x.it.p_transfer === "number" && }

{x.c ? {x.c.title} : x.it.claim}

{x.nums.map(([k, v]) => {k} {v})}{x.steer.map((s) => {s})}

+ {x.it.plan &&

Plan
{x.it.plan}

} {x.it.reason &&
Why this probability

{x.it.reason}

} {x.c &&

Test sooner Reject

} diff --git a/tests/test_site.py b/tests/test_site.py index 66b0c18..00ea77b 100644 --- a/tests/test_site.py +++ b/tests/test_site.py @@ -109,14 +109,23 @@ def make_project(root: Path, claims: list[dict]) -> None: '[site]\nrepo = "Owner/Repo"\nsystem = "system:default/sys"\n[sources]\nclaims = ["claims"]\n' 'catalog = ["catalog.yaml"]\nresearch = "research"\ncontent = "content"\n' 'schema = "schemas/evidence-claim.v1.json"\n[labels]\nprioritise = ["research:prioritise"]\nreject = ["research:reject"]\n' - 'dispute = ["research:question"]\nquestion = ["research:question"]\n', encoding="utf-8") + 'dispute = ["research:question"]\nquestion = ["research:question"]\n' + '[nav]\npages = ["claims", "queue", {text = "Home", href = "/"}, {text = "Docs", href = "https://example.org/docs?a=1&b=2"},' + ' {text = "Local", href = "about.html"}]\n' + '[funding]\nurl_template = "https://example.org/fund/{id}/"\nlabel = "Back this"\n', encoding="utf-8") research = root / "research" research.mkdir() (research / "queue.json").write_text(json.dumps({"date": "2026-11-27", "how": "bits / hours", "queue": [ {"claim": "hostile-claim", "role": "component:default/role-x", "about": "component:default/opt-x", "p_transfer": 0.4, "information_bits": 0.971, "cost_hours": 2.5, "score": 0.388, "plan": "Run it " + HOSTILE, "reason": "R " + HOSTILE, "prioritised_by": ["someone"], - "rejected_by": [], "disputed_by": []}]}), encoding="utf-8") + "rejected_by": [], "disputed_by": [], "currency": "USD", "cost_money": 30.0, "pledged": 10.0, "received": 0.0, + "funded_fraction": 0.3333, "funding_source": "Src " + HOSTILE, "ready": True}, + {"claim": "scored-claim", "role": "component:default/role-x", "about": "component:default/opt-x", + "p_transfer": 0.5, "information_bits": 1.0, "cost_hours": 1.0, "score": 1.0, "plan": "Plain", + "prioritised_by": [], "rejected_by": [], "disputed_by": [], "currency": "USD", "cost_money": None, + "pledged": 0.0, "received": 0.0, "funded_fraction": 0.0, "funding_source": None, "ready": False}]}), + encoding="utf-8") (research / "watch.yaml").write_text(yaml.safe_dump({"topics": [ {"name": "topic-x", "question": "Q " + HOSTILE, "roles": ["role-x"], "terms": ["t1"]}]}), encoding="utf-8") (research / "seen.jsonl").write_text(json.dumps( @@ -324,12 +333,49 @@ def test_queue_watch_and_trial_plan(self): page = read(self.out, "claims/hostile-claim.html") self.assertIn("The cheapest trial that would settle it", page) self.assertIn("about 2.5 hours", page) - self.assertIn("Number 1 of 1 in the", page) + self.assertIn("Number 1 of 2 in the", page) roles = read(self.out, "roles.html") self.assertIn("topic-x", roles) self.assertIn("Papers seen", roles) self.assertIn("topic-x", read(self.out, "roles/role-x.html")) + def test_funding_on_the_queue_and_beside_the_plan(self): + queue = read(self.out, "queue.html") + self.assertEqual(queue.count('class="funding"'), 1) # the row without a price shows nothing + self.assertIn("33% funded", queue) + self.assertIn("30 USD", queue) + self.assertIn('class="tag tag-ready">ready<', queue) + self.assertIn('href="https://example.org/fund/hostile-claim/" rel="noopener">Back this', queue) + page = read(self.out, "claims/hostile-claim.html") + self.assertIn("33% funded", page) + self.assertIn("Back this", page) + self.assertNotIn("funded", read(self.out, "claims/scored-claim.html")) + # funding_source is free text: it is escaped like any other + text = re.sub(r'="[^"]*"', '=""', queue + page) + self.assertIn("Source: Src ", text) + self.assertNotIn("