Skip to content
Myr

front.test.tsx

This file

Path

apps/web/test/front.test.tsx

838 lines · 24.9 KiB · TypeScript

Last changed by

Merge redesign into mainoscabrielbefore adoptioncaedd21

History of this file

Take it

The walk stopped after 200 commits: lines older than 678c8b8 point at it.

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 1–2why, one step back
1import { describe, expect, it } from "@effect/vitest";
2import { Brand } from "@repo/brand";

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 3–8why, one step back
3import { deleteChildId, splitFamily } from "@repo/project/migrate";
4import { Client, Contracts } from "@repo/protocol/contracts";5import { AskListing } from "@repo/protocol/domain/ask";6import type { Ask } from "@repo/protocol/domain/ask";7import { CheckSpec } from "@repo/protocol/domain/check";8import { Command, Glob, SymbolName } from "@repo/protocol/domain/common";

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 9–12why, one step back
9import {
10 FrontPageEntry,11 ProjectListing,12} from "@repo/protocol/domain/front-page";

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 13–17why, one step back
13import { AskId, KindName, ProjectName } from "@repo/protocol/ids";
14import { asTester, unanswered } from "@repo/protocol/testing";15import { DateTime, Effect, Layer, Option, Schema } from "effect";16import { FetchHttpClient } from "effect/http";17import { RpcClient, RpcSerialization, RpcTest } from "effect/rpc";

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 18why, one step back
18

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 19–25why, one step back
19import { devServer } from "../src/dev/server.ts";
20import { arrange, familiesIn } from "../src/features/front/families.ts";21import {22 filterEntries,23 frontPath,24 readFilter,25} from "../src/features/front/filter.ts";

Fold every page's project events once, keep Markdown off the first load, and cache what never changesoscabrielbefore adoption38e5215

lines 26–27why, one step back
26import type { FrontFilter } from "../src/features/front/filter.ts";
27import { FrontPageView } from "../src/features/front/front-page.tsx";

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 28why, one step back
28import type { FrontPageProps } from "../src/features/front/front-page.tsx";

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 29–32why, one step back
29import {
30 dismissHowTo,31 readHowToDismissed,32} from "../src/features/front/how-to.tsx";

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 33–36why, one step back
33import { FrontPageData, readFrontPage } from "../src/server/front-page.ts";
34import { ask as parseIsoWeek } from "./ask-fixtures.ts";35import { textIn } from "./markup.ts";36import { renderAt } from "./render.tsx";

Draw every list and subject from one row, one status line, one family fan and one set of fact blocksoscabrielbefore adoption886b726

line 37why, one step back
37import { reachingTransport } from "./transport.ts";

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 38–43why, one step back
38
39const kind = Schema.decodeSync(KindName);4041const rowOf = (markup: string, ask: string) => {42 const start = markup.indexOf(`data-ask="${ask}"`);43

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 44–50why, one step back
44 const ends = ["data-ask=", "<section", "</main>"].flatMap((end) => {
45 const at = markup.indexOf(end, start + 1);4647 return at === -1 ? [] : [at];48 });4950 return start === -1 ? "" : markup.slice(start, Math.min(...ends));

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 51–52why, one step back
51};
52

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 53–65why, one step back
53const rowsIn = (markup: string) =>
54 [...markup.matchAll(/<li\b[^>]*data-ask="(?<ask>[^"]+)"/gu)].map(55 (row) => row.groups?.ask56 );5758const headersIn = (markup: string) =>59 [60 ...markup.matchAll(61 /<section aria-label="(?<project>[^"]+)"[^>]*>(?<header><div\b[\s\S]*?<\/div><\/div>)/gu62 ),63 ].map((match) => [match.groups?.project, match.groups?.header] as const);6465const listIn = (markup: string) =>

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 66why, one step back
66 markup.slice(markup.indexOf("data-board-list"), markup.indexOf("</main>"));

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 67why, one step back
67

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 68–69why, one step back
68const filtersIn = (markup: string) =>
69 /<nav aria-label="Filter the asks"[\s\S]*?<\/nav>/u.exec(markup)?.[0] ?? "";

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 70why, one step back
70

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 71–72why, one step back
71const stripIn = (markup: string) =>
72 /<section\b[^>]*data-how-to=""[\s\S]*?<\/section>/u.exec(markup)?.[0] ?? "";

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 73why, one step back
73

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 74why, one step back
74const now = DateTime.makeUnsafe("2026-10-07T12:00:00Z");

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 75why, one step back
75

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 76–131why, one step back
76const entries = Schema.decodeSync(Schema.Array(FrontPageEntry))([
77 {78 ask: {79 ask: "explain-iso-week",80 blockedBy: [],81 claimed: false,82 kind: "bug",83 reserve: "newcomers",84 territory: "core",85 want: "The docs say which week of the year a date falls in.",86 },87 posture: "open",88 project: "datekit",89 takeable: false,90 },91 {92 ask: {93 ask: "fix-week-start",94 blockedBy: [],95 claimed: false,96 kind: "bug",97 territory: "core",98 want: "A week starts on the locale's first day, not always on Sunday.",99 },100 posture: "open",101 project: "datekit",102 takeable: true,103 },104 {105 ask: {106 ask: "split-format",107 blockedBy: [],108 claimed: false,109 kind: "migrate",110 territory: "format",111 want: "The format package calls the new parser.",112 },113 posture: "openWithSealedEvidence",114 project: "burrow",115 takeable: true,116 },117]);118119const projects = Schema.decodeSync(Schema.Array(ProjectListing))([120 {121 landedAt: "2026-10-06T09:00:00.000Z",122 openAsks: 1,123 posture: "openWithSealedEvidence",124 project: "burrow",125 },126 { openAsks: 2, posture: "open", project: "datekit" },127]);128129const asksOf = (shown: readonly FrontPageEntry[]) =>130 shown.map(({ ask }) => ask.ask);131

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 132–145why, one step back
132const props = (
133 filter: FrontFilter,134 more: Partial<FrontPageProps> = {}135): FrontPageProps => ({136 entries,137 events: new Map(),138 filter,139 now,140 parents: [],141 projects,142 ...more,143});144145const front = (filter: FrontFilter, more: Partial<FrontPageProps> = {}) =>

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 146why, one step back
146 renderAt(frontPath(filter), <FrontPageView {...props(filter, more)} />);

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 147–167why, one step back
147
148describe(filterEntries, () => {149 it("puts the asks the viewer may take first, keeping the order given", () => {150 expect(asksOf(filterEntries(entries, {}))).toStrictEqual([151 "fix-week-start",152 "split-format",153 "explain-iso-week",154 ]);155 });156157 it("narrows the list to one kind", () => {158 expect(159 asksOf(filterEntries(entries, { kind: kind("migrate") }))160 ).toStrictEqual(["split-format"]);161 });162163 it("narrows the list to the asks held for newcomers", () => {164 expect(165 asksOf(filterEntries(entries, { reserved: "newcomers" }))166 ).toStrictEqual(["explain-iso-week"]);167 });

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 168–177why, one step back
168
169 it("narrows the list to the asks open to take", () => {170 expect(asksOf(filterEntries(entries, { take: "open" }))).toStrictEqual([171 "fix-week-start",172 "split-format",173 ]);174 });175176 it("narrows the list to one project", () => {177 expect(

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

lines 178–182why, one step back
178 asksOf(
179 filterEntries(entries, {180 project: ProjectName.make("oscabriel/burrow"),181 })182 )

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 183–184why, one step back
183 ).toStrictEqual(["split-format"]);
184 });

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 185–187why, one step back
185});
186187describe(readFilter, () => {

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 188–196why, one step back
188 it("keeps a valid kind, reserve, take and project from the address, and drops what is not one", () => {
189 expect(190 readFilter({191 kind: "bug",192 project: "datekit",193 reserved: "newcomers",194 take: "open",195 })196 ).toStrictEqual({

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 197why, one step back
197 kind: "bug",

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 198why, one step back
198 project: "oscabriel/datekit",

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 199why, one step back
199 reserved: "newcomers",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 200why, one step back
200 take: "open",

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 201–202why, one step back
201 });
202 expect(

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 203–208why, one step back
203 readFilter({
204 kind: "Not A Kind",205 project: "Not_A_Project",206 reserved: "everyone",207 take: "all",208 })

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 209–212why, one step back
209 ).toStrictEqual({});
210 });211});212

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 213–220why, one step back
213const listing = (id: string, blockedBy: readonly string[] = []) =>
214 Schema.decodeSync(AskListing)({215 ask: id,216 blockedBy,217 claimed: false,218 kind: "migrate",219 territory: ".",220 want: `The want of ${id}.`,

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 221–222why, one step back
221 });
222

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 223–224why, one step back
223describe(familiesIn, () => {
224 const children = ["drop-fetch-auth", "drop-fetch-kit"];

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 225why, one step back
225

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 226–241why, one step back
226 it("reads a family from a parent waiting on asks named after it, with its delete child", () => {
227 const listed = [228 listing("drop-fetch", [...children, "drop-fetch-delete"]),229 listing("drop-fetch-auth"),230 listing("drop-fetch-kit"),231 listing("drop-fetch-delete", children),232 listing("fix-week-start"),233 ];234235 expect(familiesIn(listed)).toStrictEqual([236 {237 finale: "drop-fetch-delete",238 members: ["drop-fetch-auth", "drop-fetch-kit", "drop-fetch-delete"],239 parent: "drop-fetch",240 },241 ]);

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 242–243why, one step back
242 });
243

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 244–258why, one step back
244 it("reads one where the list leaves its delete child out, or holds only it", () => {
245 expect(246 familiesIn([247 listing("drop-fetch", children),248 listing("drop-fetch-auth"),249 listing("drop-fetch-kit"),250 ]).map(({ members }) => members)251 ).toStrictEqual([children]);252 expect(253 familiesIn([254 listing("drop-fetch", ["drop-fetch-delete"]),255 listing("drop-fetch-delete"),256 ]).map(({ members }) => members)257 ).toStrictEqual([["drop-fetch-delete"]]);258 });

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 259why, one step back
259

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 260–266why, one step back
260 it("reads no family from an ask that waits on an ask not named after it", () => {
261 expect(262 familiesIn([263 listing("footnote-backrefs", ["number-footnotes"]),264 listing("number-footnotes"),265 ])266 ).toStrictEqual([]);

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 267–268why, one step back
267 });
268

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 269–280why, one step back
269 it("finds the family the platform's split opens, by the names it gives", () => {
270 const migrateParent: Ask = {271 ...parseIsoWeek,272 blockedBy: [],273 brief: { want: "Replace legacyFetch with http.get." },274 check: CheckSpec.cases.Migrate.make({275 count: Command.make("bun run count"),276 from: SymbolName.make("legacyFetch"),277 to: SymbolName.make("http.get"),278 }),279 id: AskId.make("drop-fetch"),280 kind: KindName.make("migrate"),

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 281why, one step back
281 project: ProjectName.make("oscabriel/burrow"),

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 282–294why, one step back
282 territory: { module: ".", paths: [Glob.make("packages/**")] },
283 };284285 const counted = Option.getOrThrow(286 splitFamily({287 configDir: Brand.configDir,288 counts: { byModule: { auth: 2, kit: 1 }, total: 3 },289 modules: [290 { module: "auth", paths: [Glob.make("packages/auth/**")] },291 { module: "kit", paths: [Glob.make("packages/kit/**")] },292 ],293 parent: migrateParent,294 })

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 295–296why, one step back
295 );
296

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 297–301why, one step back
297 const listed = [
298 counted.parent,299 ...counted.children,300 counted.deleteChild,301 ].map((ask) => listing(ask.id, ask.blockedBy));

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 302why, one step back
302

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 303–311why, one step back
303 expect(familiesIn(listed)).toStrictEqual([
304 {305 finale: deleteChildId(counted.parent.id),306 members: [307 ...counted.children.map(({ id }) => id),308 counted.deleteChild.id,309 ],310 parent: counted.parent.id,311 },

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 312–313why, one step back
312 ]);
313 });

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 314why, one step back
314});

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 315why, one step back
315

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 316–323why, one step back
316describe(arrange, () => {
317 it("puts each family at its parent's place, its members out of the list", () => {318 const listed = [319 listing("fix-week-start"),320 listing("drop-fetch-auth"),321 listing("drop-fetch", ["drop-fetch-auth"]),322 listing("parse-iso"),323 ];

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 324why, one step back
324

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 325–335why, one step back
325 expect(
326 arrange(listed).map((item) =>327 item.kind === "family"328 ? `${item.parent.ask}: ${item.members.map(({ ask }) => ask).join(", ")}`329 : item.listing.ask330 )331 ).toStrictEqual([332 "fix-week-start",333 "drop-fetch: drop-fetch-auth",334 "parse-iso",335 ]);

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 336why, one step back
336 });

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 337why, one step back
337});

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 338why, one step back
338

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 339–350why, one step back
339describe(FrontPageView, () => {
340 it.effect(341 "shows the asks the viewer may take first, grouped by project",342 () =>343 Effect.gen(function* () {344 expect(rowsIn(yield* front({}))).toStrictEqual([345 "fix-week-start",346 "explain-iso-week",347 "split-format",348 ]);349 })350 );

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 351why, one step back
351

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 352–357why, one step back
352 it.effect(
353 "says each project's posture once, on its group's header, and on no row",354 () =>355 Effect.gen(function* () {356 const markup = yield* front({});357 const headers = headersIn(markup);

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 358why, one step back
358

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 359why, one step back
359 const [datekit, burrow] = headers.map(([, header]) => header ?? "");

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

line 360why, one step back
360

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 361why, one step back
361 expect(headers.map(([project]) => project)).toStrictEqual([

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

lines 362–363why, one step back
362 "oscabriel/datekit",
363 "oscabriel/burrow",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 364–365why, one step back
364 ]);
365 expect({

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 366why, one step back
366 burrowLink: burrow?.includes('href="/oscabriel/burrow"'),

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 367–400why, one step back
367 burrowPosture: burrow?.includes(
368 'data-posture="openWithSealedEvidence"'369 ),370 burrowWords: textIn(burrow ?? "").includes(371 "Open with sealed evidence"372 ),373 datekitCounts: textIn(datekit ?? "").includes("2 open · 1 to take"),374 }).toStrictEqual({375 burrowLink: true,376 burrowPosture: true,377 burrowWords: true,378 datekitCounts: true,379 });380 expect(listIn(markup).match(/data-posture=/gu)).toHaveLength(2);381 expect(382 ["fix-week-start", "explain-iso-week", "split-format"].filter((ask) =>383 rowOf(markup, ask).includes("data-posture")384 )385 ).toStrictEqual([]);386 })387 );388389 it.effect(390 "draws its rows when the list of projects has not arrived, with no posture yet",391 () =>392 Effect.gen(function* () {393 const markup = yield* front({}, { projects: undefined });394395 expect(rowsIn(markup)).toHaveLength(3);396 expect(listIn(markup)).not.toContain("data-posture=");397 })398 );399400 it.effect(

Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7

line 401why, one step back
401 "says an ask held for newcomers is held for them whoever reads it, with no command for a viewer who may not take it",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 402–408why, one step back
402 () =>
403 Effect.gen(function* () {404 const markup = yield* front({});405 const row = rowOf(markup, "explain-iso-week");406407 expect(row).toContain('data-takeable="false"');408 expect(textIn(row)).toMatch(

Merge build/1500-design-draws into mainoscabrielbefore adoption9bc46b7

line 409why, one step back
409 /^(?!.*Not open to you).*Held for newcomers/su

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 410–421why, one step back
410 );
411 expect(row).not.toContain("Open to take");412 expect(row).not.toContain(`${Brand.cli} claim explain-iso-week`);413 expect(rowOf(markup, "fix-week-start")).toContain("Open to take");414 })415 );416417 it.effect("links each ask's want, and shows its kind, territory and id", () =>418 Effect.gen(function* () {419 const row = rowOf(yield* front({}), "split-format");420421 expect(row).toMatch(

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 422why, one step back
422 /<a\b[^>]*href="\/oscabriel\/burrow\/asks\/split-format"[^>]*>The format package calls the new parser\.<\/a>/u

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 423–435why, one step back
423 );
424 expect(textIn(row)).toContain("migrate · format · split-format");425 })426 );427428 it.effect(429 "gives an ask the viewer may take its claim command as text in its copy button, with no command box",430 () =>431 Effect.gen(function* () {432 const row = rowOf(yield* front({}), "fix-week-start");433434 expect(row).toMatch(435 new RegExp(

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 436why, one step back
436 `<button[^>]*aria-label="Copy claim command"[\\s\\S]*?<code[^>]*>${Brand.cli} claim fix-week-start --project oscabriel/datekit</code>`,

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 437–456why, one step back
437 "u"
438 )439 );440 // A command box's text is selectable whole; a row's command is a button's.441 expect(row).not.toContain("select-all");442 })443 );444445 it.effect("counts the asks shown, and those open to take", () =>446 Effect.gen(function* () {447 expect(textIn(yield* front({}))).toContain("3 open asks, 2 open to take");448 })449 );450451 it.effect(452 "narrows by kind, offering each kind, who an ask is for, and each project, with counts",453 () =>454 Effect.gen(function* () {455 const markup = yield* front({ kind: kind("migrate") });456 const all = yield* front({});

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 457why, one step back
457 const toolbar = filtersIn(all);

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 458–461why, one step back
458
459 expect(rowsIn(markup)).toStrictEqual(["split-format"]);460 expect(461 [

Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37

lines 462–463why, one step back
462 'href="/asks?kind=bug"',
463 'href="/asks?kind=migrate&amp;reserved=newcomers"',

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 464–467why, one step back
464 ].filter((href) => !markup.includes(href))
465 ).toStrictEqual([]);466 expect(467 [

Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37

lines 468–469why, one step back
468 'href="/asks?reserved=newcomers"',
469 'href="/asks?take=open"',

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 470why, one step back
470 'href="/asks?project=oscabriel%2Fburrow"',

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 471–484why, one step back
471 ].filter((href) => !all.includes(href))
472 ).toStrictEqual([]);473 expect(textIn(toolbar)).toMatch(474 /Open to take\s*2[\s\S]*Held for newcomers\s*1/u475 );476 expect(477 ["Reserved", "For people, not agents"].filter((words) =>478 textIn(toolbar).includes(words)479 )480 ).toStrictEqual([]);481 })482 );483484 it.effect(

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 485why, one step back
485 "draws the filters as a landmark beside the list, and no inspector",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 486–488why, one step back
486 () =>
487 Effect.gen(function* () {488 const markup = yield* front({});

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 489why, one step back
489 const board = markup.slice(markup.indexOf("data-board="));

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 490–491why, one step back
490
491 expect(

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 492–503why, one step back
492 board.indexOf('<nav aria-label="Filter the asks"')
493 ).toBeGreaterThan(-1);494 const list = board.indexOf("data-board-list");495496 expect([497 board.indexOf("</nav>") < list,498 list < board.indexOf('data-ask="'),499 ]).toStrictEqual([true, true]);500 expect(501 ["data-facts", "Start here", "Selected ask", "data-toolbar"].filter(502 (words) => markup.includes(words)503 )

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 504why, one step back
504 ).toStrictEqual([]);

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 505–520why, one step back
505 })
506 );507508 it.effect(509 "offers each kind, each state and each project in the filters, with counts, and a reset once one is set",510 () =>511 Effect.gen(function* () {512 const filters = filtersIn(yield* front({ kind: kind("bug") }));513514 expect(515 [...filters.matchAll(/<h2\b[^>]*>(?<head>[^<]+)<\/h2>/gu)].map(516 ({ groups }) => groups?.head517 )518 ).toStrictEqual(["Kind", "State", "Project"]);519 expect(textIn(filters)).toMatch(520 /All\s*3[\s\S]*bug\s*2[\s\S]*migrate\s*1[\s\S]*Open to take\s*1[\s\S]*Held for newcomers\s*1/u

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 521why, one step back
521 );

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 522–523why, one step back
522 expect(filters).toMatch(
523 /<a\b[^>]*aria-current="page"[^>]*href="\/asks\?kind=bug"|<a\b[^>]*href="\/asks\?kind=bug"[^>]*aria-current="page"/u

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 524why, one step back
524 );

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 525–528why, one step back
525 expect(filters).toMatch(
526 /<a\b[^>]*href="\/asks"[^>]*>Reset filters<\/a>/u527 );528 expect(filtersIn(yield* front({}))).not.toContain("Reset filters");

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 529–532why, one step back
529 })
530 );531532 it.effect(

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 533why, one step back
533 "keeps the filter in the address, so /asks?kind=bug&take=open shows the bugs open to take and every option keeps the rest",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 534–535why, one step back
534 () =>
535 Effect.gen(function* () {

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 536–569why, one step back
536 const markup = yield* front(readFilter({ kind: "bug", take: "open" }));
537538 const filters = filtersIn(markup);539540 expect(rowsIn(markup)).toStrictEqual(["fix-week-start"]);541 expect(542 [543 'href="/asks?kind=bug&amp;reserved=newcomers"',544 'href="/asks?take=open"',545 'href="/asks?kind=migrate&amp;take=open"',546 'href="/asks?kind=bug&amp;take=open&amp;project=oscabriel%2Fdatekit"',547 ].filter((href) => !filters.includes(href))548 ).toStrictEqual([]);549 })550 );551552 it.effect(553 "keeps one command box in the strip on a phone, the other two steps as code in the list",554 () =>555 Effect.gen(function* () {556 const strip = stripIn(yield* front({}));557558 expect(559 [560 ...strip.matchAll(561 /<code\b[^>]*data-step-text=""[^>]*>(?<command>[^<]*)<\/code>/gu562 ),563 ].map(({ groups }) => groups?.command)564 ).toStrictEqual([565 `${Brand.cli} check`,566 `git push ${Brand.slug} HEAD:main`,567 ]);568 expect(strip.match(/<div class="max-tablet:hidden">/gu)).toHaveLength(569 2

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 570why, one step back
570 );

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 571–572why, one step back
571 })
572 );

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 573why, one step back
573

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 574–579why, one step back
574 it.effect(
575 "puts one strip of three steps above the list, each a command, with a control that dismisses it",576 () =>577 Effect.gen(function* () {578 const markup = yield* front({});579 const strip = stripIn(markup);

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 580why, one step back
580

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 581–592why, one step back
581 expect([
582 ...strip.matchAll(/<code\b[^>]*select-all[^>]*>/gu),583 ]).toHaveLength(3);584 expect(585 [586 `${Brand.cli} claim <ask> --project <owner>/<name>`,587 `${Brand.cli} check`,588 `git push ${Brand.slug} HEAD:main`,589 ].filter((command) => !textIn(strip).includes(command))590 ).toStrictEqual([]);591 expect(strip).toMatch(592 /<button\b[^>]*aria-label="Dismiss how to take an ask"/u

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

line 593why, one step back
593 );

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 594–595why, one step back
594 expect(markup.indexOf("data-how-to")).toBeLessThan(
595 markup.indexOf("data-board=")

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 596why, one step back
596 );

Merge redesign into mainoscabrielbefore adoptioncaedd21

line 597why, one step back
597 expect(strip).toContain('href="/llms.txt"');

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 598–600why, one step back
598 })
599 );600

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 601–614why, one step back
601 it.effect("with an ask selected, marks its row and opens no inspector", () =>
602 Effect.gen(function* () {603 const markup = yield* renderAt(604 "/asks?ask=fix-week-start",605 <FrontPageView {...props({})} />606 );607608 expect(markup).toMatch(609 /<li\b[^>]*data-selected="true"[^>]*data-ask="fix-week-start"/u610 );611 expect(markup).not.toContain("data-facts");612 })613 );614

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 615–689why, one step back
615 it.effect("never uses the words a forge's lists use", () =>
616 Effect.gen(function* () {617 const text = textIn(yield* front({})).toLowerCase();618619 for (const word of ["queue", "inbox", "explore", "trending"]) {620 expect(text).not.toContain(word);621 }622 })623 );624625 it.effect(626 "says an empty front page is empty, with the command that starts a project",627 () =>628 Effect.gen(function* () {629 const text = textIn(yield* front({}, { entries: [], projects: [] }));630631 expect(text).toContain("No open asks");632 expect(text).toContain(`${Brand.cli} init`);633 })634 );635636 it.effect(637 "says a front page with projects but no asks needs an ask opened",638 () =>639 Effect.gen(function* () {640 const text = textIn(yield* front({}, { entries: [] }));641642 expect(text).toContain("No open asks");643 expect(text).toContain(`${Brand.cli} ask open`);644 })645 );646});647648const clientOver = (answer: (request: Request) => Promise<Response>) =>649 Layer.effect(Client)(RpcClient.make(Contracts)).pipe(650 Layer.provide(RpcClient.layerProtocolHttp({ url: "http://localhost/rpc" })),651 Layer.provide([FetchHttpClient.layer, RpcSerialization.layerJson]),652 Layer.provide(653 Layer.succeed(FetchHttpClient.Fetch, (input, init) =>654 answer(new Request(input, init))655 )656 )657 );658659const devWorld = Layer.unwrap(660 Effect.gen(function* () {661 const { dispose, handler } = devServer();662663 yield* Effect.addFinalizer(() => Effect.promise(dispose));664665 return clientOver(handler);666 })667);668669const projectsNeverAnswer = Layer.effect(670 Client,671 RpcTest.makeClient(Contracts)672).pipe(673 Layer.provide([674 Layer.mergeAll(675 unanswered,676 Contracts.toLayerHandler("frontPage", () => Effect.succeed({ entries })),677 Contracts.toLayerHandler("listProjects", () => Effect.never)678 ),679 asTester,680 ])681);682683const decodeData = Schema.decodeEffect(FrontPageData);684685/** A fresh dev world seeds itself first, which a full test run can slow past 5 s. */686const seededWorld = { timeout: 30_000 };687688const sentFrom = (data: FrontPageData, filter: FrontFilter = {}) =>689 renderAt(

Merge build/1300-w13-foundation into mainoscabrielbefore adoption0e29c37

line 690why, one step back
690 "/asks",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 691–717why, one step back
691 <FrontPageView
692 entries={data.entries}693 events={694 new Map(data.events.map(({ events, project }) => [project, events]))695 }696 filter={filter}697 now={data.now}698 parents={data.parents}699 projects={undefined}700 />701 );702703describe("the front page as the server sends it", () => {704 it.effect(705 "holds every open ask's want as a link, grouped by project, burrow's family as one fan row",706 () =>707 Effect.gen(function* () {708 const data = yield* readFrontPage.pipe(709 Effect.flatMap(decodeData),710 Effect.provide(devWorld)711 );712713 const markup = yield* sentFrom(data);714 const text = textIn(markup);715716 expect(listIn(markup)).not.toContain("Reading from the platform");717 expect(markup).toMatch(

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

line 718why, one step back
718 /<a\b[^>]*href="\/oscabriel\/datekit\/asks\/add-months-clamp"[^>]*>[^<]+<\/a>/u

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 719–720why, one step back
719 );
720 expect(headersIn(markup).map(([project]) => project)).toStrictEqual([

Merge build/1400-w14-foundation into mainoscabrielbefore adoption47dd2f8

lines 721–722why, one step back
721 "oscabriel/burrow",
722 "oscabriel/datekit",

Merge build/1221-front-and-project-homeoscabrielbefore adoption493b2dd

lines 723–757why, one step back
723 ]);
724 expect(text).toContain("10 open asks, 7 open to take");725726 const family = rowOf(markup, "drop-legacy-fetch");727 const nodes = family.match(/<li class="flex items-center gap-1.5"/gu);728729 expect({730 familyRows: rowsIn(markup).filter(731 (ask) => ask?.startsWith("drop-legacy-fetch") === true732 ),733 nodes: nodes?.length,734 noCommandBox: !listIn(markup).includes("select-all"),735 strip: /0 of 6 landed[\s\S]*Show 6 children/u.test(textIn(family)),736 }).toStrictEqual({737 familyRows: ["drop-legacy-fetch"],738 nodes: 6,739 noCommandBox: true,740 strip: true,741 });742 }),743 seededWorld744 );745746 it.effect(747 "is read without the list of projects, which may never answer",748 () =>749 Effect.gen(function* () {750 const data = yield* readFrontPage.pipe(751 Effect.flatMap(decodeData),752 Effect.provide(projectsNeverAnswer)753 );754755 expect(rowsIn(yield* sentFrom(data))).toHaveLength(3);756 })757 );

Draw every list and subject from one row, one status line, one family fan and one set of fact blocksoscabrielbefore adoption886b726

lines 758–759why, one step back
758});
759

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 760–816why, one step back
760/** A browser's storage held in a map, so a test reads back what was kept. */
761const memoryStorage = (): Storage => {762 const kept = new Map<string, string>();763764 return {765 clear: () => {766 kept.clear();767 },768 getItem: (key) => kept.get(key) ?? null,769 key: (index) => [...kept.keys()][index] ?? null,770 get length() {771 return kept.size;772 },773 removeItem: (key) => {774 kept.delete(key);775 },776 setItem: (key, value) => {777 kept.set(key, value);778 },779 };780};781782const blocked = () => {783 throw new Error("blocked");784};785786/** Storage a private window or a blocked site refuses. */787const refusingStorage = (): Storage => ({788 clear: blocked,789 getItem: blocked,790 key: blocked,791 length: 0,792 removeItem: blocked,793 setItem: blocked,794});795796describe("the strip's dismissal", () => {797 it("is remembered in the storage it is given, and is not until then", () => {798 const storage = memoryStorage();799800 expect(readHowToDismissed(storage)).toBeFalsy();801802 dismissHowTo(storage);803804 expect(readHowToDismissed(storage)).toBeTruthy();805 expect(storage).toHaveLength(1);806 });807808 it("shows the strip when there is no storage, or the storage refuses", () => {809 expect(readHowToDismissed()).toBeFalsy();810 expect(readHowToDismissed(refusingStorage())).toBeFalsy();811 expect(() => {812 dismissHowTo(refusingStorage());813 }).not.toThrow();814 });815});816

Draw every list and subject from one row, one status line, one family fan and one set of fact blocksoscabrielbefore adoption886b726

lines 817–825why, one step back
817describe("the front page's views", () => {
818 const sources: Readonly<Record<string, string>> = import.meta.glob(819 "../src/features/front/**/*.{ts,tsx}",820 { eager: true, import: "default", query: "?raw" }821 );822823 it("import no transport", () => {824 expect(Object.keys(sources).length).toBeGreaterThanOrEqual(1);825 expect(reachingTransport(sources)).toStrictEqual([]);

Merge redesign into mainoscabrielbefore adoptioncaedd21

lines 826–836why, one step back
826 });
827828 it("never write a cookie: the strip's dismissal is kept in localStorage", () => {829 expect(830 Object.entries(sources).flatMap(([path, source]) =>831 /document\.cookie|cookieStore|set-cookie/iu.test(source) ? [path] : []832 )833 ).toStrictEqual([]);834 expect(sources["../src/features/front/how-to.tsx"]).toContain(835 "localStorage"836 );

Merge build/614-env-service: deciders set write-only values for @sensitive items, the public sees the env shape, and checks see only placeholdersoscabrielbefore adoption678c8b8

lines 837–838why, one step back
837 });
838});