Skip to the content

Capsid menu

app/lib/colophon-sections.mjs

279 lines and 10 functions in DrDustinEdwards/dustinedwards-info, at commit 1590ba4 on 2026-10-24. This file on GitHub.

Functions

The functions of colophon-sections.mjs
FunctionLinesComplexityCoveredCRAPMutation
<anonymous:189>189 to 1891100%OkCRAP 1No data: no mutants in this code
statusLabel205 to 2142100%OkCRAP 2No data: no mutants in this code
colophonPages220 to 222133%OkCRAP 1.3No data: no mutants in this code
colophonPageInput228 to 29910%OkCRAP 2No data: no mutants in this code
contentFor230 to 285120%CriticalCRAP 156No data: no mutants in this code
<anonymous:241>241 to 24210%OkCRAP 2No data: no mutants in this code
<anonymous:254>254 to 25410%OkCRAP 2No data: no mutants in this code
<anonymous:259>259 to 25910%OkCRAP 2No data: no mutants in this code
<anonymous:275>275 to 27610%OkCRAP 2No data: no mutants in this code
<anonymous:293>293 to 29710%OkCRAP 2No data: no mutants in this code

Imports

It imports no other module of this repo. Imported by app/routes/colophon.tsx.

Source

/*
 * One list read by both the page and the search index: a record pointing at a
 * fragment the page no longer has still looks like a hit and scrolls nowhere.
 * Nothing here reads the clock, filesystem or git; records must be pure.
 */

export const COLOPHON_URL = "/colophon";

/** Deliberately not the URL: `/colophon` is the IndieWeb convention, but the word is not widely known. */
export const COLOPHON_TITLE = "How this site is built";

export const COLOPHON_DESCRIPTION =
  "The stack behind dustinedwards.info: every binding, migration and gate, " +
  "generated from the repository's own configuration, with what was " +
  "deliberately not adopted and why.";

/**
 * The site's versions. WordPress is named for version 2 because the WordPress export's earliest item is
 * dated 2016-12-05; version 1's platform is not recorded anywhere this repo can read, so it is not named.
 */
export const COLOPHON_VERSIONS =
  "This is the third version of dustinedwards.info. The first launched in 2006, the second, " +
  "on WordPress, in 2016, and this one in 2026.";

export const COLOPHON_INTRO =
  "Everything below is generated from this repository's own configuration and " +
  "checked against it in both directions on every build. If a binding is added " +
  "and this page is not regenerated, the build fails. The one thing no " +
  "generator can produce is why each piece is load-bearing, so those notes are " +
  "written by hand and reconciled against the bindings they describe.";

/**
 * Order is load-bearing: record `ordinal` is derived from the index here.
 *
 * @type {ReadonlyArray<{ id: string, title: string, lead: string }>}
 */
export const COLOPHON_SECTIONS = /** @type {const} */ ([
  {
    id: "runtime",
    title: "Runtime",
    lead:
      "The compatibility date, the flags the Worker runs under, and the Node " +
      "version the build is pinned to.",
  },
  {
    id: "bindings",
    title: "Bindings",
    lead:
      "Every resource this Worker holds a handle to, with what it is for and " +
      "the measurement that put it there rather than a logo wall.",
  },
  {
    id: "schema",
    title: "Schema",
    lead:
      "Hand-written migrations, applied in order. drizzle-kit is deliberately " +
      "not a dependency, and because the database export command is broken on " +
      "this schema, this directory is the only copy of the table definitions " +
      "that exists anywhere.",
  },
  {
    id: "gates",
    title: "Gates",
    lead:
      "Checks that run before anything ships. The list is derived from the " +
      "scripts themselves rather than maintained beside them, so a gate that " +
      "is added and forgotten is not possible.",
  },
  {
    id: "dependencies",
    title: "Dependencies",
    lead:
      "The runtime dependencies. Build tooling is excluded: this is what " +
      "serves the site, not what assembles it.",
  },
  {
    id: "features",
    title: "What it does",
    lead:
      "Nothing in this section can be generated from configuration, so each " +
      "entry carries an anchor and a gate verifies that the thing the claim is " +
      "about still exists. It does not verify that the sentence is true, which " +
      "is the honest boundary of the technique.",
  },
  {
    id: "security",
    title: "A tradeoff in the security headers",
    lead:
      "The content security policy is enforced, not merely reported. One part " +
      "of it is a compromise rather than a clean win, and the compromise is " +
      "worth stating plainly.",
  },
  {
    id: "ai",
    title: "AI disclosure",
    lead:
      "This site is built with AI assistance and says so here rather than " +
      "leaving you to guess, because a site about how it is built owes you " +
      "that before it owes you anything else.",
  },
  {
    id: "run",
    title: "How the site is run",
    lead:
      "Three other systems of mine sit behind or beside this one. None is part " +
      "of this repository.",
  },
  {
    id: "not-adopted",
    title: "What was not adopted",
    lead:
      "Anyone can list what they shipped. A refusal is a decision that was " +
      "made and recorded: not a thing nobody got to, but a thing somebody " +
      "ruled out, with the reason beside it.",
  },
]);

/** @type {ReadonlyArray<string>} */
export const SECURITY_TRADEOFF = Object.freeze([
  "Every response carries a one-time number that scripts on the page must " +
    "quote to be allowed to run. That number is generated per response.",
  "Seven pages of this site are cached at Cloudflare's edge and served to " +
    "everyone from the same stored copy for up to ten minutes. The number is " +
    "part of that copy, so visitors served from one cache entry share it.",
  "We took that trade deliberately. The alternative is to stop caching those " +
    "pages, which would make every reader wait for the origin on every visit.",
  "It is acceptable only because these pages carry no writing from anyone but " +
    "me. There are no comments and no user submissions, so there is nowhere " +
    "for a stranger's script to get in and use the shared number.",
]);

/**
 * The last sentence is conditional on purpose: provider text marks do not survive
 * hand editing, so the page must not claim a reader can check for one.
 *
 * @type {ReadonlyArray<string>}
 */
export const AI_DISCLOSURE = Object.freeze([
  "The code and the prose here are written with AI assistance. The model is " +
    "Anthropic's Claude, driven through Claude Code, and it reaches this site " +
    "through exactly the same publishing API and the same gates a person does.",
  "Nothing goes public on a model's say-so. Making a post public for the first " +
    "time is reserved to me and the reservation is enforced in code, not asked " +
    "for in a prompt: an agent that attempts it is refused by name.",
  "Every published post has been read and edited by me before it went live, so " +
    "what you are reading is human-reviewed writing I am answerable for rather " +
    "than model output passed straight through.",
  "Where a provider marks its model's output in a machine-readable way, that " +
    "mark does not survive being edited, so it is not something you can check " +
    "on this page. The review above is the guarantee instead, which is why it " +
    "is stated as a practice and not as a badge.",
]);

/** @type {ReadonlyArray<string>} */
export const SITE_OPERATION = Object.freeze([
  "Capsid is the site's memory and job queue. It stores the project's " +
    "decisions and current state, and it hands work from a conversation to a " +
    "working session as a signed job that ends in a pull request.",
]);

/**
 * Carrel's one sentence. Its name links to its page on this site (Dustin, 2026-09-28), never to the
 * app, which is private; the footer's Workspace link is the separate sign-in.
 */
export const CARREL_PAGE_PATH = "/software/carrel";
export const CARREL_NAME = "Carrel";
const CARREL_SENTENCE =
  "Carrel is my private writing hub, behind a login, where articles are " +
  "written before they are published here. A finished article reaches this " +
  "site through a small keyed API.";

/** The sentence after its linked name, which is how the page renders it. */
export const CARREL_SENTENCE_REST = CARREL_SENTENCE.slice(CARREL_NAME.length);

export const CAPSID_REPO_URL = "https://github.com/DrDustinEdwards/capsid";

/**
 * Capsomer's one sentence. Its name links to its public site, which answers 200 (checked 2026-10-02).
 * Capsid's public site, capsid.dustinedwards.info, did not answer then, so Capsid keeps its repository
 * link until it does (job_a8f7cfc629de).
 */
export const CAPSOMER_NAME = "Capsomer";
export const CAPSOMER_URL = "https://capsomer.dustinedwards.info";
const CAPSOMER_SENTENCE = "Capsomer is the shared design system this site will adopt.";

/** The sentence after its linked name, which is how the page renders it. */
export const CAPSOMER_SENTENCE_REST = CAPSOMER_SENTENCE.slice(CAPSOMER_NAME.length);

export const COLOPHON_ANCHORS = COLOPHON_SECTIONS.map((s) => s.id);

/**
 * `check:features` asserts both directions over this map, so a label no entry
 * uses fails the gate; add a status here only together with its first entry.
 *
 * @type {Record<string, string>}
 */
export const STATUS_LABEL = {
  refused: "Refused",
};

/**
 * @param {string} status
 * @returns {string}
 */
export function statusLabel(status) {
  const label = STATUS_LABEL[status];
  if (!label) {
    throw new Error(
      `no label for not-adopted status "${status}". Add one to STATUS_LABEL, ` +
        `or the page and the search index would disagree about what it is called.`,
    );
  }
  return label;
}

/**
 * @param {any} stack   content/generated/stack.json
 * @param {any} features content/features.json
 */
export function colophonPages(stack, features) {
  return [colophonPageInput(stack, features)];
}

/**
 * @param {any} stack   content/generated/stack.json
 * @param {any} features content/features.json
 */
function colophonPageInput(stack, features) {
  /** @param {string} id @returns {string} */
  const contentFor = (id) => {
    if (id === "runtime") {
      return [
        `Compatibility date ${stack.runtime.compatibilityDate}.`,
        `Compatibility flags ${stack.runtime.compatibilityFlags.join(", ") || "none"}.`,
        `Node ${stack.runtime.nodeVersion}.`,
      ].join(" ");
    }
    if (id === "bindings") {
      return stack.bindings
        .map(
          (/** @type {any} */ b) =>
            `${b.name} (${b.kind}). ${b.what} ${b.whyLoadBearing}`,
        )
        .join(" ");
    }
    if (id === "schema") {
      return stack.migrations.join(" ");
    }
    if (id === "gates") {
      return stack.gates.join(" ");
    }
    if (id === "dependencies") {
      return stack.dependencies
        .map((/** @type {any} */ d) => `${d.name} ${d.range}`)
        .join(" ");
    }
    if (id === "features") {
      return features.features
        .map((/** @type {any} */ f) => `${f.component}. ${f.name}. ${f.what}`)
        .join(" ");
    }
    if (id === "security") {
      return SECURITY_TRADEOFF.join(" ");
    }
    if (id === "ai") {
      return AI_DISCLOSURE.join(" ");
    }
    if (id === "run") {
      return `${SITE_OPERATION.join(" ")} ${CARREL_SENTENCE} Capsid's source is public at ${CAPSID_REPO_URL}. ${CAPSOMER_SENTENCE} Its site is ${CAPSOMER_URL}.`;
    }
    if (id === "not-adopted") {
      // The label, never `n.status`: the page shows the label, so the index must.
      return stack.notAdopted
        .map(
          (/** @type {any} */ n) =>
            `${n.name} (${statusLabel(n.status)}). ${n.reason}`,
        )
        .join(" ");
    }
    // Fail closed: otherwise a new section is silently indexed as its lead alone.
    throw new Error(
      `colophonPageInput has no body rule for section "${id}". ` +
        `Add one, or the section would be indexed without its content.`,
    );
  };

  return {
    url: COLOPHON_URL,
    uid: "page:colophon",
    title: COLOPHON_TITLE,
    description: COLOPHON_DESCRIPTION,
    intro: `${COLOPHON_VERSIONS} ${COLOPHON_INTRO}`,
    sections: COLOPHON_SECTIONS.map((section) => ({
      anchor: section.id,
      title: section.title,
      body: `${section.lead} ${contentFor(section.id)}`,
    })),
  };
}