Public: anyone can read this; the crew can change it.
web/layout: stop loading the server through the Talk count and the page links #17388
Merged 26h 41m ago, live in production
layout-leaf → main 0 commits
7 files
changed +176
−113
src/actions/conversation_confirms.ts +1 −6
| @@ -19,7 +19,7 @@ import { lastEventOf } from "../core/events.ts"; | ||
| 19 | 19 | import { getUserById } from "../core/users.ts"; |
| 20 | 20 | import { getIssue, labelsFor } from "../core/issues.ts"; |
| 21 | 21 | import { getRepo } from "../core/repos.ts"; |
| 22 | import { answerHeld, countWaiting, HELD_TTL_MS, waitingFor, type YesRefusal } from "../core/fence.ts"; | |
| 22 | import { answerHeld, HELD_TTL_MS, waitingFor, type YesRefusal } from "../core/fence.ts"; | |
| 23 | 23 | import type { User } from "../core/users.ts"; |
| 24 | 24 | import { argumentsShown, destroysData, destroysSentence, keptOf, undoOf } from "../crew/conversation_confirm.ts"; |
| 25 | 25 | import { confirmSentence } from "../crew/conversation_ask.ts"; |
| @@ -52,11 +52,6 @@ export function waitingConfirms(ctx: Pick<Ctx, "app">, user: User, now: number = | ||
| 52 | 52 | })); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | /** How many confirms wait on the person's yes, for the header's Talk button. */ | |
| 56 | export function waitingCount(ctx: Pick<Ctx, "app">, user: User, now: number = Date.now()): number { | |
| 57 | return countWaiting(ctx.app.db, user.id, now); | |
| 58 | } | |
| 59 | ||
| 60 | 55 | export const CONFIRM_ID = /^[0-9a-z]{1,40}$/; |
| 61 | 56 | |
| 62 | 57 | /** Why a yes did nothing, in words, with the status the API answers. */ |
src/web/layout.ts +3 −3
| @@ -12,7 +12,7 @@ import { keyOf } from "./keymap.ts"; | ||
| 12 | 12 | import { requestHolds } from "../http/conditional.ts"; |
| 13 | 13 | import { sshOn } from "../settings/ssh.ts"; |
| 14 | 14 | import { hereAddress, returnTo, withReturn } from "./return_to.ts"; |
| 15 | import { waitingCount } from "../actions/conversation_confirms.ts"; | |
| 15 | import { countWaiting } from "../core/fence.ts"; | |
| 16 | 16 | import { goLevel, goPaletteRows } from "./go_pages.ts"; |
| 17 | 17 | import { NEW_ISSUE_KEY } from "./script_keys.ts"; |
| 18 | 18 | import { newIssueHref } from "./issue_from.ts"; |
| @@ -60,7 +60,7 @@ import { | ||
| 60 | 60 | spriteAsset, |
| 61 | 61 | stylesheetAsset, |
| 62 | 62 | } from "./asset.ts"; |
| 63 | import { linkHeader, pageLinks, unindexed, type PageLink } from "./standards.ts"; | |
| 63 | import { linkHeader, pageLinks, unindexed, type PageLink } from "./page_links.ts"; | |
| 64 | 64 | import { DESCRIPTION_MAX } from "./describe.ts"; |
| 65 | 65 | import { breadcrumbStructuredData } from "./structured_data.ts"; |
| 66 | 66 | import { |
| @@ -697,7 +697,7 @@ export function signUpHref(ctx: Ctx): string | undefined { | ||
| 697 | 697 | * button renders. |
| 698 | 698 | */ |
| 699 | 699 | function talkButton(ctx: Ctx, user: User, about?: string): Html { |
| 700 | const waiting = waitingCount(ctx, user); | |
| 700 | const waiting = countWaiting(ctx.app.db, user.id); | |
| 701 | 701 | const label = waiting > 0 ? `Talk to the forge, ${waiting} waiting` : "Talk to the forge"; |
| 702 | 702 | return html`<a class="btn btn-icon talk-btn" href="${talkHref(about)}" aria-label="${label}" data-shortcut="${keyOf("talk")}" ${hintAttr(keyOf("talk"), "Talk to the forge")} |
| 703 | 703 | >${icon("comment")}${waiting > 0 ? html`<span class="talk-count" aria-hidden="true">${waiting > 9 ? "9+" : String(waiting)}</span>` : null}</a |
src/web/page_links.ts added +106
| @@ -0,0 +1,106 @@ | ||
| 1 | /** | |
| 2 | * The links every page carries for an agent (RFC 8288), and the pages no search engine should | |
| 3 | * index. `page()` writes both into each page, so this module stays small: the layout imports it, | |
| 4 | * and nearly every test imports the layout. | |
| 5 | */ | |
| 6 | import { repoOnRequest } from "../http/request_repo.ts"; | |
| 7 | import { reportsClosedFor } from "./reports_closed.ts"; | |
| 8 | import { takesOutside } from "../actions/contribute_token.ts"; | |
| 9 | import { REPORT_LINK_TITLE } from "../actions/report_words.ts"; | |
| 10 | import { canRead } from "../core/repos.ts"; | |
| 11 | import type { Ctx } from "../http/context.ts"; | |
| 12 | ||
| 13 | /** | |
| 14 | * The pages that are never a search result: robots.txt keeps a crawler out of them, and | |
| 15 | * each one's head also says `noindex` (`unindexed`), for the crawler that arrives by a link. | |
| 16 | */ | |
| 17 | export const UNINDEXED_PAGES = ["/signin", "/signup", "/settings", "/search"] as const; | |
| 18 | ||
| 19 | /** A page under `UNINDEXED_PAGES`: its head says `noindex`. */ | |
| 20 | export function unindexed(pathname: string): boolean { | |
| 21 | return UNINDEXED_PAGES.some((p) => pathname === p || pathname.startsWith(`${p}/`)); | |
| 22 | } | |
| 23 | ||
| 24 | export interface PageLink { | |
| 25 | readonly rel: string; | |
| 26 | readonly href: string; | |
| 27 | readonly title?: string; | |
| 28 | readonly type?: string; | |
| 29 | } | |
| 30 | ||
| 31 | /** | |
| 32 | * What every page points an agent at, as link relations (RFC 8288): the | |
| 33 | * forge's own description for agents, and — on a public repository's pages | |
| 34 | * — where to report a problem without an account. `page()` writes them both | |
| 35 | * as `<link>` tags and as a `Link` header, so a reader of either finds them. | |
| 36 | */ | |
| 37 | export function pageLinks(ctx: Ctx): PageLink[] { | |
| 38 | const links: PageLink[] = [ | |
| 39 | { rel: "service-doc", href: "/llms.txt", type: "text/plain" }, | |
| 40 | // What the reader of this page can do here, as who they are | |
| 41 | // (`actions/here.ts`), for an agent that would rather not scrape it. | |
| 42 | { | |
| 43 | rel: "alternate", | |
| 44 | href: `/api/v1/here?path=${encodeURIComponent(ctx.url.pathname)}`, | |
| 45 | type: "application/json", | |
| 46 | }, | |
| 47 | ]; | |
| 48 | const owner = ctx.params["owner"]; | |
| 49 | const name = ctx.params["name"]; | |
| 50 | if ( | |
| 51 | owner !== undefined && | |
| 52 | name !== undefined && | |
| 53 | ctx.url.pathname.startsWith(`/${owner}/${name}`) | |
| 54 | ) { | |
| 55 | const repo = repoOnRequest(ctx.app.db, ctx.url, ctx.request.method, owner, name.replace(/\.git$/, "")); | |
| 56 | if ( | |
| 57 | repo !== undefined && | |
| 58 | canRead(ctx.app.db, repo, undefined) && | |
| 59 | !reportsClosedFor(ctx, repo.id) | |
| 60 | ) { | |
| 61 | links.push({ | |
| 62 | rel: "help", | |
| 63 | href: `/${repo.ownerName}/${repo.name}/report`, | |
| 64 | title: REPORT_LINK_TITLE, | |
| 65 | }); | |
| 66 | // A public page unfurls elsewhere through oEmbed; a private one advertises nothing. | |
| 67 | links.push({ | |
| 68 | rel: "alternate", | |
| 69 | href: oembedHref(ctx.url.origin, ctx.url.pathname), | |
| 70 | title: "oEmbed", | |
| 71 | type: OEMBED_TYPE, | |
| 72 | }); | |
| 73 | // The same door for an agent: the endpoint that takes the JSON. | |
| 74 | links.push({ | |
| 75 | rel: "help", | |
| 76 | href: `/api/v1/repos/${repo.ownerName}/${repo.name}/reports`, | |
| 77 | title: "Report a problem as JSON: POST {title, body?, page?}", | |
| 78 | }); | |
| 79 | // The door for a change, only where the owner has said yes to it. | |
| 80 | if (ctx.url.pathname === `/${repo.ownerName}/${repo.name}` && takesOutside(ctx.app, repo)) | |
| 81 | links.push({ | |
| 82 | rel: "help", | |
| 83 | href: "/api/v1/contribute", | |
| 84 | title: "Offer a change: ask for a day's token, push contrib/<name>/..., open a pull", | |
| 85 | }); | |
| 86 | } | |
| 87 | } | |
| 88 | return links; | |
| 89 | } | |
| 90 | ||
| 91 | /** The same links as an HTTP `Link` header value. */ | |
| 92 | export function linkHeader(links: readonly PageLink[]): string { | |
| 93 | return links | |
| 94 | .map( | |
| 95 | (l) => | |
| 96 | `<${l.href}>; rel="${l.rel}"${l.title === undefined ? "" : `; title="${l.title}"`}${l.type === undefined ? "" : `; type="${l.type}"`}`, | |
| 97 | ) | |
| 98 | .join(", "); | |
| 99 | } | |
| 100 | ||
| 101 | export const OEMBED_TYPE = "application/json+oembed"; | |
| 102 | ||
| 103 | /** The `<link>` a public page advertises: where its oEmbed answer is. */ | |
| 104 | export function oembedHref(origin: string, pathname: string): string { | |
| 105 | return `${origin}/oembed?url=${encodeURIComponent(`${origin}${pathname}`)}&format=json`; | |
| 106 | } |
src/web/standards.ts +1 −98
| @@ -29,7 +29,6 @@ | ||
| 29 | 29 | * FORGE_SECURITY_CONTACT. |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | import { repoOnRequest } from "../http/request_repo.ts"; | |
| 33 | 32 | import { noneMatch } from "../http/conditional.ts"; |
| 34 | 33 | import { sshOn } from "../settings/ssh.ts"; |
| 35 | 34 | import { UPSTREAM_REPO } from "../core/upstream.ts"; |
| @@ -37,13 +36,10 @@ import { CRAWL_DELAY_S, DEEP_SEGMENTS } from "../http/crawl.ts"; | ||
| 37 | 36 | import { markPng, type MarkShape } from "../design/mark.ts"; |
| 38 | 37 | import { metaThemeColor } from "../design/themes.ts"; |
| 39 | 38 | import { BODY_MAX, TITLE_MAX } from "../core/reports.ts"; |
| 40 | import { reportsClosedFor } from "./reports_closed.ts"; | |
| 41 | 39 | import { pageDay, sitemapPages } from "./sitemap_pages.ts"; |
| 42 | 40 | import { dayOf } from "../release/days.ts"; |
| 43 | 41 | import { readLandings } from "../release/landings.ts"; |
| 44 | import { takesOutside } from "../actions/contribute_token.ts"; | |
| 45 | 42 | import { OFFER_PATCH_MAX, OFFERS_PER_SOURCE } from "../actions/offer.ts"; |
| 46 | import { REPORT_LINK_TITLE } from "../actions/report_words.ts"; | |
| 47 | 43 | import { sshTellCommand } from "../ssh/command.ts"; |
| 48 | 44 | import { llmsRepos, newestLanding, sitemapRepos, type LlmsListing } from "../core/listings.ts"; |
| 49 | 45 | import { canRead, getRepo, type Repo } from "../core/repos.ts"; |
| @@ -69,6 +65,7 @@ import { GUIDE } from "../view/guide.ts"; | ||
| 69 | 65 | import { loadMcp } from "../http/mcp/load.ts"; |
| 70 | 66 | import { timePhase, timePhaseAsync } from "../core/route_timing.ts"; |
| 71 | 67 | import { shippedReleases, type Shipped } from "../release/shipped.ts"; |
| 68 | import { UNINDEXED_PAGES } from "./page_links.ts"; | |
| 72 | 69 | |
| 73 | 70 | const DAY = 24 * 60 * 60 * 1000; |
| 74 | 71 | |
| @@ -309,17 +306,6 @@ export function releasesJson(ctx: Ctx): Response { | ||
| 309 | 306 | /** The releases document and its ETag, per origin, made again when the tags read differently. */ |
| 310 | 307 | const releasesBodies = new Map<string, { list: readonly Shipped[]; body: string; etag: string }>(); |
| 311 | 308 | |
| 312 | /** | |
| 313 | * The pages that are never a search result: robots.txt keeps a crawler out of them, and | |
| 314 | * each one's head also says `noindex` (`unindexed`), for the crawler that arrives by a link. | |
| 315 | */ | |
| 316 | export const UNINDEXED_PAGES = ["/signin", "/signup", "/settings", "/search"] as const; | |
| 317 | ||
| 318 | /** A page under `UNINDEXED_PAGES`: its head says `noindex`. */ | |
| 319 | export function unindexed(pathname: string): boolean { | |
| 320 | return UNINDEXED_PAGES.some((p) => pathname === p || pathname.startsWith(`${p}/`)); | |
| 321 | } | |
| 322 | ||
| 323 | 309 | /** GET /robots.txt */ |
| 324 | 310 | export function robotsTxt(ctx: Ctx): Response { |
| 325 | 311 | return textWithEtag( |
| @@ -708,93 +694,10 @@ function renderLlmsTxt(ctx: Ctx, o: string, tell: string | undefined, running: s | ||
| 708 | 694 | ); |
| 709 | 695 | } |
| 710 | 696 | |
| 711 | export interface PageLink { | |
| 712 | readonly rel: string; | |
| 713 | readonly href: string; | |
| 714 | readonly title?: string; | |
| 715 | readonly type?: string; | |
| 716 | } | |
| 717 | ||
| 718 | /** | |
| 719 | * What every page points an agent at, as link relations (RFC 8288): the | |
| 720 | * forge's own description for agents, and — on a public repository's pages | |
| 721 | * — where to report a problem without an account. `page()` writes them both | |
| 722 | * as `<link>` tags and as a `Link` header, so a reader of either finds them. | |
| 723 | */ | |
| 724 | export function pageLinks(ctx: Ctx): PageLink[] { | |
| 725 | const links: PageLink[] = [ | |
| 726 | { rel: "service-doc", href: "/llms.txt", type: "text/plain" }, | |
| 727 | // What the reader of this page can do here, as who they are | |
| 728 | // (`actions/here.ts`), for an agent that would rather not scrape it. | |
| 729 | { | |
| 730 | rel: "alternate", | |
| 731 | href: `/api/v1/here?path=${encodeURIComponent(ctx.url.pathname)}`, | |
| 732 | type: "application/json", | |
| 733 | }, | |
| 734 | ]; | |
| 735 | const owner = ctx.params["owner"]; | |
| 736 | const name = ctx.params["name"]; | |
| 737 | if ( | |
| 738 | owner !== undefined && | |
| 739 | name !== undefined && | |
| 740 | ctx.url.pathname.startsWith(`/${owner}/${name}`) | |
| 741 | ) { | |
| 742 | const repo = repoOnRequest(ctx.app.db, ctx.url, ctx.request.method, owner, name.replace(/\.git$/, "")); | |
| 743 | if ( | |
| 744 | repo !== undefined && | |
| 745 | canRead(ctx.app.db, repo, undefined) && | |
| 746 | !reportsClosedFor(ctx, repo.id) | |
| 747 | ) { | |
| 748 | links.push({ | |
| 749 | rel: "help", | |
| 750 | href: `/${repo.ownerName}/${repo.name}/report`, | |
| 751 | title: REPORT_LINK_TITLE, | |
| 752 | }); | |
| 753 | // A public page unfurls elsewhere through oEmbed; a private one advertises nothing. | |
| 754 | links.push({ | |
| 755 | rel: "alternate", | |
| 756 | href: oembedHref(ctx.url.origin, ctx.url.pathname), | |
| 757 | title: "oEmbed", | |
| 758 | type: OEMBED_TYPE, | |
| 759 | }); | |
| 760 | // The same door for an agent: the endpoint that takes the JSON. | |
| 761 | links.push({ | |
| 762 | rel: "help", | |
| 763 | href: `/api/v1/repos/${repo.ownerName}/${repo.name}/reports`, | |
| 764 | title: "Report a problem as JSON: POST {title, body?, page?}", | |
| 765 | }); | |
| 766 | // The door for a change, only where the owner has said yes to it. | |
| 767 | if (ctx.url.pathname === `/${repo.ownerName}/${repo.name}` && takesOutside(ctx.app, repo)) | |
| 768 | links.push({ | |
| 769 | rel: "help", | |
| 770 | href: "/api/v1/contribute", | |
| 771 | title: "Offer a change: ask for a day's token, push contrib/<name>/..., open a pull", | |
| 772 | }); | |
| 773 | } | |
| 774 | } | |
| 775 | return links; | |
| 776 | } | |
| 777 | ||
| 778 | /** The same links as an HTTP `Link` header value. */ | |
| 779 | export function linkHeader(links: readonly PageLink[]): string { | |
| 780 | return links | |
| 781 | .map( | |
| 782 | (l) => | |
| 783 | `<${l.href}>; rel="${l.rel}"${l.title === undefined ? "" : `; title="${l.title}"`}${l.type === undefined ? "" : `; type="${l.type}"`}`, | |
| 784 | ) | |
| 785 | .join(", "); | |
| 786 | } | |
| 787 | ||
| 788 | 697 | // ---- /oembed: the oEmbed 1.0 link card of a public repository or app page (never fetches the url) |
| 789 | 698 | |
| 790 | export const OEMBED_TYPE = "application/json+oembed"; | |
| 791 | 699 | const URL_MAX = 2048; |
| 792 | 700 | |
| 793 | /** The `<link>` a public page advertises: where its oEmbed answer is. */ | |
| 794 | export function oembedHref(origin: string, pathname: string): string { | |
| 795 | return `${origin}/oembed?url=${encodeURIComponent(`${origin}${pathname}`)}&format=json`; | |
| 796 | } | |
| 797 | ||
| 798 | 701 | /** |
| 799 | 702 | * `[owner, name]` from a url on `origin`; undefined when it is another host or names no repository. |
| 800 | 703 | */ |
test/layout-closure.test.ts added +64
| @@ -0,0 +1,64 @@ | ||
| 1 | /** | |
| 2 | * The layout stays a small module. Nearly every test reaches `src/web/layout.ts`, so whatever | |
| 3 | * the layout imports, those tests load and the import graph picks them for a change there. | |
| 4 | * It reached the HTTP server and the MCP tools once, through the Talk button's count of waiting | |
| 5 | * confirms and the page links, which put 4,416 of the tree's files behind every page. Red here | |
| 6 | * when an import brings that path back, or when the closure grows past {@link CLOSURE_MAX}. | |
| 7 | * | |
| 8 | * Reads files; boots nothing. | |
| 9 | * | |
| 10 | * @tree-scan: walks the import graph from src/web/layout.ts. | |
| 11 | */ | |
| 12 | ||
| 13 | import { describe, expect, test } from "bun:test"; | |
| 14 | import { existsSync } from "node:fs"; | |
| 15 | import { importsReader } from "../scripts/tier-input.ts"; | |
| 16 | ||
| 17 | const LAYOUT = "src/web/layout.ts"; | |
| 18 | ||
| 19 | /** | |
| 20 | * The layout's import closure was 1,656 source files when this guard was written; lower it as cuts | |
| 21 | * land. | |
| 22 | */ | |
| 23 | const CLOSURE_MAX = 2000; | |
| 24 | ||
| 25 | /** Modules the layout must never load: the server and every route it mounts, and the MCP tools. */ | |
| 26 | const KEPT_OUT = (f: string) => f === "src/http/server.ts" || f === "src/http/mcp.ts" || f.startsWith("src/http/mcp/"); | |
| 27 | ||
| 28 | /** | |
| 29 | * Every file reachable from `start` by static and literal dynamic imports, each with the file that | |
| 30 | * first imported it. | |
| 31 | */ | |
| 32 | function closure(start: string): Map<string, string> { | |
| 33 | const imports = importsReader(); | |
| 34 | const from = new Map<string, string>([[start, ""]]); | |
| 35 | const stack = [start]; | |
| 36 | while (stack.length > 0) { | |
| 37 | const f = stack.pop()!; | |
| 38 | for (const i of imports(f)) | |
| 39 | if (!from.has(i) && existsSync(i)) { | |
| 40 | from.set(i, f); | |
| 41 | stack.push(i); | |
| 42 | } | |
| 43 | } | |
| 44 | return from; | |
| 45 | } | |
| 46 | ||
| 47 | /** The import chain from the layout to `f`, for the failure message. */ | |
| 48 | function chain(from: Map<string, string>, f: string): string { | |
| 49 | const path = [f]; | |
| 50 | for (let x = from.get(f); x; x = from.get(x)) path.unshift(x); | |
| 51 | return path.join(" -> "); | |
| 52 | } | |
| 53 | ||
| 54 | describe("the layout's import closure", () => { | |
| 55 | const from = closure(LAYOUT); | |
| 56 | ||
| 57 | test("never reaches the server or the MCP tools", () => { | |
| 58 | expect([...from.keys()].filter(KEPT_OUT).map((f) => chain(from, f))).toEqual([]); | |
| 59 | }); | |
| 60 | ||
| 61 | test(`stays under ${CLOSURE_MAX} source files`, () => { | |
| 62 | expect([...from.keys()].filter((f) => f.startsWith("src/")).length).toBeLessThanOrEqual(CLOSURE_MAX); | |
| 63 | }); | |
| 64 | }); |
test/public-head.test.ts +1 −1
| @@ -12,7 +12,7 @@ import { createSession } from "../src/core/sessions.ts"; | ||
| 12 | 12 | import { catalog } from "../src/packs/catalog.ts"; |
| 13 | 13 | import { seedPacks } from "./helpers/packs.ts"; |
| 14 | 14 | import { serve, type Servers } from "../src/http/server.ts"; |
| 15 | import { UNINDEXED_PAGES } from "../src/web/standards.ts"; | |
| 15 | import { UNINDEXED_PAGES } from "../src/web/page_links.ts"; | |
| 16 | 16 | |
| 17 | 17 | /** The content of the first tag matching, or undefined when there is none. */ |
| 18 | 18 | function meta(html: string, key: "name" | "property", value: string): string | undefined { |
test/worker-database-opens.test.ts −5
| @@ -56,21 +56,16 @@ const ONE_JOB: Record<string, string> = { | ||
| 56 | 56 | * that no Worker calls these. |
| 57 | 57 | */ |
| 58 | 58 | const REACHED: Record<string, { opens: number; why: string }> = { |
| 59 | "src/apps/changes.ts": { opens: 1, why: "an app's change stream keeps one handle per app database, opened on its first read or append, on the serving thread behind a request; no Worker calls it" }, | |
| 60 | 59 | "src/apps/data.ts": { opens: 1, why: "quiesceSqlite folds each app database's log before a copy: called by the serving thread's clone and backup paths, in reach of Workers only through the page layer's imports" }, |
| 61 | 60 | "src/apps/dump_import.ts": { opens: 3, why: "a person's import of a dump, on the serving thread behind a request; no Worker calls it" }, |
| 62 | "src/apps/dump_undo.ts": { opens: 1, why: "an undo folds the live store's log before it is set aside, on the serving thread behind an admin's request; no Worker calls it" }, | |
| 63 | 61 | "src/crew/sentinel.ts": { opens: 1, why: "one scratch database in memory, made once for the process and remembered; the sentinel is a duty of the serving thread" }, |
| 64 | "src/data/browse.ts": { opens: 1, why: "openReadOnly for a data page, on the serving thread behind a request; no Worker calls it" }, | |
| 65 | 62 | "src/kernel/db.ts": { opens: 2, why: "the forge's own database, opened once by createApp on the thread that boots; the Workers that read it open their own handle and keep it (KEEPS)" }, |
| 66 | 63 | "src/release/rollback.ts": { opens: 1, why: "liveSchema reads the schema count once for a rollback or a swap, on the serving thread or in the release tool" }, |
| 67 | 64 | "src/snapshot/drill.ts": { opens: 1, why: "a restore drill opens the restored copy once, as a duty of the serving thread" }, |
| 68 | 65 | "src/snapshot/drill_hosted.ts": { opens: 1, why: "a restore drill opens the one hosted forge it restored once, for its integrity check, in the drill's own process or as a duty of the serving thread; no Worker calls it" }, |
| 69 | 66 | "src/snapshot/restore.ts": { opens: 1, why: "a restore reads the sealed names of the restored copy once, in the restore tool or a drill on the serving thread" }, |
| 70 | 67 | "src/snapshot/snapshot.ts": { opens: 1, why: "a snapshot counts the rows of its own copy once, as a duty of the serving thread (a hosted forge's copy is read in a process of its own, snapshot/hosted_copy.ts); the mirror Worker imports this file for the manifest only" }, |
| 71 | "src/spawn/move_in.ts": { opens: 1, why: "inspect opens one uploaded copy of a browser forge's database once, read-only, to count its rows before a move, on the serving thread behind an admin's request; no Worker calls it" }, | |
| 72 | 68 | "src/spawn/child_runs.ts": { opens: 2, why: "called by the reader process (spawn/child_db_reader.ts), never by a thread of the forge; cell.ts re-exports the two for tests that read a file directly" }, |
| 73 | "src/web/render/sqlite.ts": { opens: 1, why: "a committed .sqlite file is deserialized read-only in memory for its page, on the serving thread behind a request; a Worker reaches it only through src/generated/screens.ts, which lists every screen so the bundle holds them, and calls no open" }, | |
| 74 | 69 | "src/system/compact.ts": { opens: 2, why: "compactFile opens the database and its copy once each, called only by the compaction's own process (system/compact_child.ts) at boot when the compact-on-boot marker asks; Workers reach the file through db_size.ts's keptCopies, which opens nothing" }, |
| 75 | 70 | }; |
| 76 | 71 |
new above
offline