Merge build/1499-w14-integration 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 f4f4cc7, fab9d95 · Browse files · 7 files·+156 added−83 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
7 files+156 added−83 removed
- other:+156 added−83 removed
Provenance
- Commit
cb4fcca- Tree
5ffda4a- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
f4f4cc7- Parent 2
fab9d95
7 files changed+156 added−83 removed
modified:apps/web/e2e/a11y.e2e.ts+5 added-5 removed
18 unmodified lines19 *20 * It runs only against `WEB_URL`, the web's dev world with its fixtures21 * (`VITE_DEV_FIXTURES=1 bun run dev -- --port <port>`): the pages it visits22 * are the fixture project's, and it signs in through the dev world's own23- * `/auth/dev`. `A11Y_PROJECT` names the fixture project (vellum unless24- * given). It only reads, but for the keys switch, kept in this browser.23+ * `/auth/dev`. `A11Y_PROJECT` names the fixture project by its full name24+ * (`oscabriel/vellum` unless given). It only reads, but for the keys switch, kept in this browser.25 */26 import { expect, test } from "@playwright/test";27 import type { Browser, BrowserContext, Page } from "@playwright/test";28 import { Brand } from "@repo/brand";4 unmodified lines33 const settings = Effect.runSync(34 Effect.gen(function* () {35 return {36 project: yield* Config.NonEmptyString("A11Y_PROJECT").pipe(37- Config.withDefault("vellum")37+ Config.withDefault("oscabriel/vellum")38 ),39 web: Option.map(40 yield* Config.option(Config.NonEmptyString("WEB_URL")),41 (url) => url.replace(/\/+$/u, "")32 unmodified lines74 { name: "front, signed in", path: "/asks", signedIn: true },75 { name: "today", path: "/today", signedIn: true },76 { name: "today, signed out", path: "/today" },77 { name: "project home", path: `/${project}` },78- { name: "project home, examples", path: "/burrow" },79- { name: "project home, no open asks", path: "/mossgate" },78+ { name: "project home, examples", path: "/oscabriel/burrow" },79+ { name: "project home, no open asks", path: "/lin-h/mossgate" },80 { name: "ask, open", path: `/${project}/asks/lint-heading-levels` },81 {82 name: "ask, held for newcomers",83 path: `/${project}/asks/document-cli-flags`,659 unmodified linesmodified:apps/web/e2e/deployed.e2e.ts+6 added-3 removed
15 unmodified lines16 * packages"), so `WEB_PROJECT=burrow` alone checks burrow. It only reads.17 */18 import { expect, test } from "@playwright/test";19 import type { Page } from "@playwright/test";20+import { ProjectName } from "@repo/protocol/ids";21 import { Config, Effect, Option } from "effect";22 23 /**24 * What the check looks at in each seeded example unless told otherwise: an15 unmodified lines40 41 /** What the check reads of its env: where the web lives, and which ask to look at. */42 const settings = Effect.runSync(43 Effect.gen(function* () {44+ // Read by the one parser: `burrow` and `oscabriel/burrow` alike.43- const project = yield* Config.NonEmptyString("WEB_PROJECT").pipe(44- Config.withDefault("datekit")45+ const project = yield* Config.schema(ProjectName, "WEB_PROJECT").pipe(46+ Config.withDefault(ProjectName.make("oscabriel/datekit"))47 );48 47- const example = project === "burrow" ? examples.burrow : examples.datekit;49+ const example =50+ project === "oscabriel/burrow" ? examples.burrow : examples.datekit;51 52 return {53 ask: yield* Config.NonEmptyString("WEB_ASK").pipe(54 Config.withDefault(example.ask)250 unmodified linesmodified:apps/web/e2e/imports.e2e.ts+121 added-57 removed
13 unmodified lines14 * root folder, a file at line 5, the log, and why that file's lines are15 * there.16 *17 * It runs only against `WEB_URL` (a dev stage's web origin) and is skipped18- * without it. `WEB_IMPORTS` narrows it to some projects (a comma list),19- * for a run while the imports go in one at a time. It only reads.18+ * without it. `WEB_IMPORTS` narrows it to some projects, a comma list of19+ * full names (`github.com/pallets/click`), for a run while the imports go20+ * in one at a time. Every address it visits or expects is the project's21+ * full name (ADR 0032). It only reads.22 */23 import { expect, test } from "@playwright/test";24 import type { Page } from "@playwright/test";25 import { Brand } from "@repo/brand";26+import { ProjectName } from "@repo/protocol/ids";24-import { Config, Console, Effect, Option } from "effect";27+import { Config, Console, Effect, Option, Schema } from "effect";28 29 /** One imported project: where its pages look, and what they must show. */30 interface Imported {31 readonly project: string;135 unmodified lines167 };168 })169 );170 168-/** Those of `all` this run visits: `WEB_IMPORTS`' names, or all of them. */171+/**172+ * A project's full name, read by the one parser (ADR 0032): an import's173+ * key from before owners (`click`) reads as its source path174+ * (`github.com/pallets/click`), and a full name as itself.175+ */176+const nameOf = (spelled: string): ProjectName =>177+ Schema.decodeSync(ProjectName)(spelled);178+179+/** `text` as a regular expression matches it, literally. */180+const escaped = (text: string) =>181+ text.replaceAll(/[.*+?^${}()|[\]\\]/gu, "\\$&");182+183+/** A project's address on the web: its full name. */184+const homeOf = (project: string) => `/${nameOf(project)}`;185+186+/**187+ * Those of `all` this run visits: `WEB_IMPORTS`' full names188+ * (`github.com/pallets/click`), or all of them.189+ */190 const visitedOf = <A extends { readonly project: string }>(191 all: readonly A[]192 ): readonly A[] =>193 Option.match(settings.only, {194 onNone: () => all,195 onSome: (names) => {175- const named = new Set(names.split(",").map((name) => name.trim()));196+ const named = new Set(197+ names.split(",").map((name) => nameOf(name.trim()))198+ );199 177- return all.filter(({ project }) => named.has(project));200+ return all.filter(({ project }) => named.has(nameOf(project)));201 },202 });203 204 const visited = visitedOf(imports);126 unmodified lines331 /** The newest commit's page, as the log links it. */332 const newestCommit = (browser: Page, project: string) =>333 Effect.gen(function* () {334 const response = yield* awaited(() =>312- browser.goto(at(`/${project}/commits/main`))335+ browser.goto(at(`${homeOf(project)}/commits/main`))336 );337 338 expect(response?.status()).toBe(200);339 317- const link = browser.locator(`a[href^="/${project}/commit/"]`).first();340+ const link = browser341+ .locator(`a[href^="${homeOf(project)}/commit/"]`)342+ .first();343 344 yield* awaited(() => expect(link).toBeVisible());345 346 const href = yield* awaited(() => link.getAttribute("href"));10 unmodified lines357 */358 const homeWanted = (project: string, readme: string) => ({359 selectors: [360 "[data-readme]",336- `section[aria-label="Take part"]:visible:has-text("/${project}.git")`,361+ `section[aria-label="Take part"]:visible:has-text("${homeOf(project)}.git")`,362 ],363 texts: [readme],364 });365 7 unmodified lines373 Effect.runPromise(374 visit(375 browser,376 project,352- `/${project}`,377+ homeOf(project),378 "home",379 homeWanted(project, readme)380 )381 ));3 unmodified lines385 timedProject386 ? timed(387 browser,388 project,364- `/${project}/tree/main/${dir}`,389+ `${homeOf(project)}/tree/main/${dir}`,390 "tree",391 `[data-entry="${entry}"]`392 )368- : visit(browser, project, `/${project}/tree/main/${dir}`, "tree", {369- selectors: [`[data-entry="${entry}"]`],370- })393+ : visit(394+ browser,395+ project,396+ `${homeOf(project)}/tree/main/${dir}`,397+ "tree",398+ {399+ selectors: [`[data-entry="${entry}"]`],400+ }401+ )402 ));403 404 test(`${project}'s ${file} opens at line 5`, ({ page: browser }) =>405 Effect.runPromise(406 Effect.gen(function* () {407 yield* visit(408 browser,409 project,379- `/${project}/blob/main/${file}#L5`,410+ `${homeOf(project)}/blob/main/${file}#L5`,411 "blob",412 {413 selectors: ['[data-toolbar="file"]'],414 texts: ["Permalink"],5 unmodified lines420 ));421 422 test(`${project}'s log groups its commits by day`, ({ page: browser }) =>423 Effect.runPromise(393- visit(browser, project, `/${project}/commits/main`, "commits", {394- selectors: [`a[href^="/${project}/commit/"]`, "[data-day]"],424+ visit(browser, project, `${homeOf(project)}/commits/main`, "commits", {425+ selectors: [`a[href^="${homeOf(project)}/commit/"]`, "[data-day]"],426 texts: ["Landings"],427 })428 ));429 23 unmodified lines453 ));454 455 test(`${project}'s refs show main and its tags`, ({ page: browser }) =>456 Effect.runPromise(426- visit(browser, project, `/${project}/refs`, "refs", {457+ visit(browser, project, `${homeOf(project)}/refs`, "refs", {458 selectors: ['[data-ref="main"]'],459 texts: ["Landed at", "Tags"],460 })461 ));4 unmodified lines466 Effect.runPromise(467 visit(468 browser,469 project,439- `/${project}/people`,470+ `${homeOf(project)}/people`,471 "people",472 evaluated473 ? { selectors: ['[data-paths="**"]'] }474 : {12 unmodified lines487 timedProject488 ? timed(489 browser,490 project,460- `/${project}/why/main/${file}`,491+ `${homeOf(project)}/why/main/${file}`,492 "why",493 "[data-range]"494 )464- : visit(browser, project, `/${project}/why/main/${file}`, "why", {465- selectors: ["[data-range]"],466- })495+ : visit(496+ browser,497+ project,498+ `${homeOf(project)}/why/main/${file}`,499+ "why",500+ {501+ selectors: ["[data-range]"],502+ }503+ )504 ));505 506 if (timedProject) {507 test(`${project}'s ${file} history lists the commits that changed it`, ({2 unmodified lines510 Effect.runPromise(511 timed(512 browser,513 project,477- `/${project}/commits/main?path=${encodeURIComponent(file)}`,514+ `${homeOf(project)}/commits/main?path=${encodeURIComponent(file)}`,515 "commits-path",479- `a[href^="/${project}/commit/"]`516+ `a[href^="${homeOf(project)}/commit/"]`517 )518 ));519 }520 };4 unmodified lines525 Effect.runPromise(526 visit(527 browser,528 project,492- `/${project}`,529+ homeOf(project),530 "home",531 homeWanted(project, readme)532 )533 ));534 535 test(`${project}'s root lists ${file}`, ({ page: browser }) =>536 Effect.runPromise(500- visit(browser, project, `/${project}/tree/main`, "tree", {537+ visit(browser, project, `${homeOf(project)}/tree/main`, "tree", {538 selectors: [`[data-entry="${file}"]`],539 })540 ));541 2 unmodified lines544 Effect.gen(function* () {545 yield* visit(546 browser,547 project,511- `/${project}/blob/main/${file}#L5`,548+ `${homeOf(project)}/blob/main/${file}#L5`,549 "blob",550 {551 selectors: ['[data-toolbar="file"]'],552 }4 unmodified lines557 ));558 559 test(`${project}'s log groups its commits by day`, ({ page: browser }) =>560 Effect.runPromise(524- visit(browser, project, `/${project}/commits/main`, "commits", {525- selectors: [`a[href^="/${project}/commit/"]`, "[data-day]"],561+ visit(browser, project, `${homeOf(project)}/commits/main`, "commits", {562+ selectors: [`a[href^="${homeOf(project)}/commit/"]`, "[data-day]"],563 })564 ));565 566 test(`${project}'s ${file} says why each line is there`, ({567 page: browser,568 }) =>569 Effect.runPromise(533- visit(browser, project, `/${project}/why/main/${file}`, "why", {570+ visit(browser, project, `${homeOf(project)}/why/main/${file}`, "why", {571 selectors: ["[data-range]"],572 })573 ));574 };5 unmodified lines580 (browser) =>581 Effect.gen(function* () {582 // Annotated tags, listed peeled to their commits: a tag's tree opens.583 // The newest come first, a hundred a page: 1.0.0 is on the second.547- yield* visit(browser, "anyhow", "/anyhow/refs?from=100", "refs-tags", {548- selectors: ['[data-tag="1.0.0"]'],549- });584+ yield* visit(585+ browser,586+ "anyhow",587+ `${homeOf("anyhow")}/refs?from=100`,588+ "refs-tags",589+ {590+ selectors: ['[data-tag="1.0.0"]'],591+ }592+ );593 594 const tagged = browser.locator('[data-tag="1.0.0"] a').first();595 596 expect(yield* awaited(() => tagged.getAttribute("href"))).toBe(554- "/anyhow/tree/1.0.0"597+ `${homeOf("anyhow")}/tree/1.0.0`598 );599 557- yield* visit(browser, "anyhow", "/anyhow/tree/1.0.0", "tag-tree", {558- selectors: ['[data-entry="Cargo.toml"]'],559- });600+ yield* visit(601+ browser,602+ "anyhow",603+ `${homeOf("anyhow")}/tree/1.0.0`,604+ "tag-tree",605+ {606+ selectors: ['[data-entry="Cargo.toml"]'],607+ }608+ );609 }),610 ],611 [612 "awesome",613 (browser) =>614 Effect.gen(function* () {615 // The 78 KB README renders, its relative links pinned to a commit.567- yield* visit(browser, "awesome", "/awesome", "readme-links", {616+ yield* visit(browser, "awesome", homeOf("awesome"), "readme-links", {617 texts: ["Contribution guide", "Front-End Development"],618 });619 620 const href = yield* awaited(() =>3 unmodified lines624 .getAttribute("href")625 );626 627 expect(href).toMatch(579- /^\/awesome\/blob\/[0-9a-f]{40}\/contributing\.md$/u628+ new RegExp(629+ `^${escaped(homeOf("awesome"))}/blob/[0-9a-f]{40}/contributing\\.md$`,630+ "u"631+ )632 );633 }),634 ],635 [3 unmodified lines639 // Seven levels down: the deepest folder's file opens.640 yield* visit(641 browser,642 "changesets",591- "/changesets/blob/main/packages/cli/src/commands/status/__tests__/status.test.ts",643+ `${homeOf("changesets")}/blob/main/packages/cli/src/commands/status/__tests__/status.test.ts`,644 "deep-file",645 { texts: ["Permalink"] }646 );647 4 unmodified lines652 while (!found && from < 1000) {653 yield* visit(654 browser,655 "changesets",604- from === 0 ? "/changesets/refs" : `/changesets/refs?from=${from}`,656+ from === 0657+ ? `${homeOf("changesets")}/refs`658+ : `${homeOf("changesets")}/refs?from=${from}`,659 "refs-scoped",660 { texts: ["Tags"] }661 );662 found =11 unmodified lines674 .first()675 .getAttribute("href")676 );677 624- expect(href).toMatch(/^\/changesets\/tree\/%40changesets%2Fcli%40/u);678+ expect(href).toMatch(679+ new RegExp(680+ `^${escaped(homeOf("changesets"))}/tree/%40changesets%2Fcli%40`,681+ "u"682+ )683+ );684 685 yield* visit(browser, "changesets", href ?? "", "scoped-tag-tree", {686 selectors: ['[data-entry="packages"]'],687 });3 unmodified lines691 "click",692 (browser) =>693 Effect.gen(function* () {694 // Past the first 30 commits, by Older.636- yield* visit(browser, "click", "/click/commits/main", "log-first", {637- texts: ["Older"],638- });695+ yield* visit(696+ browser,697+ "click",698+ `${homeOf("click")}/commits/main`,699+ "log-first",700+ {701+ texts: ["Older"],702+ }703+ );704 yield* awaited(() => browser.getByText("Older").first().click());705 yield* awaited(() => browser.waitForURL(/from=30/u));706 yield* awaited(() =>707 expect(643- browser.locator('a[href^="/click/commit/"]').first()708+ browser.locator(`a[href^="${homeOf("click")}/commit/"]`).first()709 ).toBeVisible()710 );711 yield* whole(browser);712 yield* shoot(browser, "click", "log-older");6 unmodified lines719 // A gitlink lists as a submodule, with no page of its own.720 yield* visit(721 browser,722 "fuzzel",658- "/fuzzel/tree/main/external",723+ `${homeOf("fuzzel")}/tree/main/external`,724 "submodule",725 {726 selectors: ['[data-entry="external/wlr-protocols"]'],727 }9 unmodified lines737 "ky",738 (browser) =>739 Effect.gen(function* () {740 // Lowercase `readme.md`, and its SVG logo shown through raw.676- yield* visit(browser, "ky", "/ky", "readme-logo", {741+ yield* visit(browser, "ky", homeOf("ky"), "readme-logo", {742 selectors: ['[data-readme="readme.md"]'],743 });744 680- const logo =681- '[data-readme] img[src^="/ky/raw/"][src$="/media/logo.svg"]';745+ const logo = `[data-readme] img[src^="${homeOf("ky")}/raw/"][src$="/media/logo.svg"]`;746 747 yield* loaded(browser, logo);748 }),749 ],4 unmodified lines754 // A 730 KB header opens, cut or drawn, never a crash.755 yield* visit(756 browser,757 "stb",694- "/stb/blob/main/tests/caveview/glext.h",758+ `${homeOf("stb")}/blob/main/tests/caveview/glext.h`,759 "large-file",760 { texts: ["glext.h"] }761 );762 763 // A PNG shows as an image.764 yield* visit(765 browser,766 "stb",703- "/stb/blob/main/data/easy_font_raw.png",767+ `${homeOf("stb")}/blob/main/data/easy_font_raw.png`,768 "png",769 {706- selectors: ['img[src^="/stb/raw/"]'],770+ selectors: [`img[src^="${homeOf("stb")}/raw/"]`],771 }772 );709- yield* loaded(browser, 'img[src^="/stb/raw/"]');773+ yield* loaded(browser, `img[src^="${homeOf("stb")}/raw/"]`);774 }),775 ],776 ]);777 8 unmodified lines786 // page's own reads.787 test.setTimeout(240_000);788 789 for (const imported of visited) {726- test.describe(imported.project, () => {790+ test.describe(nameOf(imported.project), () => {791 pages(imported);792 793 const specific = specifics.get(imported.project);794 5 unmodified lines800 });801 }802 803 for (const imported of visitedOf(known)) {740- test.describe(imported.project, () => {804+ test.describe(nameOf(imported.project), () => {805 knownPages(imported);806 });807 }808 });modified:apps/web/e2e/people.e2e.ts+4 added-2 removed
6 unmodified lines789101112131415161718171819202122232464 unmodified lines6 unmodified lines * without it. `WEB_PROJECT` picks the project (datekit, which the seed puts * on every stage, unless given). It only reads. */import { expect, test } from "@playwright/test";import { ProjectName } from "@repo/protocol/ids";import { Config, Effect, Option } from "effect";
/** What the check reads of its env: where the web lives, and which project to look at. */const settings = Effect.runSync( Effect.gen(function* () { return { // Read by the one parser: `datekit` and `oscabriel/datekit` alike. project: yield* Config.NonEmptyString("WEB_PROJECT").pipe( Config.withDefault("datekit") project: yield* Config.schema(ProjectName, "WEB_PROJECT").pipe( Config.withDefault(ProjectName.make("oscabriel/datekit")) ), web: Option.map( yield* Config.option(Config.NonEmptyString("WEB_URL")), (url) => url.replace(/\/+$/u, "")64 unmodified linesmodified:apps/web/e2e/tags.e2e.ts+11 added-9 removed
4 unmodified lines5 * the first one's tree opens. The package's page is saved as6 * `e2e/out/tags.png` for the shot list.7 *8 * It runs only against `WEB_URL` (a stage's web origin) and is skipped9- * without it. `WEB_TAGS_PROJECT` picks the project (changesets, which10- * `scripts/import-examples.ts` puts on a dev stage, unless given). It only9+ * without it. `WEB_TAGS_PROJECT` picks the project by its full name10+ * (`github.com/changesets/changesets`, which `scripts/import-examples.ts`11+ * puts on a dev stage, unless given). It only12 * reads.13 */14 import { expect, test } from "@playwright/test";15+import { ProjectName } from "@repo/protocol/ids";16 import { Config, Effect, Option } from "effect";17 18 /** What the check reads of its env: where the web lives, and which project to look at. */19 const settings = Effect.runSync(20 Effect.gen(function* () {21 return {20- project: yield* Config.NonEmptyString("WEB_TAGS_PROJECT").pipe(21- Config.withDefault("changesets")22+ // Read by the one parser: `changesets` and its full name alike.23+ project: yield* Config.schema(ProjectName, "WEB_TAGS_PROJECT").pipe(24+ Config.withDefault(ProjectName.make("github.com/changesets/changesets"))25 ),26 web: Option.map(27 yield* Config.option(Config.NonEmptyString("WEB_URL")),28 (url) => url.replace(/\/+$/u, "")95 unmodified lines124 const tree = yield* awaited(() =>125 tags.first().locator("a").first().getAttribute("href")126 );127 125- expect(tree).toMatch(126- new RegExp(127- `^/${project}/tree/${encodeURIComponent(`${PACKAGE}@`)}`,128- "u"128+ expect(129+ tree?.startsWith(130+ `/${project}/tree/${encodeURIComponent(`${PACKAGE}@`)}`131 )130- );132+ ).toBe(true);133 134 const opened = yield* awaited(() =>135 browser.goto(`${web}${tree ?? ""}`)136 );8 unmodified linesmodified:apps/web/e2e/why.e2e.ts+5 added-3 removed
14 unmodified lines151617181920212223242524252627282930313231333435363754 unmodified lines14 unmodified lines * where nothing was answered). It only reads. */import { expect, test } from "@playwright/test";import { Brand } from "@repo/brand";import { ProjectName } from "@repo/protocol/ids";import { Config, Effect, Option } from "effect";
/** What the check reads of its env: where the web lives, and which file to look at. */const settings = Effect.runSync( Effect.gen(function* () { // Read by the one parser: `burrow` and `oscabriel/burrow` alike. const project = yield* Config.NonEmptyString("WEB_PROJECT").pipe( Config.withDefault("datekit") const project = yield* Config.schema(ProjectName, "WEB_PROJECT").pipe( Config.withDefault(ProjectName.make("oscabriel/datekit")) );
return { path: yield* Config.NonEmptyString("WEB_WHY_PATH").pipe( Config.withDefault( project === "burrow" project === "oscabriel/burrow" ? `${Brand.configDir}/asks/drop-legacy-fetch.ask.ts` : "src/format.ts" ) ),54 unmodified linesmodified:AGENTS.md+4 added-4 removed
11 unmodified lines12 13 | # | Principle | Held by |14 | --- | --- | --- |15 | 1 | **Encode lessons in structure; prose is the last rung.** When a mistake repeats, make it unrepresentable, then a lint or a test. | No fence |16-| 2 | **Parse at the boundary, trust inside.** Decode every external input (HTTP, git, DO RPC, WebSocket, rule facts, env) with Effect Schema; inside, use branded types (`AskId`, `LandedSha`, `PatchId`). Decode the Worker `env` once, in one Layer. | The Effect diagnostics at error in `tsconfig.base.json`; `anti-slop/no-unknown-parameters`, `anti-slop/no-widen-then-assert` and `anti-slop/require-safety-comment-for-type-assertion`; `apps/platform/test/platform.test.ts` (a bad env fails at start, decoded once in `apps/platform/src/platform.ts`); `apps/platform/test/bindings.test.ts` (the decoded bindings, vars and secrets equal each wrangler.jsonc block's, the `AI` binding, `DRAFT_LIMIT`, `DRAFT_MODEL`, `PUBLIC_WEB_URL` and the code store's `CODE_CACHE` among them, and each port's factory takes its binding as the generated Env types it, without a cast); `packages/project/test/code-history.test.ts` (a kept code-history value is decoded with Schema when read, and one that no longer decodes is computed again); `packages/project/test/code.test.ts` (a kept commit that no longer decodes is computed again); `apps/web/test/dev-fixtures.test.ts` (the dev world's fixture record is decoded through the protocol's schemas when the world is built, so every case reads only a record that decodes) |17-| 3 | **Refusals are a closed `Schema.TaggedError` union and a public contract.** Handle them with `Match.exhaustive` or `catchTags`. Each carries a `retryable` and a `next` command fixed per tag, an optional `at`, and no `message` field. A `_tag` is renamed only with an alias. `protocol/render` is the one renderer for git `remote:`, CLI and MCP text. Stage-1 refusals accumulate. | `packages/protocol/test/refusal.test.ts` and `packages/protocol/test/render.test.ts` (every tag, the code reads' and drafting's `UnknownPath`, `UnknownRevision`, `UnknownProposal`, `ProposalClosed` and `DraftInProgress` included; a limit's refusal names its kind and its wait, and a ref outside `refs/heads/` reads as one the platform writes); `packages/agent-kit/test/full-llms.test.ts` (every tag in the union has a row in `/llms-full.txt`); `packages/protocol/test/mcp.test.ts` (a refusal from tools/call keeps its tag); `anti-slop-effect/prefer-effect-match` and `anti-slop-effect/no-manual-tag-comparison`; `packages/gate/test/shape.test.ts` (one push hears every stage-1 refusal at once); `apps/platform/test/mcp.test.ts` (each refusing MCP contract comes back as its exact refusal, `draftAsk`, `showProposal` and a code read's `UnknownPath` included); `apps/platform/test/workflows/draft.test.ts` (past the draft limit, `CapReached`); `apps/cli/test/policy.test.ts`; `apps/cli/test/local/check.test.ts` (the local check gives the gateway's stage-1 refusals for the same commit); `packages/protocol/test/exit-code.test.ts` (each tag's CLI exit code is pinned, 75 exactly when it is retryable) |18-| 4 | **One schema, many surfaces.** Change `packages/protocol`; every surface derives from it. Projections live only in `apps/*/src/surfaces.ts`. The CLI's command list is `commandDocs` in `@repo/agent-kit`, which the platform's skill, the CLI's MCP prompt and the web's `llms.txt` all read. | `apps/cli/test/commands-doc.test.ts` (the command list against the real CLI's commands, flags and positionals, `policy`, `ask draft` and `proposal` included); `packages/protocol/test/mcp.test.ts` (every MCP tool's schemas, with no JSON Schema leak, the policy and drafting contracts included; the five capped code reads are tools, `showCommit` and `listPaths` are not); `apps/web/test/agents.test.tsx` (every snippet, command, endpoint, limit and refusal on the For agents page is `@repo/agent-kit`'s or the union's); `packages/agent-kit/test/docs.test.ts` and `apps/web/test/docs.test.tsx` (the `/docs` pages name only the CLI's commands with flags each takes and link only to pages that exist, the reference lists every command, refusal, event, MCP tool and imported project from its source, and the web draws each page and its Markdown from that one text); `apps/web/test/llms.test.ts` (`/` and `/<project>` asked for Markdown answer with the `llms.txt` texts, and their HTML names that Markdown as an alternate); `packages/agent-kit/test/full-llms.test.ts` (one `ProjectEvent` line per tag); `apps/platform/test/home.test.ts` (the platform's `/` in Markdown is the web's `llms.txt`, one text from `@repo/agent-kit`); per-package `allowedUnstableApis` with `unstableApiUsage` at error |16+| 2 | **Parse at the boundary, trust inside.** Decode every external input (HTTP, git, DO RPC, WebSocket, rule facts, env) with Effect Schema; inside, use branded types (`AskId`, `LandedSha`, `PatchId`). Decode the Worker `env` once, in one Layer. | The Effect diagnostics at error in `tsconfig.base.json`; `anti-slop/no-unknown-parameters`, `anti-slop/no-widen-then-assert` and `anti-slop/require-safety-comment-for-type-assertion`; `apps/platform/test/platform.test.ts` (a bad env fails at start, decoded once in `apps/platform/src/platform.ts`); `apps/platform/test/bindings.test.ts` (the decoded bindings, vars and secrets equal each wrangler.jsonc block's, the `AI` binding, `DRAFT_LIMIT`, `DRAFT_MODEL`, `PUBLIC_WEB_URL` and the code store's `CODE_CACHE` among them, and each port's factory takes its binding as the generated Env types it, without a cast); `packages/project/test/code-history.test.ts` (a kept code-history value is decoded with Schema when read, and one that no longer decodes is computed again); `packages/project/test/code.test.ts` (a kept commit that no longer decodes is computed again); `apps/web/test/dev-fixtures.test.ts` (the dev world's fixture record is decoded through the protocol's schemas when the world is built, so every case reads only a record that decodes); `apps/web/test/server-params.test.ts` (a project route's server handler is handed the project's full name once, as Start's params parse it, never parsed again) |17+| 3 | **Refusals are a closed `Schema.TaggedError` union and a public contract.** Handle them with `Match.exhaustive` or `catchTags`. Each carries a `retryable` and a `next` command fixed per tag, an optional `at`, and no `message` field. A `_tag` is renamed only with an alias. `protocol/render` is the one renderer for git `remote:`, CLI and MCP text. Stage-1 refusals accumulate. | `packages/protocol/test/refusal.test.ts` and `packages/protocol/test/render.test.ts` (every tag, the code reads' and drafting's `UnknownPath`, `UnknownRevision`, `UnknownProposal`, `ProposalClosed` and `DraftInProgress` included; a limit's refusal names its kind and its wait, and a ref outside `refs/heads/` reads as one the platform writes); `packages/agent-kit/test/full-llms.test.ts` (every tag in the union has a row in `/llms-full.txt`); `packages/protocol/test/mcp.test.ts` (a refusal from tools/call keeps its tag); `anti-slop-effect/prefer-effect-match` and `anti-slop-effect/no-manual-tag-comparison`; `packages/gate/test/shape.test.ts` (one push hears every stage-1 refusal at once); `apps/platform/test/mcp.test.ts` (each refusing MCP contract comes back as its exact refusal, `draftAsk`, `showProposal` and a code read's `UnknownPath` included); `apps/platform/test/workflows/draft.test.ts` (past the draft limit, `CapReached`); `apps/cli/test/policy.test.ts`; `apps/cli/test/local/check.test.ts` (the local check gives the gateway's stage-1 refusals for the same commit); `packages/protocol/test/exit-code.test.ts` (each tag's CLI exit code is pinned, 75 exactly when it is retryable); `packages/config/test/legacy-projects.test.ts` (the same alias rule for a project's address: the forty projects made before owners keep their keys as aliases of their full names, the two examples and the import plan's, each key and each name once) |18+| 4 | **One schema, many surfaces.** Change `packages/protocol`; every surface derives from it. Projections live only in `apps/*/src/surfaces.ts`. The CLI's command list is `commandDocs` in `@repo/agent-kit`, which the platform's skill, the CLI's MCP prompt and the web's `llms.txt` all read. | `apps/cli/test/commands-doc.test.ts` (the command list against the real CLI's commands, flags and positionals, `policy`, `ask draft` and `proposal` included); `packages/protocol/test/mcp.test.ts` (every MCP tool's schemas, with no JSON Schema leak, the policy and drafting contracts included; the five capped code reads are tools, `showCommit` and `listPaths` are not); `apps/web/test/agents.test.tsx` (every snippet, command, endpoint, limit and refusal on the For agents page is `@repo/agent-kit`'s or the union's); `packages/agent-kit/test/docs.test.ts` and `apps/web/test/docs.test.tsx` (the `/docs` pages name only the CLI's commands with flags each takes and link only to pages that exist, the reference lists every command, refusal, event, MCP tool and imported project from its source, and the web draws each page and its Markdown from that one text); `apps/web/test/llms.test.ts` (`/` and `/<project>` asked for Markdown answer with the `llms.txt` texts, and their HTML names that Markdown as an alternate); `packages/agent-kit/test/full-llms.test.ts` (one `ProjectEvent` line per tag); `apps/platform/test/home.test.ts` (the platform's `/` in Markdown is the web's `llms.txt`, one text from `@repo/agent-kit`); `packages/protocol/test/project-name.test.ts` (`ProjectName` is the one parser of a project's name for every surface: lowercase, a legacy key read as its full name, encoded only in the full form, and a key that reads back to its name); per-package `allowedUnstableApis` with `unstableApiUsage` at error |19 | 5 | **The name lives only in `packages/brand`.** Internal packages use `@repo/*`. DO classes, Workflows, queues and databases carry job names. | `brand:check` (`scripts/brand.ts`, tested by `packages/brand/test/leaks.test.ts`) |20 | 6 | **Pure core, thin hosts.** Only `@repo/artifacts` calls Artifacts. Each beta dependency sits behind one job-named port with a `/memory` adapter in the owning package. Apps import packages only. Worker code stays free of `node:child_process`, `@effect/platform-bun` and OpenTUI. `rules` and `gate` run in both Workers and Bun. `alchemy/*` stays in `infra/`. No module-level mutable state in a package's `src/`. | Scoped `allowedUnstableApis`; `packages/artifacts/test/repo-host-contract.ts` (one RepoHost contract every adapter passes); `apps/platform/test/bindings.test.ts` and `apps/platform/test/worker-init.test.ts` (the Worker starts on its real adapters, composed in `apps/platform/src/ports.ts`); `apps/platform/test/router-build.test.ts` (both handlers are built when the Worker module loads, with no binding touched, and a layer that awaits a promise while it is built is refused there); `apps/web/test/production-bundle.test.ts` (no dev-world module in the web's production build, and no chunk every page preloads holds the Markdown renderer, under a gzip ceiling); `packages/config/test/cartridge.test.ts` (the visibility cartridge is plugged in by one marked line and reached by nothing else, so removing it is a deletion); `packages/drafting/test/memory.test.ts` (the `Drafter` port's `/memory` adapter, `packages/drafting/src/drafter/memory.ts`) and `packages/drafting/test/binding.test.ts` (its Workers AI adapter over the `AI` binding); `packages/project/test/code-store.test.ts` (the `CodeStore` port's `/memory` adapter, `packages/project/src/code-store/memory.ts`, and its R2 adapter over `CODE_CACHE`, whose failures are misses, never the read's); `apps/platform/test/code-reads.test.ts` and `apps/web/test/dev-backend.test.ts` (the platform and the web's dev world answer the code reads and raw files alike, both through `@repo/project/code`); `packages/project/test/standing-posture.test.ts` (one helper, `withStandingPosture`, gives a listing each project's own posture, for the platform and the web's dev world alike, through the `StandingPostures` port whose default keeps nothing; its D1 adapter is the platform's); `apps/web/test/seeded.test.tsx` (a loader's read seeds a registry of its own page and leaves the registry every request shares as it was); `apps/web/test/shell.test.tsx` (no plain anchor between the web's pages: every link is the router's). No fence: import direction and module-level state |21-| 7 | **Deny by default for visibility.** Land the answer's tree, never the composed tree. Nothing from a layer enters a public tree. Snapshot before held-back files are written. Public-serving Workers have no private-namespace binding. Public commits, trailers, notes and errors name public paths only. | `PrivatePathInPublicTree`, one rule for the gate's stage 1 and the landing guard (`packages/gate/test/shape.test.ts`, `packages/visibility/test/guards.test.ts`); `apps/platform/test/visibility/layer-gateway.test.ts` (only a layer's readers clone it, every read is logged, a fork push cannot carry its paths); `apps/sandbox/test/held-back.test.ts` (egress off and the snapshot taken before any sealed file is written; one bit per area, no output); `apps/platform/test/visibility/held-back.test.ts` (the `Held-back:` trailer, the landing guards, no stored value in a note or a kept log); `apps/platform/test/bindings.test.ts`; `apps/sandbox/test/checker.test.ts` (no snapshot once the held-back slot is reached); `apps/web/test/env.test-d.ts` (the web's Env has no private-namespace, Artifacts or `CODE_CACHE` binding) and `apps/platform/test/env.test-d.ts` (only the platform's has both); `packages/project/test/code-raw.test.ts` and `apps/platform/test/raw.test.ts` (raw bytes under `nosniff` and the sandboxing CSP, refusals included); `apps/platform/test/code-reads.test.ts` (no code read's payload names a repo); `packages/project/test/code-history.test.ts` (the code store is keyed under the project's canonical repo alone and holds no landing); `apps/platform/test/w9-contracts.test.ts` (`projectPolicy` answers without the policy's layers or asks, and `packages/config/test/cartridge.test.ts` keeps the cartridge removable); `packages/drafting/test/prompt.test.ts` (a draft's prompt never carries a layer's name, repo, reason or paths); `apps/web/test/markdown.test.tsx` (a README's script, handlers, unsafe URLs, iframes, styles and forms never reach the page); `apps/platform/test/gateway.test.ts` and `packages/gate/test/parse.test.ts` (a fork takes branches only: its notes, tags and the platform's refs are refused); `apps/platform/test/visibility/posture-listing.test.ts` and `apps/platform/test/home.test.ts` (the project list and the platform's `/` show the posture the project's ledger shows); `apps/web/test/landing.test.tsx` (the landing at `/` draws only the public project list, each project with the posture its listing gives); `apps/web/test/ledger.test.tsx` (the ledger page adds no path, check name or file name) and `apps/web/test/env.test.tsx` (the env page shows no value and no control to set or read one); `apps/platform/test/pages.test.ts` (the sign-in page, as an MCP client's consent, escapes every value a client supplies) |21+| 7 | **Deny by default for visibility.** Land the answer's tree, never the composed tree. Nothing from a layer enters a public tree. Snapshot before held-back files are written. Public-serving Workers have no private-namespace binding. Public commits, trailers, notes and errors name public paths only. | `PrivatePathInPublicTree`, one rule for the gate's stage 1 and the landing guard (`packages/gate/test/shape.test.ts`, `packages/visibility/test/guards.test.ts`); `apps/platform/test/visibility/layer-gateway.test.ts` (only a layer's readers clone it, every read is logged, a fork push cannot carry its paths); `apps/sandbox/test/held-back.test.ts` (egress off and the snapshot taken before any sealed file is written; one bit per area, no output); `apps/platform/test/visibility/held-back.test.ts` (the `Held-back:` trailer, the landing guards, no stored value in a note or a kept log); `apps/platform/test/bindings.test.ts`; `apps/sandbox/test/checker.test.ts` (no snapshot once the held-back slot is reached); `apps/web/test/env.test-d.ts` (the web's Env has no private-namespace, Artifacts or `CODE_CACHE` binding) and `apps/platform/test/env.test-d.ts` (only the platform's has both); `packages/project/test/code-raw.test.ts` and `apps/platform/test/raw.test.ts` (raw bytes under `nosniff` and the sandboxing CSP, refusals included); `apps/platform/test/code-reads.test.ts` (no code read's payload names a repo); `packages/project/test/code-history.test.ts` (the code store is keyed under the project's canonical repo alone and holds no landing); `apps/platform/test/w9-contracts.test.ts` (`projectPolicy` answers without the policy's layers or asks, and `packages/config/test/cartridge.test.ts` keeps the cartridge removable); `packages/drafting/test/prompt.test.ts` (a draft's prompt never carries a layer's name, repo, reason or paths); `apps/web/test/markdown.test.tsx` (a README's script, handlers, unsafe URLs, iframes, styles and forms never reach the page); `apps/platform/test/gateway.test.ts` and `packages/gate/test/parse.test.ts` (a fork takes branches only: its notes, tags and the platform's refs are refused); `apps/platform/test/visibility/posture-listing.test.ts` and `apps/platform/test/home.test.ts` (the project list and the platform's `/` show the posture the project's ledger shows); `apps/web/test/landing.test.tsx` (the landing at `/` draws only the public project list, each project with the posture its listing gives); `apps/web/test/ledger.test.tsx` (the ledger page adds no path, check name or file name) and `apps/web/test/env.test.tsx` (the env page shows no value and no control to set or read one); `apps/platform/test/pages.test.ts` (the sign-in page, as an MCP client's consent, escapes every value a client supplies); `apps/platform/test/gateway-owner.test.ts` (the gateway reads a full name, a source path, a legacy key or a fork's address to the repo its project's key names, and an owner alone or a name under a page's word to none) |22 | 8 | **Deterministic and idempotent.** Rule evaluation sees frozen time and randomness and only injected facts. Re-running an operation converges. Check results are keyed by (tree SHA, check version), push events deduped by (repo, sha), and land requests carry a `requestId`. | `globalDate`, `globalRandom`, `globalTimers` and `cryptoRandomUUID` at error, with their in-Effect twins; `packages/rules/test/replay.test.ts`; `packages/project/test/project-store.contract.ts`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts`; `apps/platform/test/workflows/answer.test.ts`; `apps/platform/test/workflows/on-push.test.ts`; `apps/platform/test/core-loop.test.ts`; `apps/platform/test/workflows/draft.test.ts` (a replayed draft round asks the model nothing more, and each round is its own instance); `packages/project/test/code.test.ts` (code reads cached by object id, only once finished, while `main` resolves every time, and a commit's diff kept by its SHA without its landing); `packages/project/test/drafting.model.test.ts` (a settle of a stale round changes nothing); `packages/project/test/import.test.ts` (a retried import adopts the repo it made, and a retried import keeps its source); `packages/project/test/code-history.test.ts` (a why and a path's history are kept by commit, path hash and algorithm version, and the store, a step from a kept ancestor and a whole walk agree); `packages/config/test/smoke-loop.test.ts` (smoke's throwaway project is in the ledger before init makes it, and a taken name stops before anything is made); `apps/web/test/events.test.ts` (the web's fold of a project's events gives the same map when an event is heard twice or out of order, and a replay that already holds a landing stamps nothing); `packages/project/test/standing-posture.test.ts` (a kept posture is read again only for the project whose event the projection applied, or once its instant has come). No fence: one push deduped by (repo, sha) across the gateway's record and OnPush's |23 | 9 | **Effect v4 only.** Read `node_modules/effect/src` as API truth. Off limits: `effect/unstable/*`, v3 `@effect/platform` and `@effect/cli`, and `effect/workflow` or `effect/cluster` on Workers. | `outdatedApi`; `no-restricted-imports` |24 | 10 | **Escapes need a reason.** Every `oxlint-disable`, `@effect-diagnostics` or `@ts-expect-error` carries its reason after `--`, and is added only where no idiomatic code does the job. | `check` fails on an unused directive. No fence: the reason |25 | 11 | **`bun run verify` is the authority.** Deploy only to an explicit stage, after `verify`, with smoke after. A red gate is fixed, never deployed around. | `packages/config/test/verify.test.ts` (verify's steps); `infra/deploy.ts` refuses without a known stage, runs `verify` first and `scripts/smoke.ts` after (`packages/config/test/deploy.test.ts`, `packages/config/test/smoke.test.ts`), and refuses every deploy while `infra/.recording` is there (`packages/config/test/recording.test.ts`) |124 unmodified lines