Skip to content
Myr

Merge build/landing-ceiling into main

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by oscabriel · committed by oscabriel · parents 9339e2b, 31f42de · Browse files · 10 files+231 added−115 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+231 added−115 removed

  • tests:+104 added−65 removed
  • other:+127 added−50 removed

10 files+231 added−115 removed

modified:apps/web/e2e/landing.e2e.ts+21 added-3 removed
modified:apps/web/src/features/landing/landing-page.tsx+22 added-19 removed
20 unmodified lines
21 docsPath,22 HOME_PATH,23 projectPath,24} from "../shared/paths.ts";25import { ReadingRows, UnreachableNotice } from "../shared/pending.tsx";25import { UnreachableNotice } from "../shared/pending.tsx";26import { PostureBadge } from "../shared/posture.tsx";27import { LandingProjects } from "./projects.ts";28import { pushTranscript } from "./transcript.ts";29import { LEDE, WHAT_IT_IS } from "./words.ts";3029/** The README's opening line: what the platform is. */30const WHAT_IT_IS =31 "A Git platform for the boundary between a project and everyone else.";3231/** A link in a plain row (the top, the foot): ink, underlined only on hover. */32const ROW_LINK = "no-underline hover:underline";3334/** The primary action: an ink button that is a link. */
6 unmodified lines
41const Code = ({ children }: { readonly children: ReactNode }) => (42 <code className={ID}>{children}</code>43);4445/** The branch's name, as git takes it. */46const MAIN = "main";4748/** The lede, its one branch name set as git takes it. */49const Lede = () => {50 const [before, after] = LEDE.split(MAIN);5152 return (53 <>54 {before}55 <Code>{MAIN}</Code>56 {after}57 </>58 );59};6061/** One part of the page under its name, parted from the last by a hairline. */62const Part = ({63 children,64 id,
202 unmodified lines
267 </figure>268 );269};270257/** The projects on the platform, each with its posture word, or why none shows yet. */271/** The projects on the platform, each with its posture, or that the list did not come. */272const Projects = ({ projects }: { readonly projects: LandingProjects }) =>273 LandingProjects.match(projects, {274 Listed: ({ projects: listed }) => (275 <ul className="flex flex-col">
8 unmodified lines
284 to={projectPath(project)}285 >286 {project}287 </AppLink>274 {/* The word alone, not the posture badge: the badge's marks275 would split into chunks every page preloads, past the276 root's byte ceiling (production-bundle.test.ts). */}277 <span278 className="text-ui text-muted-foreground"279 data-posture={posture}280 >281 {postureLabel(posture)}282 </span>288 <PostureBadge label={postureLabel(posture)} posture={posture} />289 </li>290 ))}291 </ul>292 ),287 Pending: () => <ReadingRows />,293 Unreachable: () => <UnreachableNotice />,294 });295296/** The landing, as everyone reads it. */
17 unmodified lines
314 <div className="flex flex-col gap-8">315 <div className="flex max-w-[60ch] flex-col gap-3">316 <h1 className="text-headline text-balance">{WHAT_IT_IS}</h1>317 <p className="text-body">313 Everything a project ships is public, its contribution process is314 typed code on <Code>main</Code>, and a push lands only by passing a315 typed gate.318 <Lede />319 </p>320 </div>321 <div className="flex flex-wrap items-center gap-x-4 gap-y-3">322 <AppLink className={PRIMARY} data-action="asks" to={ASKS_PATH}>
75 unmodified lines
modified:apps/web/src/features/landing/projects.ts+8 added-20 removed
added:apps/web/src/features/landing/read.ts+30 added
added:apps/web/src/features/landing/words.ts+13 added
modified:apps/web/src/routes/index.tsx+33 added-8 removed
1import { useAtomValue } from "@effect/atom-react";1import {2 createFileRoute,3 getRouteApi,4 useRouter,5} from "@tanstack/react-router";6import { createServerFn } from "@tanstack/react-start";7import { env } from "cloudflare:workers";8import { useEffect } from "react";8import { Effect, Schema } from "effect";9import { useEffect, useMemo } from "react";1010import { projectsAtom } from "../client/front.ts";11import { useSignedIn } from "../features/auth/session-slot.tsx";12import {13 markdownAlternateLink,14 markdownLink,15} from "../features/front/markdown.ts";16import { LandingView } from "../features/landing/landing-page.tsx";17import { landingProjects } from "../features/landing/projects.ts";17import { LandingProjects } from "../features/landing/projects.ts";18import { readLandingProjects } from "../features/landing/read.ts";19import { LEDE } from "../features/landing/words.ts";20import { pageHead } from "../features/shared/head.ts";21import { HOME_PATH } from "../features/shared/paths.ts";22import { branchPage } from "../server/cache-headers.ts";23import { serverClient } from "../server/client.ts";
2 unmodified lines
26// `/`, the landing: the one page drawn outside the shell. It is the same27// page for every reader, so the edge may keep it; its server GET sends a28// reader who carries a session to `/home` before the page is drawn, and29// gives an agent `llms.txt`. A signed-in reader who reaches it by a link28// is moved on once the browser knows who they are. Its projects are the29// rail's read, in the browser, so every reader is sent the same page.30// is moved on once the browser knows who they are. Its projects are read31// on the server as nobody, so every reader, script or not, is sent the32// same page with its projects in.3334const root = getRouteApi("__root__");3536/** Where the page's Markdown is. */37const MARKDOWN = "/llms.txt";3839/**40 * The projects to read, as nobody (the client without the request, so no41 * cookie reaches the platform), encoded for the loader to carry. The list42 * ignores the caller, so nobody's read is everyone's, and the page stays43 * one the edge may keep.44 */45const landingData = createServerFn({ method: "GET" }).handler(() =>46 Effect.runPromise(47 readLandingProjects.pipe(48 Effect.flatMap(Schema.encodeEffect(LandingProjects)),49 Effect.provide(serverClient(env))50 )51 )52);5354/** The landing's headers: kept briefly, varied by `Accept`, its Markdown named. */55export const landingHeaders = () => ({56 ...branchPage,57 link: markdownLink(MARKDOWN),58 vary: "Accept",59});6043/** The landing's head: its title and its Markdown; it unfurls with the site's own sentence. */61/** The landing's head: its title, its own sentence to unfurl with, and its Markdown. */62export const landingHead = () => ({63 ...pageHead({64 description: LEDE,65 title: "A git platform with a typed gate",66 }),67 links: [markdownAlternateLink(MARKDOWN)],68});
13 unmodified lines
82const Landing = () => {83 useHomeOnceSignedIn();84 const { platformUrl } = root.useLoaderData();85 const { origin } = useRouter();67 const projects = landingProjects(useAtomValue(projectsAtom));86 const loaded = Route.useLoaderData();8788 const projects = useMemo(89 () => Schema.decodeSync(LandingProjects)(loaded),90 [loaded]91 );9293 return (94 <LandingView95 platformUrl={platformUrl}96 projects={projects}
3 unmodified lines
100};101102export const Route = createFileRoute("/")({103 staticData: { shell: "bare" },104 loader: () => landingData(),105 head: landingHead,106 headers: landingHeaders,107 component: Landing,108 server: {
8 unmodified lines
modified:apps/web/test/landing.test.tsx+49 added-26 removed
2 unmodified lines
3 * way to the open asks before anything else, the install line to copy, the4 * screen `git push` prints when the gate refuses (from the one renderer),5 * the four nouns, the loop, and the projects to read, each with its6 * posture. Drawn in the house style: no banned word, and no rounded,7 * shadowed or gradient surface. Its projects are the rail's read, in the8 * browser, so the page is the same for everyone.7 * shadowed or gradient surface. Its projects are read on the server as8 * nobody, so the page is the same for everyone, script or not.9 */10import { describe, expect, it } from "@effect/vitest";11import { Brand } from "@repo/brand";12import { Contracts } from "@repo/protocol/contracts";13import { ProjectListing } from "@repo/protocol/domain/front-page";14import { Effect, Schema } from "effect";14import { AsyncResult } from "effect/reactivity";1516import { LandingView } from "../src/features/landing/landing-page.tsx";17import {18 LandingProjects,19 landingProjects,19 PROJECTS_SHOWN,20} from "../src/features/landing/projects.ts";21import { readLandingProjects } from "../src/features/landing/read.ts";22import { LEDE } from "../src/features/landing/words.ts";23import { landingHead } from "../src/routes/index.tsx";24import { textIn } from "./markup.ts";25import { platformWith, unreachablePlatform } from "./platform.ts";26import { renderAt } from "./render.tsx";2728const PLATFORM = "https://platform.example.workers.dev";29
87 unmodified lines
117 );118 expect(markup).toMatch(119 /data-project="burrow"[\s\S]*?data-posture="open"/u120 );121 // The posture badge, with its mark, not the word alone.122 expect(123 markup124 .slice(markup.indexOf('data-project="datekit"'))125 .split("</li>")[0]126 ).toContain("<svg");127 })128 );129130 it("unfurls with its own sentence, the README's lede", () => {131 expect(landingHead().meta).toContainEqual({132 content: LEDE,133 name: "description",134 });135 });136137 it.effect(138 "says so when the projects did not come, and still leads to the asks",139 () =>140 Effect.gen(function* () {
45 unmodified lines
186 })187 );188});189174describe(landingProjects, () => {175 const listing = Schema.decodeSync(Schema.Array(ProjectListing))(190/** A platform that lists `projects`, and answers nothing else. */191const listing = (projects: readonly ProjectListing[]) =>192 platformWith(193 Contracts.toLayerHandler("listProjects", () => Effect.succeed({ projects }))194 );195196describe("the landing's projects, read on the server", () => {197 const many = Schema.decodeSync(Schema.Array(ProjectListing))(198 Array.from({ length: PROJECTS_SHOWN + 2 }, (_, at) => ({199 openAsks: 1,200 posture: "open",201 project: `project-${at}`,202 }))203 );204183 it("names the first eight projects, waits while they come, and says when they did not", () => {184 expect(185 LandingProjects.match(186 landingProjects(AsyncResult.success({ projects: listing })),187 {188 Listed: ({ projects }) => projects.length,189 Pending: () => -1,190 Unreachable: () => -2,191 }192 )193 ).toBe(PROJECTS_SHOWN);194 expect(landingProjects(AsyncResult.initial())._tag).toBe("Pending");195 expect(landingProjects(AsyncResult.fail("down"))._tag).toBe("Unreachable");196 });197});205 it.effect("names the first eight projects the platform lists", () =>206 Effect.gen(function* () {207 const read = yield* readLandingProjects.pipe(208 Effect.provide(listing(many))209 );210199describe("the landing while its projects come", () => {200 it.effect("keeps their place, busy, and still leads to the asks", () =>211 expect(212 LandingProjects.match(read, {213 Listed: ({ projects }) => projects.map(({ project }) => project),214 Unreachable: () => [],215 })216 ).toStrictEqual(217 many.slice(0, PROJECTS_SHOWN).map(({ project }) => project)218 );219 })220 );221222 it.effect("says so, and never fails, when the platform did not answer", () =>223 Effect.gen(function* () {202 const markup = yield* pageWith(LandingProjects.cases.Pending.make({}));224 const read = yield* readLandingProjects.pipe(225 Effect.provide(unreachablePlatform)226 );227204 expect(markup).toContain('aria-busy="true"');205 expect(hrefsOf(markup)).toContain("/asks");228 expect(read._tag).toBe("Unreachable");229 })230 );231});
modified:apps/web/test/llms.test.ts+15 added-31 removed
8 unmodified lines
9import type { CommandDoc } from "@repo/agent-kit/command-doc";10import { fullLlms } from "@repo/agent-kit/full-llms";11import { Brand } from "@repo/brand";12import { claimForkName, workingForkName } from "@repo/project/repo-names";13import { Client, Contracts } from "@repo/protocol/contracts";13import { Contracts } from "@repo/protocol/contracts";14import type { AskListing } from "@repo/protocol/domain/ask";15import type { ProjectListing } from "@repo/protocol/domain/front-page";16import { AskId, Handle, KindName, ProjectName } from "@repo/protocol/ids";17import { asTester, unanswered } from "@repo/protocol/testing";18import { Effect, Layer, Option } from "effect";17import { Effect, Option } from "effect";19import { RpcTest } from "effect/rpc";1819import { commands as catalog } from "../src/features/agents/catalog.ts";20import {21 frontLlms,
10 unmodified lines
32import { landingHead, landingHeaders } from "../src/routes/index.tsx";33import { llmsFullHandler } from "../src/routes/llms-full[.]txt.ts";34import { frontPageHandler, landingHandler } from "../src/server/front-page.ts";35import { projectPageHandler } from "../src/server/project-page.ts";36import { platformWith, unreachablePlatform } from "./platform.ts";3738const platformUrl = "https://platform-test.example.workers.dev";3940const webUrl = "https://web-test.example.workers.dev";
300 unmodified lines
341});342343/** A platform that lists `listed` as its projects, and answers nothing else. */344const listing = (listed: readonly ProjectListing[]) => () =>346 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(347 Layer.provide([348 Layer.mergeAll(349 unanswered,350 Contracts.toLayerHandler("listProjects", () =>351 Effect.succeed({ projects: listed })352 )345 platformWith(346 Contracts.toLayerHandler("listProjects", () =>347 Effect.succeed({ projects: listed })348 )353 ),354 asTester,355 ])349 );350351/** A platform that cannot be reached: every call dies on the way. */359const unreachable = () =>360 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(361 Layer.provide([unanswered, asTester])362 );352const unreachable = () => unreachablePlatform;353354const getFull = () => new Request(`${webUrl}/llms-full.txt`);355356const read = (response: Response) =>
83 unmodified lines
440/** A platform that lists `listed` as its projects and `listedAsks` as datekit's asks. */441const listingWithAsks =442 (listed: readonly ProjectListing[], listedAsks: readonly AskListing[]) =>443 () =>454 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(455 Layer.provide([456 Layer.mergeAll(457 unanswered,458 Contracts.toLayerHandler("listProjects", () =>459 Effect.succeed({ projects: listed })460 ),461 Contracts.toLayerHandler("listAsks", () =>462 Effect.succeed({ asks: listedAsks })463 )444 platformWith(445 Contracts.toLayerHandler("listProjects", () =>446 Effect.succeed({ projects: listed })447 ),448 Contracts.toLayerHandler("listAsks", () =>449 Effect.succeed({ asks: listedAsks })450 )464 ),465 asTester,466 ])451 );452453/** A request for `path` on the web host, accepting `accept`. */454const getAt = (path: string, accept: string) =>
140 unmodified lines
added:apps/web/test/platform.ts+19 added
1/**2 * A platform for a test to read from: the contracts it sets up answer, and3 * every other dies on the way (`unanswered`), as the tester.4 */5import { Client, Contracts } from "@repo/protocol/contracts";6import { asTester, unanswered } from "@repo/protocol/testing";7import { Layer } from "effect";8import { RpcTest } from "effect/rpc";910/** A platform that answers only the contracts in `handlers`, each a `Contracts.toLayerHandler` layer. */11export const platformWith = (12 ...handlers: readonly Layer.Layer<never>[]13): Layer.Layer<Client> =>14 Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(15 Layer.provide([Layer.mergeAll(unanswered, ...handlers), asTester])16 );1718/** A platform that cannot be reached: every call dies on the way. */19export const unreachablePlatform: Layer.Layer<Client> = platformWith();
modified:apps/web/test/production-bundle.test.ts+21 added-8 removed
59 unmodified lines
60] as const;6162/**63 * The most the chunks every page preloads (the root route's) may weigh,64 * gzipped: about 10% above what they weighed (222,169 bytes in 19 chunks)65 * once the Markdown renderer and the views it came with left them (322,04966 * in 31 before).64 * gzipped: about 10% above what they weighed (244,172 bytes in 47 chunks)65 * once the landing read its projects on the server (243,991 before; 222,16966 * in 19 chunks when the Markdown renderer left them, 322,049 in 31 before67 * that). Raised on the user's sign-off, 2026-10-10. A route's `head`,68 * `loader` and server functions ride in the route tree every page loads,69 * so what they import counts here; its view does not, and the landing's70 * must not: the next case holds it out.71 */68const ROOT_PRELOADS_GZIP = 244_000;72const ROOT_PRELOADS_GZIP = 268_000;7374/** A Shiki grammar module, by its name. */75const GRAMMAR = /node_modules\/@shikijs\/langs\/dist\/(?<name>[\w-]+)\.mjs$/u;76
325 unmodified lines
402 ),403 missing: preloads.filter(404 (chunk) => !output.texts.has(`client${chunk}`)405 ),402 underCeiling: total <= ROOT_PRELOADS_GZIP,403 }).toStrictEqual({ markdown: [], missing: [], underCeiling: true });406 }).toStrictEqual({ markdown: [], missing: [] });407 // The weight itself, so a failure says how far over it is.408 expect(409 total,410 `${preloads.length} root preloads, gzipped`411 ).toBeLessThanOrEqual(ROOT_PRELOADS_GZIP);412 })413 );414415 it.effect(408 "preloads on every page no grammar and nothing of the server's highlighting",416 "preloads on every page no grammar, nothing of the server's highlighting, and not the landing's view",417 () =>418 Effect.gen(function* () {419 const output = yield* Built;420421 // Nor the landing's view: a route's head or loader that imported422 // it would carry the whole page into every page's preloads.423 expect(424 rootPreloads(output).flatMap((chunk) =>425 (output.holding.get(`client${chunk}`) ?? []).filter(416 (module) => GRAMMAR.test(module) || module.includes("prerender")426 (module) =>427 GRAMMAR.test(module) ||428 module.includes("prerender") ||429 module.endsWith("features/landing/landing-page.tsx")430 )431 )432 ).toStrictEqual([]);433
60 unmodified lines