Skip to content
Myr

vellum.ts

This file

Path

apps/web/src/dev/fixtures/vellum.ts

1,911 lines · 53.1 KiB · TypeScript

Last changed by

Merge build/maintainer-wording into mainoscabrielbefore adoption4c1a571

History of this file

Take it

1import { Brand } from "@repo/brand";2import { childId, deleteChildId } from "@repo/project/migrate";3import type { HeldBackResult } from "@repo/protocol/domain/answer";4import type { Ask } from "@repo/protocol/domain/ask";5import { CheckSpec, RatchetMeasure } from "@repo/protocol/domain/check";6import { Command, JsonPath, SymbolName } from "@repo/protocol/domain/common";7import type { Decision, DecisionSubject } from "@repo/protocol/domain/decision";8import { DecisionSubject as Subject } from "@repo/protocol/domain/decision";9import type { EnvSchemaView } from "@repo/protocol/domain/env";10import { Outcome } from "@repo/protocol/domain/outcome";11import { DraftState } from "@repo/protocol/domain/proposal";12import type { Proposal } from "@repo/protocol/domain/proposal";13import { Territory } from "@repo/protocol/domain/territory";14import { LedgerEntry } from "@repo/protocol/domain/visibility";15import type { Ledger } from "@repo/protocol/domain/visibility";16import type { Handle, LandedSha } from "@repo/protocol/ids";17import {18  AreaName,19  AskId,20  DecisionId,21  EnvKey,22  KindName,23  LaneName,24  keyOf,25  LayerName,26  ProjectName,27  ProposalId,28  RatchetName,29  RepoName,30  RepoPath,31} from "@repo/protocol/ids";32import {33  ChecksFailed,34  HeldBackFailed,35  OutOfScope,36  Weakened,37} from "@repo/protocol/refusal";38import { Array, DateTime, Effect, Schema } from "effect";3940import { DevClock } from "../clock.ts";41import {42  askFileOf,43  burrowPeople,44  datekitPeople,45  policyJson,46} from "../examples.ts";47import type { StatedAsk } from "../examples.ts";48import type { Files } from "../git.ts";49import { visitors } from "../seed.ts";50import { checkOf } from "./fillers.ts";51import { headOf, instant, present, storyOf, suiteOf } from "./story.ts";52import type { Story } from "./story.ts";5354export const vellum = ProjectName.make("oscabriel/vellum");5556export const fixturesNow = instant("2026-10-07T10:00");5758export const vellumStart = instant("2026-08-24T09:00");5960const dir = Brand.configDir;6162const people = {63  bram: datekitPeople.contributor,64  ines: datekitPeople.decider,65  lin: burrowPeople.second,66  okafor: burrowPeople.decider,67  okonkwo: datekitPeople.zones,68  sefa: visitors.flagger,69  tove: visitors.proposer,70  wren: visitors.regular,71} as const;7273export { operator as vellumInitializer } from "../examples.ts";7475const MODULES = [76  "cli",77  "export",78  "lint",79  "parser",80  "render",81  "themes",82] as const;8384type Module = (typeof MODULES)[number];8586const moduleName = (module: Module) => `@vellum/${module}`;8788const territoryOf = (module: Module): Territory => ({89  module: moduleName(module),90  paths: [91    Schema.decodeSync(Territory.fields.paths)([`packages/${module}/**`])[0],92  ],93});9495const LANES = {96  lint: "bun run lint",97  types: "bun run typecheck",98  unit: "bun test",99} as const;100101const TEST = "bun test {path}";102103const MAIN_REF = Schema.decodeSync(Subject.cases.StrayPush.fields.ref)(104  "refs/heads/main"105);106107const WIDER_HOSTS = Schema.decodeSync(Subject.cases.ProxyWidened.fields.hosts)([108  "sentry.io",109  "ingest.sentry.io",110]);111112const EXPORT = AreaName.make("export");113114const PARSER = AreaName.make("parser");115116const exportSuite = suiteOf("export");117118const parserSuite = suiteOf("parser");119120const held = (121  area: AreaName,122  passed: number,123  total: number124): HeldBackResult => ({125  area,126  passed,127  suite: area === EXPORT ? exportSuite : parserSuite,128  total,129});130131const encodeCheck = Schema.encodeSync(CheckSpec);132133const COUNT = Command.make("bun scripts/count-callers.ts oldTokenize --json");134135const COUNT_PAGES = Command.make(136  "bun scripts/count-callers.ts pageSize --json"137);138139const packageJson = (module: Module) =>140  `${JSON.stringify(141    {142      exports: { ".": "./src/index.ts" },143      name: moduleName(module),144      type: "module",145    },146    null,147    2148  )}\n`;149150const entryOf = (module: Module, tokenize: string) =>151  [152    `import { ${tokenize} } from "@vellum/parser/tokenize";`,153    "",154    `/** ${moduleName(module)}: reads a document's words, then its marks. */`,155    `export const words = (text: string) => ${tokenize}(text).filter((token) => token.kind === "word");`,156    "",157    `export const marks = (text: string) => ${tokenize}(text).filter((token) => token.kind === "mark");`,158    "",159  ].join("\n");160161const pageOf = (module: Module, name: string) =>162  [163    `/** ${moduleName(module)}'s page: A4 unless a theme says otherwise. */`,164    `export const ${name} = { height: 297, width: 210 } as const;`,165    "",166  ].join("\n");167168const PAGED: readonly Module[] = ["cli", "render", "themes"];169170const ENV_SCHEMA = [171  "# vellum's environment. Values never live in the repo.",172  "",173  "# @sensitive @required",174  "# @type=string(startsWith=sntrys_)",175  "# @docsUrl=https://docs.sentry.io/account/auth-tokens/",176  "# Uploads source maps and error reports from `vellum export`.",177  "SENTRY_AUTH_TOKEN=",178  "",179  "# @type=url",180  "# Where error reports go; public.",181  "SENTRY_DSN=",182  "",183  "# @type=string",184  "# A folder of fonts the PDF export embeds.",185  "VELLUM_FONT_DIR=",186  "",187  "# @deprecated The PDF export no longer shells out; it is ignored.",188  "LEGACY_PDF_ENGINE=",189  "",190].join("\n");191192export const decisionsPerDay = 5;193194const CLAIMS = { lapseAfter: { hours: 96 }, warnAfter: { hours: 48 } } as const;195196const HOUR_MS = 3_600_000;197198const policy = policyJson({199  asks: [],200  budget: { decisionsPerDay, expireDays: 3 },201  caps: { claimsPerPerson: 3, proposalsPerPerson: 2 },202  claims: {203    lapseAfterMs: CLAIMS.lapseAfter.hours * HOUR_MS,204    warnAfterMs: CLAIMS.warnAfter.hours * HOUR_MS,205  },206  deciders: [207    { handles: [people.ines], paths: "**" },208    { handles: [people.ines, people.lin], paths: `${dir}/**` },209    { handles: [people.okonkwo], paths: "packages/export/**" },210    { handles: [people.okonkwo], paths: ".env.schema" },211    { handles: [people.okonkwo], paths: `${dir}/vouched.td` },212  ],213  functions: { admit: false, opensAlone: false },214  kinds: [215    {216      checkKind: "redThenGreen",217      claimers: "vouched",218      finish: "optional",219      name: "fix",220      oneWay: false,221      race: 1,222      requires: ["want", "check", "territory"],223      strength: "assertion",224    },225    {226      checkKind: "redThenGreen",227      claimers: "vouched",228      finish: "required",229      name: "polish",230      oneWay: false,231      race: 1,232      requires: ["want", "check", "territory"],233      strength: "assertion",234    },235    {236      checkKind: "migrate",237      claimers: "vouched",238      finish: "never",239      name: "migrate",240      oneWay: false,241      race: 1,242      requires: ["want", "check", "territory"],243      strength: "assertion",244    },245  ],246  ratchets: [247    {248      measure: Schema.encodeSync(RatchetMeasure)(249        RatchetMeasure.cases.Metric.make({250          command: Command.make("bun scripts/bundle-size.ts --json"),251          path: JsonPath.make("$.bytes"),252        })253      ),254      name: "bundle-bytes",255    },256  ],257  run: { checks: LANES, test: TEST },258  source: "config",259  weakening: { markers: [".skip(", ".only(", ".todo("] },260});261262export const vellumFiles: Files = new Map([263  [264    "README.md",265    [266      "# vellum",267      "",268      "Reads and writes a small document format: a parser, a renderer, themes, a linter, an exporter (HTML, EPUB and PDF) and a CLI.",269      "",270      "A fictional project: it and its people are invented.",271      "",272    ].join("\n"),273  ],274  [275    "package.json",276    `${JSON.stringify(277      {278        name: "vellum",279        private: true,280        scripts: {281          lint: "oxlint",282          test: "bun test",283          typecheck: "tsc --noEmit",284        },285        workspaces: ["packages/*"],286      },287      null,288      2289    )}\n`,290  ],291  [".env.schema", ENV_SCHEMA],292  [293    "scripts/count-callers.ts",294    [295      "// Prints how many times each package calls a name, as JSON.",296      'import { Glob } from "bun";',297      "",298      "const [name] = Bun.argv.slice(2);",299      "const byModule: Record<string, number> = {};",300      "",301      'for await (const path of new Glob("packages/*/src/**/*.ts").scan()) {',302      '  const module = "@vellum/" + path.split("/")[1];',303      '  byModule[module] = (byModule[module] ?? 0) + ((await Bun.file(path).text()).split(name + "(").length - 1);',304      "}",305      "",306      "console.log(JSON.stringify({ byModule, total: Object.values(byModule).reduce((a, b) => a + b, 0) }));",307      "",308    ].join("\n"),309  ],310  ...MODULES.flatMap((module): (readonly [string, string])[] => [311    [`packages/${module}/package.json`, packageJson(module)],312    [313      `packages/${module}/src/index.ts`,314      module === "parser"315        ? [316            "export interface Token {",317            '  readonly kind: "word" | "mark";',318            "  readonly text: string;",319            "}",320            "",321            'export { oldTokenize, tokenize } from "./tokenize.ts";',322            "",323          ].join("\n")324        : entryOf(module, "oldTokenize"),325    ],326  ]),327  [328    "packages/parser/src/tokenize.ts",329    [330      'import type { Token } from "./index.ts";',331      "",332      "const read = (text: string): Token[] =>",333      "  text.split(/(\\s+|[*_`#>])/u).filter(Boolean).map((part) => ({",334      '    kind: /^[*_`#>]$/u.test(part) ? "mark" : "word",',335      "    text: part,",336      "  }));",337      "",338      "/** The tokenizer every package moves to. */",339      "export const tokenize = read;",340      "",341      "/** The first tokenizer, kept until nothing calls it. */",342      "export const oldTokenize = (text: string): Token[] => read(text.trim());",343      "",344    ].join("\n"),345  ],346  ...PAGED.map(347    (module) =>348      [`packages/${module}/src/page.ts`, pageOf(module, "pageSize")] as const349  ),350  [`${dir}/policy.json`, policy],351  [352    `${dir}/vouched.td`,353    [354      "# The people vellum's maintainers vouch for.",355      people.bram,356      people.okafor,357      people.lin,358      `${people.tove} Started with the CLI docs.`,359      `${people.sefa} Came from the parser's issue thread.`,360      `-${people.wren} Opened proposals that advertised a paid fork.`,361      "",362    ].join("\n"),363  ],364]);365366type Stated = Omit<Ask, "openedAt" | "openedIn" | "project">;367368const fix = (input: {369  readonly id: string;370  readonly module: Module;371  readonly territory?: Territory;372  readonly want: string;373  readonly current?: string;374  readonly askedBy?: Handle;375  readonly kind?: "fix" | "polish";376  readonly blockedBy?: readonly AskId[];377  readonly mentor?: Handle;378}): Stated => {379  const id = AskId.make(input.id);380381  const territory = input.territory ?? territoryOf(input.module);382  const home = `packages/${input.module}`;383384  return {385    askedBy: input.askedBy ?? people.ines,386    blockedBy: input.blockedBy ?? [],387    brief: {388      want: input.want,389      ...present("current", input.current),390    },391    check: CheckSpec.cases.RedThenGreen.make({392      path: RepoPath.make(`${home}/test/asks/${input.id}.test.ts`),393    }),394    file: RepoPath.make(`${dir}/asks/${input.id}.ask.ts`),395    id,396    kind: KindName.make(input.kind ?? "fix"),397    state: "open",398    territory,399    ...present("mentor", input.mentor),400    ...present(401      "reserve",402      input.mentor === undefined ? undefined : ("newcomers" as const)403    ),404  };405};406407const filesOf = (asks: readonly Stated[]): Files =>408  new Map(409    asks.flatMap((ask) => {410      const stated: StatedAsk = {411        askedBy: ask.askedBy,412        blockedBy: [...ask.blockedBy],413        brief: ask.brief,414        check: encodeCheck(ask.check),415        file: ask.file,416        id: ask.id,417        kind: ask.kind,418        territory: {419          module: ask.territory.module,420          paths: [...ask.territory.paths],421        },422        ...present("mentor", ask.mentor),423        ...present("parent", ask.parent),424        ...present("reserve", ask.reserve),425      };426427      const file = askFileOf(stated);428429      const test = CheckSpec.guards.RedThenGreen(ask.check)430        ? [[ask.check.path, checkOf(ask.id, ask.id, ask.brief.want)] as const]431        : [];432433      return [[file.path, file.content] as const, ...test];434    })435  );436437const familyOf = (input: {438  readonly id: string;439  readonly from: string;440  readonly to: string;441  readonly count: Command;442  readonly modules: Array.NonEmptyReadonlyArray<Module>;443  readonly callers: number;444}) => {445  const parentId = AskId.make(input.id);446447  const check = CheckSpec.cases.Migrate.make({448    count: input.count,449    from: SymbolName.make(input.from),450    to: SymbolName.make(input.to),451  });452453  const whole: Territory = {454    module: ".",455    paths: Array.map(input.modules, (module) => territoryOf(module).paths[0]),456  };457458  const member = (459    id: AskId,460    own: Pick<Stated, "blockedBy" | "brief" | "check" | "state" | "territory">461  ): Stated => ({462    askedBy: people.ines,463    file: RepoPath.make(`${dir}/asks/${id}.ask.ts`),464    id,465    kind: KindName.make("migrate"),466    parent: parentId,467    ...own,468  });469470  const children = Array.map(input.modules, (module) =>471    member(childId(parentId, moduleName(module)), {472      blockedBy: [],473      brief: {474        want: `${moduleName(module)}: ${input.callers} callers of ${input.from} → ${input.to}`,475      },476      check,477      state: "open",478      territory: territoryOf(module),479    })480  );481482  const ids = children.map(({ id }) => id);483  const deleteId = deleteChildId(parentId);484485  const last = member(deleteId, {486    blockedBy: ids,487    brief: { want: `Delete ${input.from}: nothing calls it any more` },488    check: CheckSpec.cases.SymbolAbsent.make({489      count: input.count,490      symbol: SymbolName.make(input.from),491    }),492    state: "waitingOnParent",493    territory: whole,494  });495496  const parent: Stated = {497    askedBy: people.ines,498    blockedBy: [...ids, deleteId],499    brief: {500      want: `Replace every call to ${input.from} with ${input.to}, then delete ${input.from}.`,501    },502    check,503    file: RepoPath.make(`${dir}/asks/${input.id}.ask.ts`),504    id: parentId,505    kind: KindName.make("migrate"),506    state: "open",507    territory: whole,508  };509510  return {511    asks: Array.make(parent, ...children, last),512    child: (module: Module) => childId(parentId, moduleName(module)),513  };514};515516const tokenizer = familyOf({517  callers: 2,518  count: COUNT,519  from: "oldTokenize",520  id: "retire-old-tokenizer",521  modules: ["cli", "export", "lint", "parser", "render", "themes"],522  to: "tokenize",523});524525const pageSize = familyOf({526  callers: 1,527  count: COUNT_PAGES,528  from: "pageSize",529  id: "rename-page-size",530  modules: ["cli", "render", "themes"],531  to: "pageFormat",532});533534const ask = {535  carry: fix({536    current: "An EPUB export drops every footnote.",537    id: "carry-footnotes-to-epub",538    module: "parser",539    territory: {540      module: ".",541      paths: Schema.decodeSync(Territory.fields.paths)([542        "packages/parser/src/footnotes.ts",543        "packages/export/src/epub.ts",544      ]),545    },546    want: "Footnotes the parser reads reach the EPUB export as linked endnotes.",547  }),548  cliVersion: fix({549    id: "cli-version-flag",550    module: "cli",551    want: "vellum --version prints the version and exits 0.",552  }),553  docs: fix({554    current: "vellum --help lists flags with no word on what they do.",555    id: "document-cli-flags",556    mentor: people.okonkwo,557    module: "cli",558    want: "vellum --help says what each flag does, in one line each.",559  }),560  escape: fix({561    id: "escape-attribute-quotes",562    module: "render",563    want: "The HTML renderer escapes quotes inside attribute values.",564  }),565  exportErrors: fix({566    id: "report-export-errors",567    module: "export",568    want: "A failed export reports its error, with the document's path, to the project's error tracker.",569  }),570  exportPages: fix({571    id: "export-page-numbers",572    module: "export",573    want: "The PDF export prints page numbers in the footer.",574  }),575  headings: fix({576    askedBy: people.tove,577    id: "lint-heading-levels",578    module: "lint",579    want: "The linter reports a heading that skips a level, such as a level-two heading followed by a level-four one, with the line of the skip.",580  }),581  nested: fix({582    id: "render-nested-lists",583    module: "render",584    want: "A list nested three deep renders with its indentation.",585  }),586  backrefs: fix({587    blockedBy: [AskId.make("number-footnotes")],588    id: "footnote-backrefs",589    module: "render",590    want: "Each footnote links back to where it is cited.",591  }),592  codeBlocks: fix({593    id: "render-code-blocks",594    module: "render",595    want: "A fenced code block keeps its blank lines.",596  }),597  numbers: fix({598    id: "number-footnotes",599    module: "parser",600    want: "The parser numbers footnotes in the order they are cited.",601  }),602  quotes: fix({603    id: "parse-smart-quotes",604    module: "parser",605    want: "The parser reads curly quotes as quotes.",606  }),607  altText: fix({608    id: "export-alt-text",609    module: "export",610    want: "The HTML export keeps an image's alt text.",611  }),612  palette: fix({613    id: "themes-dark-palette",614    module: "themes",615    want: "The default theme has a dark palette.",616  }),617  trim: fix({618    id: "trim-trailing-spaces",619    module: "lint",620    want: "The linter reports trailing spaces at the end of a line.",621  }),622  wrap: fix({623    id: "wrap-long-table-cells",624    kind: "polish",625    module: "render",626    want: "A table cell longer than the column wraps instead of widening the table.",627  }),628} as const;629630const answerFiles = (stated: Stated, body: string): Files => {631  const home =632    stated.territory.module === "."633      ? "packages/parser"634      : `packages/${stated.territory.module.replace("@vellum/", "")}`;635636  return new Map([637    [638      `${home}/src/${stated.id}.ts`,639      [`/** ${stated.brief.want} */`, body, ""].join("\n"),640    ],641  ]);642};643644const passed = { lint: "passed", types: "passed", unit: "passed" } as const;645646const allPassed = (askLane: string) =>647  ({ ...passed, [askLane]: "passed" }) as const;648649const decisionId = (n: number) =>650  DecisionId.make(`dec-${String(n).padStart(6, "0")}`);651652const proposalId = (n: number) =>653  ProposalId.make(`prop-${String(n).padStart(6, "0")}`);654655const EXPIRY = { days: 3 } as const;656657const decision = (input: {658  readonly n: number;659  readonly at: DateTime.Utc;660  readonly deciders: Array.NonEmptyReadonlyArray<Handle>;661  readonly subject: DecisionSubject;662  readonly evidence: Decision["evidence"];663  readonly default?: Decision["default"];664}): Decision => ({665  deciders: input.deciders,666  default: input.default ?? "decline",667  evidence: input.evidence,668  expiresAt: DateTime.add(input.at, EXPIRY),669  id: decisionId(input.n),670  openedAt: input.at,671  project: vellum,672  subject: input.subject,673});674675const WRAP_PATCH = [676  "diff --git a/packages/render/src/table.ts b/packages/render/src/table.ts",677  "index 5d1c0e2..a8f4b71 100644",678  "--- a/packages/render/src/table.ts",679  "+++ b/packages/render/src/table.ts",680  "@@ -1,8 +1,14 @@",681  ' import type { Token } from "@vellum/parser";',682  " ",683  "+const MAX_CELL = 40;",684  "+",685  " /** One table cell, as HTML. */",686  "-export const cell = (tokens: Token[]) =>",687  '-  "<td>" + tokens.map((token) => token.text).join("") + "</td>";',688  "+export const cell = (tokens: Token[]) => {",689  '+  const text = tokens.map((token) => token.text).join("");',690  '+  const wrap = text.length > MAX_CELL ? \' style="overflow-wrap:anywhere"\' : "";',691  "+",692  '+  return "<td" + wrap + ">" + text + "</td>";',693  "+};",694  " ",695  " /** One table, as HTML. */",696  " export const table = (rows: Token[][][]) =>",697  "diff --git a/packages/render/test/table.test.ts b/packages/render/test/table.test.ts",698  "new file mode 100644",699  "index 0000000..3b9e2d4",700  "--- /dev/null",701  "+++ b/packages/render/test/table.test.ts",702  "@@ -0,0 +1,18 @@",703  '+import { expect, test } from "bun:test";',704  "+",705  '+import { cell } from "../src/table.ts";',706  "+",707  '+const word = (text: string) => ({ kind: "word" as const, text });',708  "+",709  '+test("a short cell stays on one line", () => {',710  '+  expect(cell([word("short")])).toBe("<td>short</td>");',711  "+});",712  "+",713  '+test("a long cell wraps instead of widening its table", () => {',714  '+  const long = word("a".repeat(64));',715  "+",716  '+  expect(cell([long])).toContain("overflow-wrap:anywhere");',717  "+  expect(cell([long])).toContain(long.text);",718  "+});",719  "+",720  "+// One case per width the renderer supports lives in table.widths.test.ts.",721  "",722].join("\n");723724const ledger: Ledger = {725  entries: [],726  layers: [727    {728      audience: "maintainers",729      disclose: "sealed",730      holds: ["checks", "notes"],731      name: LayerName.make("maintainers"),732      readers: [people.ines, people.okonkwo, people.lin],733      reason:734        "Held-back checks for the export and the parser, written by the maintainers so an answer cannot be fitted to them.",735      repo: RepoName.make(`${keyOf(vellum)}--maintainers`),736      writers: "deciders",737    },738  ],739  posture: "openWithSealedEvidence",740  postureLabel: "Open with sealed evidence · sealed checks in export, parser",741  project: vellum,742};743744const envAt = (at: LandedSha, setAt: DateTime.Utc): EnvSchemaView => ({745  at,746  file: RepoPath.make(".env.schema"),747  imports: [],748  items: [749    {750      description:751        "Uploads source maps and error reports from `vellum export`.",752      docs: "https://docs.sentry.io/account/auth-tokens/",753      key: EnvKey.make("SENTRY_AUTH_TOKEN"),754      proxy: { domains: ["sentry.io"], path: "/api/**" },755      required: true,756      sensitive: true,757      tags: ["export", "errors"],758      type: 'string(startsWith="sntrys_")',759      value: { setAt, setBy: people.ines },760    },761    {762      description: "Where error reports go; public.",763      key: EnvKey.make("SENTRY_DSN"),764      required: false,765      sensitive: false,766      tags: ["errors"],767      type: "url",768    },769    {770      description: "A folder of fonts the PDF export embeds.",771      key: EnvKey.make("VELLUM_FONT_DIR"),772      required: "depends",773      sensitive: false,774      tags: ["export"],775      type: "string",776    },777    {778      deprecated: true,779      description: "The PDF export no longer shells out; it is ignored.",780      key: EnvKey.make("LEGACY_PDF_ENGINE"),781      required: false,782      sensitive: false,783      tags: [],784    },785  ],786  project: vellum,787});788789const proposal = (input: {790  readonly n: number;791  readonly at: DateTime.Utc;792  readonly proposer: Handle;793  readonly want: string;794  readonly files: readonly RepoPath[];795  readonly draft?: Proposal["draft"];796  readonly state?: Proposal["state"];797}): Proposal => ({798  expiresAt: DateTime.add(input.at, { days: 14 }),799  files: input.files,800  id: proposalId(input.n),801  openedAt: input.at,802  project: vellum,803  proposer: input.proposer,804  state: input.state ?? "open",805  want: input.want,806  ...present("draft", input.draft),807});808809const draftedFiles = (id: string, module: Module, want: string) => {810  const stated = fix({ id, module, want });811  const [askFile, testFile] = [...filesOf([stated])];812813  const fixture = [814    `packages/${module}/test/fixtures/${id}.vm`,815    "- a list item\n  > a quote inside it\n",816  ] as const;817818  return [askFile, testFile, fixture].flatMap((entry) =>819    entry === undefined820      ? []821      : [{ content: entry[1], path: RepoPath.make(entry[0]) }]822  );823};824825const childEntry = (module: Module): Files =>826  new Map([[`packages/${module}/src/index.ts`, entryOf(module, "tokenize")]]);827828const childPage = (module: Module): Files =>829  new Map([[`packages/${module}/src/page.ts`, pageOf(module, "pageFormat")]]);830831export const tellVellum = (base: LandedSha) =>832  Effect.gen(function* () {833    const { place } = yield* DevClock;834835    const t = (text: string) => place(instant(text));836837    const story = yield* storyOf({838      base,839      files: vellumFiles,840      lanes: LANES,841      lapseAfter: CLAIMS.lapseAfter,842      project: vellum,843      test: TEST,844      warnAfter: CLAIMS.warnAfter,845    });846847    const answerAndLand = (input: {848      readonly stated: Stated;849      readonly who: Handle;850      readonly claimed: string;851      readonly landed: string;852      readonly lane?: string;853      readonly heldBack?: readonly HeldBackResult[];854      readonly changes?: Files;855      readonly suite?: HeldBackResult["suite"];856    }) =>857      Effect.gen(function* () {858        story.claim(input.stated.id, input.who, t(input.claimed), input.suite);859860        const head = story.push(input.stated.id, t(input.landed));861862        story.judge(input.stated.id, head, {863          at: t(input.landed),864          lanes: allPassed(input.lane ?? "redThenGreen"),865          outcome: Outcome.cases.Checking.make({ stage: "human" }),866          stage: "human",867          ...present("heldBack", input.heldBack),868        });869870        return yield* story.land(input.stated.id, {871          at: t(input.landed),872          changes:873            input.changes ??874            answerFiles(875              input.stated,876              `export const answered = ${JSON.stringify(input.stated.id)};`877            ),878        });879      });880881    yield* story.open({882      asks: [ask.quotes],883      at: t("2026-09-01T10:00"),884      by: people.ines,885      files: filesOf([ask.quotes]),886    });887    yield* answerAndLand({888      claimed: "2026-09-02T10:00",889      landed: "2026-09-03T14:00",890      stated: ask.quotes,891      who: people.bram,892    });893    yield* story.open({894      asks: [ask.altText],895      at: t("2026-09-09T10:00"),896      by: people.ines,897      files: filesOf([ask.altText]),898    });899    yield* answerAndLand({900      claimed: "2026-09-10T09:00",901      landed: "2026-09-11T11:00",902      stated: ask.altText,903      who: people.okafor,904    });905    yield* story.open({906      asks: [ask.palette],907      at: t("2026-09-15T10:00"),908      by: people.ines,909      files: filesOf([ask.palette]),910    });911912    const palette = yield* answerAndLand({913      claimed: "2026-09-15T11:00",914      landed: "2026-09-16T16:00",915      stated: ask.palette,916      who: people.lin,917    });918919    yield* story.tag("v0.8.0", palette.sha);920921    story.decision(922      decision({923        at: t("2026-09-28T09:00"),924        deciders: [people.ines, people.lin],925        evidence: [926          {927            label: "why",928            value:929              "Answers to the export and the parser were fitted to their tests; held-back checks judge them instead.",930          },931          { label: "notice", value: "3 days" },932        ],933        n: 1,934        subject: Subject.cases.PostureChange.make({935          from: "open",936          to: "openWithSealedEvidence",937        }),938      })939    );940    story.record((seq) =>941      LedgerEntry.cases.LayerDeclared.make({942        at: t("2026-09-29T10:00"),943        disclose: "sealed",944        kinds: ["checks", "notes"],945        layer: LayerName.make("maintainers"),946        seq,947      })948    );949    story.decide(decisionId(1), {950      at: t("2026-10-01T08:30"),951      by: people.ines,952      choice: "accept",953      note: "Notice runs three days; the suites go in on the 4th.",954    });955956    yield* story.open({957      asks: [ask.docs],958      at: t("2026-10-01T15:00"),959      by: people.ines,960      files: filesOf([ask.docs]),961    });962    story.claim(ask.docs.id, people.tove, t("2026-10-02T10:00"));963964    story.record((seq) =>965      LedgerEntry.cases.PostureChanged.make({966        at: t("2026-10-04T09:00"),967        decision: decisionId(1),968        from: "open",969        seq,970        to: "openWithSealedEvidence",971      })972    );973    story.record((seq) =>974      LedgerEntry.cases.CommitmentPublished.make({975        area: EXPORT,976        at: t("2026-10-04T09:05"),977        authors: 3,978        checks: 7,979        seq,980        suite: exportSuite,981      })982    );983    story.record((seq) =>984      LedgerEntry.cases.CommitmentPublished.make({985        area: PARSER,986        at: t("2026-10-04T09:06"),987        authors: 3,988        checks: 4,989        seq,990        suite: parserSuite,991      })992    );993994    yield* story.open({995      asks: pageSize.asks,996      at: t("2026-10-04T09:30"),997      by: people.ines,998      files: filesOf(pageSize.asks),999    });10001001    for (const [stated, minute] of [1002      [ask.codeBlocks, "40"],1003      [ask.escape, "41"],1004      [ask.wrap, "42"],1005    ] as const) {1006      yield* story.open({1007        asks: [stated],1008        at: t(`2026-10-04T09:${minute}`),1009        by: people.ines,1010        files: filesOf([stated]),1011      });1012    }10131014    story.warn(ask.docs.id, t("2026-10-04T10:00"));10151016    // render-code-blocks: refused twice, landed in its third round.1017    story.claim(ask.codeBlocks.id, people.lin, t("2026-10-04T10:00"));10181019    const codeRound1 = story.push(ask.codeBlocks.id, t("2026-10-04T11:00"), 1);10201021    story.judge(ask.codeBlocks.id, codeRound1, {1022      at: t("2026-10-04T11:00"),1023      lanes: {1024        lint: "passed",1025        redThenGreen: "passed",1026        types: "failed",1027        unit: "passed",1028      },1029      logs: {1030        types:1031          "packages/render/src/code-blocks.ts(4,7): error TS2322: Type 'string | undefined' is not assignable to type 'string'.\n",1032      },1033      outcome: Outcome.cases.Refused.make({1034        refusals: [1035          new ChecksFailed({1036            lane: "types",1037            logRef: `push-${codeRound1}-${people.lin}/types`,1038            next: LANES.types,1039          }),1040        ],1041      }),1042      stage: "checks",1043    });10441045    story.claim(ask.escape.id, people.bram, t("2026-10-04T12:00"));1046    story.claim(pageSize.child("cli"), people.bram, t("2026-10-04T13:00"));10471048    const codeRound2 = story.push(ask.codeBlocks.id, t("2026-10-04T15:00"), 2);10491050    story.judge(ask.codeBlocks.id, codeRound2, {1051      at: t("2026-10-04T15:00"),1052      lanes: {},1053      outcome: Outcome.cases.Refused.make({1054        refusals: [1055          new Weakened({1056            at: {1057              line: 22,1058              path: RepoPath.make("packages/render/test/code-blocks.test.ts"),1059            },1060            weakening: { marker: ".skip(" },1061          }),1062        ],1063      }),1064      stage: "shape",1065    });10661067    // escape-attribute-quotes waits on a waiver for the test it skips.1068    const escapeHead = story.push(ask.escape.id, t("2026-10-04T15:00"));10691070    const escapeAt = {1071      line: 9,1072      path: RepoPath.make("packages/render/test/attributes.test.ts"),1073    };10741075    const escapeReason =1076      "A quote inside a code span needs the escaper's context; split out as its own ask.";10771078    story.judge(ask.escape.id, escapeHead, {1079      at: t("2026-10-04T15:00"),1080      lanes: allPassed("redThenGreen"),1081      outcome: Outcome.cases.AwaitingDecision.make({ decision: decisionId(2) }),1082      stage: "human",1083    });1084    story.decision(1085      decision({1086        at: t("2026-10-04T15:00"),1087        deciders: [people.ines],1088        evidence: [1089          {1090            label: "answer",1091            value: `${people.bram} at ${escapeHead} (push-${escapeHead}-${people.bram})`,1092          },1093          {1094            label: "escape",1095            value: `${escapeAt.path}:${escapeAt.line}: .skip( -- ${escapeReason}`,1096          },1097        ],1098        n: 2,1099        subject: Subject.cases.Waiver.make({1100          ask: ask.escape.id,1101          at: escapeAt,1102          marker: ".skip(",1103          reason: escapeReason,1104        }),1105      })1106    );11071108    story.claim(ask.wrap.id, people.okafor, t("2026-10-04T16:00"));11091110    const cliPage = story.push(pageSize.child("cli"), t("2026-10-04T17:00"));11111112    story.judge(pageSize.child("cli"), cliPage, {1113      at: t("2026-10-04T17:00"),1114      lanes: allPassed("migrate"),1115      outcome: Outcome.cases.Checking.make({ stage: "human" }),1116      stage: "human",1117    });1118    yield* story.land(pageSize.child("cli"), {1119      at: t("2026-10-04T17:00"),1120      changes: childPage("cli"),1121    });11221123    story.record((seq) =>1124      LedgerEntry.cases.Admitted.make({1125        area: EXPORT,1126        at: t("2026-10-05T07:00"),1127        knownBadCaught: 3,1128        mainRuns: 12,1129        seq,1130        suite: exportSuite,1131      })1132    );1133    story.record((seq) =>1134      LedgerEntry.cases.CountChanged.make({1135        area: EXPORT,1136        at: t("2026-10-05T07:01"),1137        count: 7,1138        layer: LayerName.make("maintainers"),1139        seq,1140      })1141    );11421143    story.claim(pageSize.child("render"), people.okafor, t("2026-10-05T08:00"));1144    story.claim(pageSize.child("themes"), people.lin, t("2026-10-05T09:00"));1145    yield* story.open({1146      asks: tokenizer.asks,1147      at: t("2026-10-05T09:00"),1148      by: people.ines,1149      files: filesOf(tokenizer.asks),1150    });11511152    const codeRound3 = story.push(ask.codeBlocks.id, t("2026-10-05T09:30"), 3);11531154    story.judge(ask.codeBlocks.id, codeRound3, {1155      at: t("2026-10-05T09:30"),1156      lanes: allPassed("redThenGreen"),1157      outcome: Outcome.cases.Checking.make({ stage: "human" }),1158      stage: "human",1159    });1160    yield* story.land(ask.codeBlocks.id, {1161      at: t("2026-10-05T09:30"),1162      changes: answerFiles(1163        ask.codeBlocks,1164        "export const keepsBlankLines = true;"1165      ),1166    });11671168    story.claim(tokenizer.child("render"), people.sefa, t("2026-10-05T09:30"));1169    story.claim(tokenizer.child("cli"), people.bram, t("2026-10-05T10:00"));11701171    // wrap-long-table-cells: narrowed with .only( in its first round, then waiting for a finish.1172    const wrapRound1 = story.push(ask.wrap.id, t("2026-10-05T10:00"), 1);11731174    story.judge(ask.wrap.id, wrapRound1, {1175      at: t("2026-10-05T10:00"),1176      lanes: {},1177      outcome: Outcome.cases.Refused.make({1178        refusals: [1179          new Weakened({1180            at: {1181              line: 14,1182              path: RepoPath.make("packages/render/test/table.test.ts"),1183            },1184            weakening: { marker: ".only(" },1185          }),1186        ],1187      }),1188      stage: "shape",1189    });11901191    story.claim(1192      tokenizer.child("export"),1193      people.okafor,1194      t("2026-10-05T11:00"),1195      exportSuite1196    );11971198    const renderPage = story.push(1199      pageSize.child("render"),1200      t("2026-10-05T11:00")1201    );12021203    story.judge(pageSize.child("render"), renderPage, {1204      at: t("2026-10-05T11:00"),1205      lanes: allPassed("migrate"),1206      outcome: Outcome.cases.Checking.make({ stage: "human" }),1207      stage: "human",1208    });1209    yield* story.land(pageSize.child("render"), {1210      at: t("2026-10-05T11:00"),1211      changes: childPage("render"),1212    });12131214    const themesPage = story.push(1215      pageSize.child("themes"),1216      t("2026-10-05T12:00")1217    );12181219    story.judge(pageSize.child("themes"), themesPage, {1220      at: t("2026-10-05T12:00"),1221      lanes: allPassed("migrate"),1222      outcome: Outcome.cases.Checking.make({ stage: "human" }),1223      stage: "human",1224    });1225    yield* story.land(pageSize.child("themes"), {1226      at: t("2026-10-05T12:00"),1227      changes: childPage("themes"),1228    });12291230    // The lint ask came from tove's proposal.1231    story.propose({1232      files: [],1233      proposal: proposal({1234        at: t("2026-10-05T13:00"),1235        files: [],1236        n: 1,1237        proposer: people.tove,1238        want: ask.headings.brief.want,1239      }),1240    });1241    story.decision(1242      decision({1243        at: t("2026-10-05T13:00"),1244        deciders: [people.ines, people.lin],1245        evidence: [1246          { label: "want", value: ask.headings.brief.want },1247          { label: "territory", value: "@vellum/lint" },1248        ],1249        n: 3,1250        subject: Subject.cases.OpenProposal.make({ proposal: proposalId(1) }),1251      })1252    );12531254    const wrapHead = story.push(ask.wrap.id, t("2026-10-05T14:00"), 2);12551256    story.judge(ask.wrap.id, wrapHead, {1257      at: t("2026-10-05T14:00"),1258      lanes: allPassed("redThenGreen"),1259      outcome: Outcome.cases.AwaitingFinish.make({ decider: people.ines }),1260      stage: "human",1261    });1262    story.decision(1263      decision({1264        at: t("2026-10-05T14:00"),1265        default: "accept",1266        deciders: [people.ines],1267        evidence: [1268          {1269            label: "answer",1270            value: `${people.okafor} at ${wrapHead} (push-${wrapHead}-${people.okafor})`,1271          },1272          { label: "patch", value: WRAP_PATCH },1273          {1274            label: "fork",1275            value: `${vellum}--${ask.wrap.id}--${people.okafor}`,1276          },1277        ],1278        n: 4,1279        subject: Subject.cases.Finish.make({1280          ask: ask.wrap.id,1281          head: wrapHead,1282        }),1283      })1284    );12851286    const cliChild = story.push(tokenizer.child("cli"), t("2026-10-05T14:00"));12871288    story.judge(tokenizer.child("cli"), cliChild, {1289      at: t("2026-10-05T14:00"),1290      lanes: allPassed("migrate"),1291      outcome: Outcome.cases.Checking.make({ stage: "human" }),1292      stage: "human",1293    });12941295    const released = yield* story.land(tokenizer.child("cli"), {1296      at: t("2026-10-05T14:00"),1297      changes: childEntry("cli"),1298    });12991300    yield* story.tag("v0.9.0", released.sha);13011302    for (const [stated, minute] of [1303      [ask.numbers, "10"],1304      [ask.backrefs, "11"],1305      [ask.trim, "12"],1306      [ask.nested, "13"],1307      [ask.cliVersion, "14"],1308      [ask.exportPages, "15"],1309      [ask.exportErrors, "16"],1310      [ask.carry, "17"],1311    ] as const) {1312      yield* story.open({1313        asks: [stated],1314        at: t(`2026-10-05T15:${minute}`),1315        by: people.ines,1316        files: filesOf([stated]),1317      });1318    }13191320    const ready = draftedFiles(1321      "parse-nested-quotes",1322      "parser",1323      "The parser reads a blockquote nested inside a list item."1324    );13251326    story.propose(1327      {1328        files: ready,1329        proposal: proposal({1330          at: t("2026-10-05T15:30"),1331          draft: DraftState.cases.Ready.make({1332            attempts: 1,1333            model: "memory",1334            red: {1335              lane: LaneName.make("redThenGreen"),1336              signature: "expected 1 blockquote, received 0",1337            },1338            round: 1,1339          }),1340          files: ready.map(({ path }) => path),1341          n: 2,1342          proposer: people.bram,1343          want: "The parser reads a blockquote nested inside a list item.",1344        }),1345      },1346      { at: t("2026-10-05T16:00"), ready: true }1347    );1348    story.decision(1349      decision({1350        at: t("2026-10-05T16:00"),1351        deciders: [people.ines],1352        evidence: [1353          {1354            label: "want",1355            value: "The parser reads a blockquote nested inside a list item.",1356          },1357          { label: "territory", value: "@vellum/parser" },1358          ...ready.map(({ content, path }) => ({1359            label: path,1360            value: content,1361          })),1362          {1363            label: "red first",1364            value: "redThenGreen: expected 1 blockquote, received 0",1365          },1366          { label: "drafted by", value: "memory, attempt 1 of 3" },1367        ],1368        n: 5,1369        subject: Subject.cases.OpenProposal.make({ proposal: proposalId(2) }),1370      })1371    );13721373    story.claim(1374      tokenizer.child("parser"),1375      people.tove,1376      t("2026-10-05T16:00"),1377      parserSuite1378    );13791380    story.decision(1381      decision({1382        at: t("2026-10-06T07:00"),1383        deciders: [people.ines, people.lin],1384        evidence: [1385          {1386            label: "why",1387            value:1388              "The maintainers' notes become public a month after each release.",1389          },1390          {1391            label: "notice",1392            value:1393              "3 days: it takes effect on the third day after it is accepted",1394          },1395        ],1396        n: 6,1397        subject: Subject.cases.PostureChange.make({1398          from: "openWithSealedEvidence",1399          to: "openOnSchedule",1400        }),1401      })1402    );14031404    story.claim(ask.nested.id, people.tove, t("2026-10-06T08:00"));1405    story.claim(ask.carry.id, people.okafor, t("2026-10-06T08:30"));14061407    const exportChild = story.push(1408      tokenizer.child("export"),1409      t("2026-10-06T09:00")1410    );14111412    story.judge(tokenizer.child("export"), exportChild, {1413      at: t("2026-10-06T09:00"),1414      heldBack: [held(EXPORT, 7, 7)],1415      lanes: allPassed("migrate"),1416      outcome: Outcome.cases.Checking.make({ stage: "human" }),1417      stage: "human",1418    });1419    yield* story.land(tokenizer.child("export"), {1420      at: t("2026-10-06T09:00"),1421      changes: childEntry("export"),1422    });14231424    story.claim(ask.numbers.id, people.lin, t("2026-10-06T09:00"), parserSuite);1425    story.claim(tokenizer.child("lint"), people.lin, t("2026-10-06T10:00"));1426    story.lapse(ask.docs.id, t("2026-10-06T10:00"));1427    story.claim(ask.backrefs.id, people.bram, t("2026-10-06T11:00"));1428    story.decision(1429      decision({1430        at: t("2026-10-06T11:00"),1431        default: "revert",1432        deciders: [people.ines, people.lin],1433        evidence: [1434          { label: "ref", value: "refs/heads/main" },1435          {1436            label: "pusher",1437            value: "not known: the push came past the platform",1438          },1439        ],1440        n: 7,1441        subject: Subject.cases.StrayPush.make({1442          after: headOf("vellum/stray"),1443          before: story.head(),1444          ref: MAIN_REF,1445        }),1446      })1447    );14481449    story.claim(ask.trim.id, people.sefa, t("2026-10-06T12:00"));14501451    const release = yield* story.landOwn({1452      at: t("2026-10-06T12:00"),1453      author: people.okonkwo,1454      changes: new Map([1455        [1456          "packages/export/test/fixtures/epub-minimal.vm",1457          "# A title\n\nOne paragraph.\n",1458        ],1459        [1460          "packages/export/test/fixtures/epub-footnotes.vm",1461          "A claim.[^1]\n\n[^1]: Its source.\n",1462        ],1463      ]),1464      credits: [{ handle: people.okonkwo, role: "Released-by" }],1465      message: {1466        body: "Two documents the export's held-back checks read, released from the maintainers' layer.",1467        subject: "Release two export fixtures",1468      },1469    });14701471    story.record((seq) =>1472      LedgerEntry.cases.Released.make({1473        at: t("2026-10-06T12:00"),1474        by: people.okonkwo,1475        landing: release.sha,1476        layer: LayerName.make("maintainers"),1477        paths: 2,1478        seq,1479      })1480    );14811482    // render-nested-lists: refused at the checks, with the failing lane's log.1483    const nestedHead = story.push(ask.nested.id, t("2026-10-06T12:30"));14841485    story.judge(ask.nested.id, nestedHead, {1486      at: t("2026-10-06T12:30"),1487      lanes: {1488        lint: "passed",1489        redThenGreen: "passed",1490        types: "passed",1491        unit: "failed",1492      },1493      logs: {1494        unit: [1495          "bun test v1.4.2",1496          "",1497          "packages/render/test/lists.test.ts:",1498          "✓ a flat list renders [0.41ms]",1499          "✗ a list nested two deep keeps its indentation [1.02ms]",1500          '  expected: "<ul><li>a<ul><li>b</li></ul></li></ul>"',1501          '  received: "<ul><li>a</li><li>b</li></ul>"',1502          "",1503          " 1 pass",1504          " 1 fail",1505          "",1506        ].join("\n"),1507      },1508      outcome: Outcome.cases.Refused.make({1509        refusals: [1510          new ChecksFailed({1511            lane: "unit",1512            logRef: `push-${nestedHead}-${people.tove}/unit`,1513            next: LANES.unit,1514          }),1515        ],1516      }),1517      stage: "checks",1518    });15191520    // trim-trailing-spaces: refused at Shape, a change outside its territory.1521    const trimHead = story.push(ask.trim.id, t("2026-10-06T13:00"));1522    const outside = RepoPath.make("packages/cli/src/args.ts");15231524    story.judge(ask.trim.id, trimHead, {1525      at: t("2026-10-06T13:00"),1526      lanes: {},1527      outcome: Outcome.cases.Refused.make({1528        refusals: [1529          new OutOfScope({ at: { line: 3, path: outside }, paths: [outside] }),1530        ],1531      }),1532      stage: "shape",1533    });15341535    story.claim(ask.cliVersion.id, people.bram, t("2026-10-06T13:00"));1536    story.claim(1537      ask.exportPages.id,1538      people.okafor,1539      t("2026-10-06T13:30"),1540      exportSuite1541    );15421543    const pagesHead = story.push(ask.exportPages.id, t("2026-10-06T14:00"));15441545    story.judge(ask.exportPages.id, pagesHead, {1546      at: t("2026-10-06T14:00"),1547      heldBack: [held(EXPORT, 7, 7)],1548      lanes: allPassed("redThenGreen"),1549      outcome: Outcome.cases.AwaitingDecision.make({ decision: decisionId(8) }),1550      stage: "human",1551    });1552    story.decision(1553      decision({1554        at: t("2026-10-06T14:00"),1555        deciders: [people.okonkwo],1556        evidence: [1557          {1558            label: "answer",1559            value: `${people.okafor} at ${pagesHead} (push-${pagesHead}-${people.okafor})`,1560          },1561          {1562            label: "ratchet",1563            value: "bundle-bytes in @vellum/export: 41200 to 41850",1564          },1565        ],1566        n: 8,1567        subject: Subject.cases.RaiseRatchet.make({1568          after: 41_850,1569          ask: ask.exportPages.id,1570          before: 41_200,1571          ratchet: RatchetName.make("bundle-bytes"),1572          territory: "@vellum/export",1573        }),1574      })1575    );15761577    story.propose(1578      {1579        files: [],1580        proposal: proposal({1581          at: t("2026-10-06T14:30"),1582          draft: DraftState.cases.Failed.make({1583            attempts: 3,1584            model: "memory",1585            refusal: "NotRedFirst",1586            round: 1,1587          }),1588          files: [],1589          n: 3,1590          proposer: people.sefa,1591          want: "Themes can set their own font for code blocks.",1592        }),1593      },1594      { at: t("2026-10-06T15:00"), ready: false }1595    );1596    story.decision(1597      decision({1598        at: t("2026-10-06T15:00"),1599        deciders: [people.ines, people.lin],1600        evidence: [1601          {1602            label: "want",1603            value: "Themes can set their own font for code blocks.",1604          },1605          {1606            label: "draft failed",1607            value:1608              "The check passed on main, so it proves nothing about an answer.",1609          },1610        ],1611        n: 9,1612        subject: Subject.cases.OpenProposal.make({ proposal: proposalId(3) }),1613      })1614    );16151616    // The parser child: every lane passed, one held-back check in the parser did not.1617    const parserHead = story.push(1618      tokenizer.child("parser"),1619      t("2026-10-06T15:00")1620    );16211622    story.judge(tokenizer.child("parser"), parserHead, {1623      at: t("2026-10-06T15:00"),1624      heldBack: [held(PARSER, 3, 4)],1625      lanes: allPassed("migrate"),1626      outcome: Outcome.cases.Refused.make({1627        refusals: [new HeldBackFailed({ area: PARSER, suite: parserSuite })],1628      }),1629      stage: "heldBack",1630    });16311632    // footnote-backrefs passed, and waits for number-footnotes to land first.1633    const backrefsHead = story.push(ask.backrefs.id, t("2026-10-06T16:00"));16341635    story.judge(ask.backrefs.id, backrefsHead, {1636      at: t("2026-10-06T16:00"),1637      lanes: allPassed("redThenGreen"),1638      outcome: Outcome.cases.WaitingOnParent.make({ ask: ask.numbers.id }),1639      stage: "human",1640    });16411642    const token = EnvKey.make("SENTRY_AUTH_TOKEN");16431644    story.decision(1645      decision({1646        at: t("2026-10-06T16:00"),1647        deciders: [people.okonkwo],1648        evidence: [1649          { label: "item", value: token },1650          { label: "hosts now", value: "sentry.io" },1651          { label: "hosts after", value: "sentry.io, ingest.sentry.io" },1652        ],1653        n: 10,1654        subject: Subject.cases.ProxyWidened.make({1655          hosts: WIDER_HOSTS,1656          item: token,1657        }),1658      })1659    );1660    story.record((seq) =>1661      LedgerEntry.cases.ValueSet.make({1662        at: t("2026-10-06T16:30"),1663        by: people.ines,1664        key: token,1665        seq,1666      })1667    );16681669    // cli-version-flag lands with no decision and nothing held back.1670    const versionHead = story.push(ask.cliVersion.id, t("2026-10-06T17:30"));16711672    story.judge(ask.cliVersion.id, versionHead, {1673      at: t("2026-10-06T17:30"),1674      lanes: allPassed("redThenGreen"),1675      outcome: Outcome.cases.Checking.make({ stage: "human" }),1676      stage: "human",1677    });1678    yield* story.land(ask.cliVersion.id, {1679      assisted: [{ harness: "claude-code", model: "haiku", verified: false }],1680      at: t("2026-10-06T17:30"),1681      changes: answerFiles(ask.cliVersion, 'export const version = "0.9.0";'),1682    });16831684    // carry-footnotes-to-epub waits on a waiver for a `.todo(`, then lands with it.1685    const carryHead = story.push(ask.carry.id, t("2026-10-06T18:00"));16861687    const carryAt = {1688      line: 31,1689      path: RepoPath.make("packages/export/test/epub.test.ts"),1690    };16911692    const carryReason = "EPUB 2 readers come later; their own ask is drafted.";16931694    story.judge(ask.carry.id, carryHead, {1695      at: t("2026-10-06T18:00"),1696      heldBack: [held(EXPORT, 7, 7), held(PARSER, 4, 4)],1697      lanes: allPassed("redThenGreen"),1698      outcome: Outcome.cases.AwaitingDecision.make({1699        decision: decisionId(11),1700      }),1701      stage: "human",1702    });1703    story.decision(1704      decision({1705        at: t("2026-10-06T18:00"),1706        deciders: [people.ines],1707        evidence: [1708          {1709            label: "answer",1710            value: `${people.okafor} at ${carryHead} (push-${carryHead}-${people.okafor})`,1711          },1712          {1713            label: "escape",1714            value: `${carryAt.path}:${carryAt.line}: .todo( -- ${carryReason}`,1715          },1716        ],1717        n: 11,1718        subject: Subject.cases.Waiver.make({1719          ask: ask.carry.id,1720          at: carryAt,1721          marker: ".todo(",1722          reason: carryReason,1723        }),1724      })1725    );17261727    const subsets = draftedFiles(1728      "export-font-subsets",1729      "export",1730      "Export embeds only the font subsets a document uses."1731    );17321733    story.propose(1734      {1735        files: subsets,1736        proposal: proposal({1737          at: t("2026-10-06T18:30"),1738          draft: DraftState.cases.Failed.make({1739            attempts: 1,1740            model: "memory",1741            refusal: "VerifierBlocked",1742            round: 2,1743          }),1744          files: subsets.map(({ path }) => path),1745          n: 4,1746          proposer: people.okafor,1747          want: "Export embeds only the font subsets a document uses.",1748        }),1749      },1750      { at: t("2026-10-06T19:00"), ready: true }1751    );1752    story.drafted(proposalId(4), t("2026-10-06T20:00"), false);1753    story.decision(1754      decision({1755        at: t("2026-10-06T20:00"),1756        deciders: [people.okonkwo],1757        evidence: [1758          {1759            label: "want",1760            value: "Export embeds only the font subsets a document uses.",1761          },1762          { label: "territory", value: "@vellum/export" },1763          ...subsets.map(({ content, path }) => ({1764            label: path,1765            value: content,1766          })),1767          {1768            label: "draft failed",1769            value:1770              "The Checker was busy; the platform could not run the check this round.",1771          },1772        ],1773        n: 12,1774        subject: Subject.cases.OpenProposal.make({ proposal: proposalId(4) }),1775      })1776    );17771778    story.claim(1779      ask.exportErrors.id,1780      people.tove,1781      t("2026-10-07T07:00"),1782      exportSuite1783    );17841785    const errorsHead = story.push(ask.exportErrors.id, t("2026-10-07T07:30"));17861787    story.judge(ask.exportErrors.id, errorsHead, {1788      at: t("2026-10-07T07:30"),1789      lanes: allPassed("redThenGreen"),1790      outcome: Outcome.cases.AwaitingDecision.make({1791        decision: decisionId(13),1792      }),1793      stage: "human",1794    });1795    story.decision(1796      decision({1797        at: t("2026-10-07T07:30"),1798        deciders: [people.okonkwo],1799        evidence: [1800          {1801            label: "answer",1802            value: `${people.tove} at ${errorsHead} (push-${errorsHead}-${people.tove})`,1803          },1804          { label: "item", value: token },1805          {1806            label: "where",1807            value:1808              "a file in the answer's tree holds the item's stored value; the answer is held aside",1809          },1810        ],1811        n: 13,1812        subject: Subject.cases.SecretInTree.make({1813          ask: ask.exportErrors.id,1814          item: token,1815        }),1816      })1817    );1818    story.decision(1819      decision({1820        at: t("2026-10-07T08:00"),1821        deciders: [people.okonkwo],1822        evidence: [1823          { label: "handle", value: people.wren },1824          {1825            label: "line",1826            value: `${people.wren} Asks to come back; proposals since are on topic.`,1827          },1828        ],1829        n: 14,1830        subject: Subject.cases.Vouch.make({ handle: people.wren }),1831      })1832    );18331834    story.push(ask.numbers.id, t("2026-10-07T08:15"));18351836    story.decide(decisionId(3), {1837      at: t("2026-10-07T08:30"),1838      by: people.ines,1839      choice: "accept",1840      note: "Clear want; tove's test covers the skip.",1841    });1842    story.accepted(proposalId(1));1843    yield* story.open({1844      asks: [ask.headings],1845      at: t("2026-10-07T08:30"),1846      by: people.ines,1847      files: filesOf([ask.headings]),1848    });1849    story.claim(ask.headings.id, people.bram, t("2026-10-07T08:40"));1850    story.release(ask.headings.id, t("2026-10-07T09:00"));18511852    story.decide(decisionId(11), {1853      at: t("2026-10-07T09:10"),1854      by: people.ines,1855      choice: "accept",1856      note: "EPUB 2 is out of scope here.",1857    });1858    yield* story.land(ask.carry.id, {1859      at: t("2026-10-07T09:12"),1860      changes: answerFiles(ask.carry, "export const endnotes = true;"),1861      decidedBy: people.ines,1862    });18631864    story.warn(tokenizer.child("render"), t("2026-10-07T09:30"));18651866    const lintHead = story.push(tokenizer.child("lint"), t("2026-10-07T09:40"));18671868    story.judge(tokenizer.child("lint"), lintHead, {1869      at: t("2026-10-07T09:40"),1870      lanes: { migrate: "passed", types: "passed" },1871      outcome: Outcome.cases.Checking.make({ stage: "checks" }),1872      stage: "checks",1873    });18741875    story.propose({1876      files: [],1877      proposal: proposal({1878        at: t("2026-10-07T09:50"),1879        draft: DraftState.cases.Drafting.make({1880          round: 1,1881          startedAt: t("2026-10-07T09:50"),1882        }),1883        files: [],1884        n: 5,1885        proposer: people.lin,1886        want: "The CLI prints a table of contents with --toc.",1887      }),1888    });18891890    const apart = {1891      env: envAt(story.head(), t("2026-10-06T16:30")),1892      ledger,1893      working: [people.ines, people.okonkwo],1894    };18951896    return { story, told: () => story.told(apart) };1897  });18981899export const landLintChild = (story: Story, at: DateTime.Utc) =>1900  Effect.gen(function* () {1901    const child = tokenizer.child("lint");19021903    story.finishChecks(child, allPassed("migrate"));19041905    return yield* story.land(child, {1906      at,1907      changes: new Map([1908        ["packages/lint/src/index.ts", entryOf("lint", "tokenize")],1909      ]),1910    });1911  });