Docs: the libraries panel and deleting (and restoring) a library in the README; no documents left: the seed's description of itself, docs/wikipedia.md (top-level trees, per-library paths), the tagline, comments, test names and the link evaluation script

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-17 03:07:02 -05:00
1 parent 146437a01a
commit fc7c222407
26 files changed
+167 -145

No files matched your search

+2 -2
View File
@@ -288,7 +288,7 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
await open(page, "Recursion without names", "fixed-point combinator", ".lnk, .anchor");
await expect(pane(page, "Fixed-point combinator").locator(".wrow").first()).toBeVisible();
await still(page);
// The documents' column is covered to spines, and folded down: hover the spine of a folded pane in it.
// The top-level trees' column is covered to spines, and folded down: hover the spine of a folded pane in it.
const col = pane(page, "The tides").locator("xpath=..");
expect(await col.evaluate((c) => c.hasAttribute("data-covered") || !!c.nextElementSibling?.hasAttribute("data-over"))).toBe(true);
const tides = pane(page, "The tides");
@@ -334,7 +334,7 @@ test("a pane covered across and down peeks out whole on both axes; the wheel scr
const b = (await bar.boundingBox())!;
const at = { x: b.x + b.width / 2, y: b.y + b.height / 2 };
expect(await page.evaluate(({ x, y }) => !!document.elementFromPoint(x, y)?.closest(".selbar"), at)).toBe(true);
// Peek the documents' column (to the left, covered): it slides out over the pane with the bar.
// Peek the top-level trees' column (to the left, covered): it slides out over the pane with the bar.
await page.mouse.move(sp.x + sp.width / 2, sp.y + 60);
await expect(col).toHaveAttribute("data-peek", "");
const over = await page.evaluate(({ x, y }) => {
+3 -3
View File
@@ -5,7 +5,7 @@
* own height among them; when they do not fit it stacks them as the strip stacks columns, covering
* all but the pane looked at, partly and then down to a tab. Curves run from where each pane was opened to its title; panes close (q, ×)
* and pin (P, pin). Same build, mock model, mock Wikipedia and shared library as the other specs;
* the documents are hoisted to (z) as in panes.spec.ts.
* the top-level trees are hoisted to (z) as in panes.spec.ts.
*/
import { expect, test, type Page } from "@playwright/test";
import { autoLayout, command, focusedTitle, jump, keys, seedLinks, selected, settle, state, visit } from "./helpers";
@@ -398,7 +398,7 @@ test("curves down one gutter take lanes of their own, side by side, up to as man
await page.goto("/");
await page.waitForSelector(".strip .pane");
await page.evaluate(() => document.fonts.ready);
// Ten documents opened from the library: ten curves down the gutter into column 1.
// Ten top-level trees opened from the library: ten curves down the gutter into column 1.
for (let i = 0; i < 10; i++) await keys(page, "j Enter");
await still(page);
const runs = await page.evaluate(() =>
@@ -676,7 +676,7 @@ test("q on an article opened from an article in a fork closes that article only
await page.waitForSelector(".strip .pane");
await page.evaluate(() => document.fonts.ready);
await jump(page, "Recursion without names");
// A fork beside it from the document's pane: Recursion without names starts a fork.
// A fork beside it from the top's pane: Recursion without names starts a fork.
await keys(page, "k Enter j Enter");
expect((await trail(page)).at(-1)).toBe("Recursion without names");
await tabTo(page, "fixed-point combinator");
+1 -1
View File
@@ -64,7 +64,7 @@ const hoistHere = (page: Page) => state(page, (s) => void (!s.panes && s.setHois
/**
* The section at these titles as the page: in the column hoisted to it (as z does), with the
* library one step out; in panes, in its own pane beside the library's. What `/doc/<name>` used to open.
* library one step out; in panes, in its own pane beside the library's.
*/
export async function openPage(page: Page, ...path: string[]) {
await openAt(page, ...path);
+1 -1
View File
@@ -264,7 +264,7 @@ test("branches merge; a conflict in meaning is found, resolved by the model, and
await expect(page.locator(".verdict")).toContainText("Verified");
});
test("two people editing at once converge, and the document survives a reload", async ({ browser }) => {
test("two people editing at once converge, and the library survives a reload", async ({ browser }) => {
const a = await (await browser.newContext()).newPage();
const b = await (await browser.newContext()).newPage();
await open(a);
+7 -7
View File
@@ -65,7 +65,7 @@ test("each kind of link has its mark; a note that also links keeps its dotted un
await expect(wiki).toBeVisible();
expect(await wiki.evaluate((el) => getComputedStyle(el).textDecorationLine)).toContain("underline");
await expect(sec.locator(".lmark.l-wiki").first()).toHaveText("W");
// Another note in the library: §, with the document in its tooltip.
// Another note in the library: §, with its top in its tooltip.
await expect(sec.locator(".lnk.l-node", { hasText: "Y combinator" })).toBeVisible();
const nodeMark = sec.locator(".lmark.l-node").first();
await expect(nodeMark).toHaveText("§");
@@ -101,7 +101,7 @@ test("hovering a link shows its preview and leaving or a key takes it away; focu
await page.mouse.move(5, 5);
await page.waitForTimeout(700);
await expect(page.locator(".popup")).toHaveCount(0);
// The node link's preview names its document and shows its first lines.
// The node link's preview names its top and shows its first lines.
await page.locator(".lnk.l-node", { hasText: "Y combinator" }).hover();
await expect(popup).toContainText("Fixed points");
await expect(popup).toContainText("How Y works");
@@ -309,7 +309,7 @@ test("Linked from and Mentioned in list what links here, reachable by j and Ente
await expect(back.locator("li.focused")).toHaveCount(1);
await keys(page, "Enter");
expect(await selected(page)).toBe("Several of the leading systems");
// Lambda calculus is linked from two documents: its pane lists both, and either leads back.
// Lambda calculus is linked from two top-level trees: its pane lists both, and either leads back.
await inPane(page, "Recursion without names", "lambda calculus");
await keys(page, "Enter j l");
const art = page.locator(".wiki-pane").last();
@@ -333,13 +333,13 @@ test("linking by hand: the picker links to the library, to Wikipedia and to an a
const s = (globalThis as any).__ie.snap;
return s.nodes[d].children.map((c: string) => s.nodes[c]).filter((n: any) => n.ref).map((n: any) => `${n.anchors[0].text}|${n.ref.kind}|${n.ref.title ?? n.ref.url ?? n.ref.path?.join("/")}`);
}, doc);
// A word in the document's text: i i selects it; w opens the picker filled with it.
// A word in the page's text: i i selects it; w opens the picker filled with it.
await keys(page, "i i");
const word = await selected(page);
await keys(page, "w");
const picker = page.locator(".picker");
await expect(picker.locator("input")).toHaveValue(word);
// Library: a document by title.
// Library: a top-level node by title.
await page.keyboard.press("Control+a");
await page.keyboard.type("Octopus minds");
await expect(picker.locator(".choice.selected .t")).toHaveText("Octopus minds");
@@ -368,7 +368,7 @@ test("linking by hand: the picker links to the library, to Wikipedia and to an a
await expect(picker.locator(".choice.selected")).toContainText("example.org");
await keys(page, "Enter");
expect(await linkCount()).toEqual([`${word}|wiki|Octopus`, `${second}|url|https://example.org/tides`]);
// /link with a target in the text form, on the node itself: the document is about something.
// /link with a target in the text form, on the node itself: the node is about something.
await keys(page, "Escape Escape");
await command(page, "/link w:Tide");
expect(await state(page, (s) => s.snap.nodes[s.focus.node].ref)).toEqual({ kind: "wiki", title: "Tide", lang: "en" });
@@ -536,7 +536,7 @@ test("keypress → paint stays within one frame budget through links and article
const warm = await measure(3);
report[view] = { cold, warm };
// One frame for nearly every key; a rare second frame (a preview appearing, the column's
// article page giving way to the document) is allowed, as the other latency tests allow it.
// article page giving way to the node's page) is allowed, as the other latency tests allow it.
expect(warm.keystrokes).toBeGreaterThan(30);
expect(warm.median).toBeLessThan(17.5);
expect(warm.p95).toBeLessThan(34);
+2 -2
View File
@@ -125,9 +125,9 @@ test("deleting the words a note is about orphans the note, visibly", async ({ pa
test("an outside agent edits over HTTP with the same ops, and the open page follows", async ({ page, request }) => {
await open(page);
const tree = await (await request.get("/api/tree/main")).json();
// The tree is the whole library; its documents are the root's sections.
// The tree is the whole library; its top-level trees are the root's sections.
expect(Object.values<any>(tree.nodes).filter((n) => n.parent === tree.root).map((n) => n.title)).toContain("Infinispand");
const target = Object.values<any>(tree.nodes).find((n) => n.title === "The first document");
const target = Object.values<any>(tree.nodes).find((n) => n.title === "The first tree");
expect(target).toBeTruthy();
const res = await request.post("/api/ops/main", {
data: { author: "outside-agent", message: "Add a remark", ops: [{ op: "create", parent: target.id, title: "Written over HTTP", body: "By an agent that is not the browser." }] },
+1 -1
View File
@@ -99,7 +99,7 @@ test("the library root is the first page and a node like any other: its sections
expect(await focusTitle(page)).toBe("Infinispand");
});
test("an address names a node by its id, and survives a reload, Back and Forward; an old document address shows the library", async ({ page }) => {
test("an address names a node by its id, and survives a reload, Back and Forward; an old /doc/ address shows the library", async ({ page }) => {
await openAt(page);
await jump(page, "Amphidromes");
const amph = await state(page, (s) => s.focus.node);
+4 -4
View File
@@ -173,7 +173,7 @@ test("a pane cut off for any reason peeks out whole, across and down, and the cu
await page.setViewportSize({ width: 1920, height: 700 });
await library(page);
for (const t of ["Octopus minds", "Infinispand", "The tides", "Fixed points"]) await open(page, "Library", t);
/** Hover each pane of the documents' column that is cut off, and check it comes out whole, and the curves with it. */
/** Hover each pane of the top-level trees' column that is cut off, and check it comes out whole, and the curves with it. */
const sweep = async (label: string, across: boolean) => {
const col = page.locator(".strip > .col").nth(1);
const n = await col.locator(":scope > .pane").count();
@@ -237,7 +237,7 @@ test("a pane cut off for any reason peeks out whole, across and down, and the cu
expect(await col.evaluate((c) => c.hasAttribute("data-covered") || !!c.nextElementSibling?.hasAttribute("data-over"))).toBe(true);
expect(await sweep("column covered", true)).toBeGreaterThan(0);
// By its share of a column that is not crowded: a tall window, two documents, one longer than its share.
// By its share of a column that is not crowded: a tall window, two top-level trees, one longer than its share.
await page.setViewportSize({ width: 1920, height: 1080 });
await page.evaluate(() => Object.keys(localStorage).filter((k) => k.startsWith("ie:view:")).forEach((k) => localStorage.removeItem(k)));
await library(page);
@@ -264,14 +264,14 @@ test("the curves keep to their sources and landing lines through every kind of l
await noFaults(page, "scrolled back");
await page.locator(".strip").evaluate((el) => (el.scrollLeft = Math.max(0, el.scrollLeft - 300)));
await noFaults(page, "the strip scrolled");
// A resize that folds the documents' column, and back.
// A resize that folds the top-level trees' column, and back.
await page.setViewportSize({ width: 1920, height: 520 });
await noFaults(page, "folded");
await page.setViewportSize({ width: 1600, height: 900 });
await noFaults(page, "resized");
await page.setViewportSize({ width: 1920, height: 1080 });
await noFaults(page, "unfolded");
// A drag down the documents' column.
// A drag down the top-level trees' column.
await page.evaluate(() => {
const ie = (globalThis as any).__ie;
const col = ie.paneColumns.get(1);
+1 -1
View File
@@ -22,7 +22,7 @@ async function still(page: Page) {
await frames(page);
}
async function open(page: Page, inPane: string | RegExp, text: string | RegExp, sel = ".row") {
// A row by its exact title (the shared library has documents whose titles start the same).
// A row by its exact title (the shared library has top-level nodes whose titles start the same).
const it = sel === ".row" && typeof text === "string" ? pane(page, inPane).locator(".row", { has: page.locator(`.title:text-is("${text}")`) }) : pane(page, inPane).locator(sel, { hasText: text });
await it.first().dispatchEvent("click");
await still(page);
+1 -1
View File
@@ -49,7 +49,7 @@ test("/research shows its searches and pages, writes a section, and links its cl
await expect(page.locator(".status .message")).toContainText("sources: How tides work (example.org)");
await idle(page);
// The section is in the document, with the phrase linked to the page: a web link, marked ↗.
// The section is in the library, with the phrase linked to the page: a web link, marked ↗.
const link = await state(page, (s) => {
const snap = s.snap;
const sec = Object.values(snap.nodes).find((n: any) => n.title === "On how tides work") as any;
+12 -12
View File
@@ -1,7 +1,7 @@
/**
* A large library in the browser: 100 more documents of 50 nodes each (over 5,000 nodes in all),
* A large library in the browser: 100 more top-level trees of 50 nodes each (over 5,000 nodes in all),
* written over the op API. Keypress → paint is measured as in the other specs, while moving
* through the library page, inside documents and across them, in the column and in panes, and
* through the library page, inside those trees and across them, in the column and in panes, and
* between four forks of the library pane, each three panes deep; a body edit is timed from the
* store call to the painted frame. Runs last: it fills the shared library.
*/
@@ -49,12 +49,12 @@ const keySamples = async (page: Page) => (await state(page, (s) => s.samples as
test.describe.configure({ mode: "serial" });
test.setTimeout(300_000);
test("a library of over 5,000 nodes in 100 more documents: keypress → paint and a body edit, in the column and in panes", async ({ page, request }) => {
// Write the documents, one commit each, as an outside agent would.
test("a library of over 5,000 nodes in 100 more top-level trees: keypress → paint and a body edit, in the column and in panes", async ({ page, request }) => {
// Write the trees, one commit each, as an outside agent would.
const tree = await (await request.get("/api/tree")).json();
let t = Date.now();
for (let d = 0; d < 100; d++) {
const ops: any[] = [{ op: "create", parent: tree.root, title: `Scale document ${d}`, body: SENTENCE.repeat(3) }];
const ops: any[] = [{ op: "create", parent: tree.root, title: `Scale tree ${d}`, body: SENTENCE.repeat(3) }];
let n = 1;
for (let s = 0; s < 7; s++) {
const sec = n++;
@@ -63,7 +63,7 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
}
ops.push({ op: "create", parent: "$0", kind: "note", quote: "something that matters", body: "A note." });
for (let i = 0; i < n; i++) ops.push({ op: "bless", id: `$${i}` });
const res = await request.post("/api/ops", { data: { author: "scale", message: `Scale document ${d}`, ops } });
const res = await request.post("/api/ops", { data: { author: "scale", message: `Scale tree ${d}`, ops } });
expect(res.ok()).toBe(true);
}
const written = Date.now() - t;
@@ -85,13 +85,13 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
// ---- the column ----
await page.evaluate(() => ((globalThis as any).__ie.samples.length = 0));
// Down the library page's 113 rows, into documents and out, across to the next.
// Down the library page's 113 rows, into trees and out, across to the next.
for (let i = 0; i < 40; i++) await paced(page, "j");
for (let i = 0; i < 6; i++) await paced(page, "l j l j l i j Escape h h h j");
await paced(page, "O");
const column = stats(await keySamples(page));
// A body edit inside a document deep in the library.
await visit(page, "Scale document 97");
// A body edit inside a tree deep in the library.
await visit(page, "Scale tree 97");
await ready(page);
await paced(page, "j l j");
const columnEdit = stats(await editTimes(page, 15));
@@ -110,7 +110,7 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
// ---- forks: four documents opened side by side from the library pane, each three panes deep (document, part, leaf) ----
// A fresh view: the panes opened above stay open (opens go beside), and would be restored here.
await page.evaluate(() => localStorage.clear());
await visit(page, "Scale document 90");
await visit(page, "Scale tree 90");
await ready(page);
await paced(page, "l l l l");
for (let d = 1; d < 4; d++) await paced(page, "h h j Enter l l l l");
@@ -126,12 +126,12 @@ test("a library of over 5,000 nodes in 100 more documents: keypress → paint an
await page.evaluate(() => ((globalThis as any).__ie.samples.length = 0));
for (let i = 0; i < 8; i++) await paced(page, "[ [ [ ] ] ]");
const forks = stats(await keySamples(page));
await visit(page, "Scale document 98");
await visit(page, "Scale tree 98");
await ready(page);
await paced(page, "l l j");
const panesEdit = stats(await editTimes(page, 15));
const report = { nodes, documents: await state(page, (s) => s.snap.nodes[s.snap.root].children.length), writtenMs: written, bootFreshMs: bootFresh, bootStoredMs: bootStored, column, columnEdit, panes, panesEdit, forks };
const report = { nodes, tops: await state(page, (s) => s.snap.nodes[s.snap.root].children.length), writtenMs: written, bootFreshMs: bootFresh, bootStoredMs: bootStored, column, columnEdit, panes, panesEdit, forks };
console.log("large library:", JSON.stringify(report));
writeReport("scale", report);
for (const r of [column, panes]) {