Close the wave: openings are heard as landings, and the code store is written down
Before adoption: this commit came in with the history the project adopted, so no landing records it.
- An ask's opening now emits a Landed event naming the ask it opened, as a decider's own landing already did: the project page's landings list (fed by watch) shows "Open ask <id>" for new openings, the code and policy views refresh live when an ask opens, and D1's project list moves landed_at. It answers no ask, so the projection credits nothing. Openings recorded before this have no event and stay out of that list. Tests: do-reads.test.ts (red first: no Landed event was heard), and the event-order pins in project.test.ts, handlers.test.ts, watch.test.ts and dev-backend.test.ts updated for the extra event (burrow now lists the time of its last opening). - The log and commit pages link an opening's ask through askOf ("Opened", no answer link); Today needs none, since its sample holds answers only. code.test.tsx, red first. - A why row no longer repeats "Open ask <id>" when the commit's subject already says it; it links the ask alone. why.test.tsx, red first. - packageOf lives once, in @repo/protocol/domain/code, for the platform's tag order and the refs page; the web's copy and the test holding the two equal are gone. - The CLI's Markdown policy view writes decider globs as code spans, so `**` never reads as emphasis. policy-view.test.ts, red first. - The proposal pages' session prompt uses the shared signInHref and Notice; the propose view's sign-in link too. - deployed.e2e.ts defaults its ask, file and README phrase per seeded example, so WEB_PROJECT=burrow alone checks burrow. - New check: code-history.test.ts holds that the code store is keyed under the project's canonical repo alone and keeps no landing (seen failing on a planted prefix). - AGENTS.md Held by: CODE_CACHE and the decoded kept value (2), the router build and the code store's port and adapters (6), the web's Env without CODE_CACHE and the canonical-only keys (7), code history and the smoke ledger (8), the drafting model's kept ready files (12). - ADR 0020 (code history kept by immutable ids in an R2 bucket; the Cache API, KV, the DO's storage, the evidence bucket, trees in the store and a per-commit path index considered); ADR 0019 gains the opening's `opened`; GLOSSARY's Landing and Why name openings; README: the features, the CODE_CACHE binding, the measured times and a Keep or cut row for the store. - Budgets: none raised. Measured on this commit: platform entry (its only module) 1,679,675, both limits now 1,900,000 (JavaScript from 1,918,000; 13% above); sandbox 570,582 of 656,000 (15%); web entry 711,006 of 818,000 (15%), JavaScript 3,567,682 of 4,075,000 (14%).
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
30 files+449 added−153 removed
- tests:+238 added−48 removed
- other:+211 added−105 removed
Provenance
- Commit
2587726- Tree
2fb09fb- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
71adc10
30 files changed+449 added−153 removed
modified:apps/cli/src/render.ts+28 added-4 removed
40 unmodified lines41 /** A cell's text, safe inside a Markdown table row. */42 const cell = (text: string) =>43 text.replaceAll("|", "\\|").replaceAll(/\s*\n\s*/gu, " ");44 45+/** `text` as a Markdown code span, fenced by one more backtick than its longest run. */46+const codeSpan = (text: string) => {47+ const longest = Math.max(48+ 0,49+ ...(text.match(/`+/gu) ?? []).map((run) => run.length)50+ );51+52+ const fence = "`".repeat(longest + 1);53+ const pad = text.startsWith("`") || text.endsWith("`") ? " " : "";54+55+ return `${fence}${pad}${text}${pad}${fence}`;56+};57+58 /**59 * Rows as a Markdown table, and as a padded plain table for a person.47- * `empty` stands in for both when there are no rows.60+ * `empty` stands in for both when there are no rows. The columns in `code`61+ * hold literal text (a glob, a path) that Markdown shows as code, so `**`62+ * never reads as emphasis; the plain table shows it as it is.63 */64 const table = (65 headers: readonly string[],66 rows: readonly (readonly string[])[],52- empty: string67+ empty: string,68+ code: readonly number[] = []69 ): View => {70 if (rows.length === 0) {71 return { markdown: empty, text: empty };72 }11 unmodified lines84 return {85 markdown: [86 `| ${headers.join(" | ")} |`,87 `| ${headers.map(() => "---").join(" | ")} |`,72- ...rows.map((row) => `| ${row.map(cell).join(" | ")} |`),88+ ...rows.map(89+ (row) =>90+ `| ${row91+ .map((text, column) =>92+ code.includes(column) ? cell(codeSpan(text)) : cell(text)93+ )94+ .join(" | ")} |`95+ ),96 ].join("\n"),97 text: [98 padded(headers.map((header) => header.toUpperCase())),99 ...rows.map(padded),275 unmodified lines375 prose("Deciders by path:"),376 table(377 ["paths", "deciders"],378 policy.deciders.map(({ handles, paths }) => [paths, handles.join(", ")]),356- "Nobody decides."379+ "Nobody decides.",380+ [0]381 ),382 prose(383 `Vouching: ${vouchModes[vouch.mode]} ${vouch.file} vouches for ${countOf(vouches.length - denounced)} and denounces ${countOf(denounced)}.`384 ),176 unmodified linesmodified:apps/cli/test/policy-view.test.ts+10 added
82 unmodified lines8384858687888990919293949596979899100100 unmodified lines82 unmodified lines lines.indexOf("src/tz.ts okonkwo, bram") ); });
it("writes each decider glob as code in Markdown, so `**` reads as a glob, not emphasis", () => { const markdown = Option.match(views.projectPolicy(datekit), { onNone: () => "", onSome: (view) => view.markdown, });
expect(markdown).toContain("| `**` | ines-v |"); expect(markdown).toContain("| `src/tz.ts` | okonkwo, bram |"); });
it("says which commit it is as of, and where it comes from", () => { const text = textOf(datekit);
expect(text).toContain(`As of ${sha.slice(0, 7)}, the landed commit`);100 unmodified linesmodified:apps/platform/test/handlers.test.ts+7 added-3 removed
178 unmodified lines179 const later = yield* Stream.runCollect(180 bob.watch({ project: datekit.project, since: 1 })181 );182 183+ // Each ask's opening lands, so each is heard opened, then landed.184 expect(all.map(({ _tag }) => _tag)).toStrictEqual([185 "AskOpened",186+ "Landed",187 "AskOpened",188+ "Landed",189 ]);190 expect(later).toStrictEqual(all.slice(1));191 expect(192 yield* Effect.flip(Stream.runCollect(bob.watch({ project: nowhere })))7 unmodified lines200 201 const api = yield* (yield* Projects).get(datekit.project);202 const bobs = Person.make({ handle: Handle.make("bob") });203 201- // 60 claims, each released: 120 events after datekit's two asks opened.204+ // 60 claims, each released: 120 events after datekit's two asks205+ // opened, each heard opened and landed.206 yield* Effect.forEach(207 Array.range(1, 60),208 () =>209 Effect.andThen(9 unmodified lines219 bob.watch({ project: datekit.project })220 );221 222 const tail = yield* Stream.runCollect(219- bob.watch({ project: datekit.project, since: 120 })223+ bob.watch({ project: datekit.project, since: 122 })224 );225 226 expect({227 count: all.length,228 first: all[0]?._tag,229 last: all.at(-1)?._tag,226- }).toStrictEqual({ count: 122, first: "AskOpened", last: "Released" });230+ }).toStrictEqual({ count: 124, first: "AskOpened", last: "Released" });231 expect(tail.map(({ _tag }) => _tag)).toStrictEqual([232 "Claimed",233 "Released",234 ]);696 unmodified linesmodified:apps/platform/test/watch.test.ts+36 added-25 removed
184 unmodified lines185 /** Whether `events` run on from `since` with no number skipped or repeated. */186 const unbroken = (events: readonly ProjectEvent[], since: number) =>187 events.every(({ seq }, index) => seq === since + index + 1);188 189+/** Whether `event` is an answer's landing, not an ask's opening. */190+const answered = (event: ProjectEvent) =>191+ ProjectEvent.guards.Landed(event) && event.landing.ask !== undefined;192+193 /** The project made, first pushed, and `parse-iso` opened red first by dora. */194 const datekitOpened = (world: CoreLoopWorld) =>195 Effect.gen(function* () {196 const dora = world.rpc("dora");71 unmodified lines268 );269 270 yield* world.settle();271 272+ // Her answer's landing: the opening's was heard in the replay.273 const landedAt = (yield* heardUntil(first, (events) =>269- events.some(ProjectEvent.guards.Landed)270- )).findLast(ProjectEvent.guards.Landed);274+ events.some(answered)275+ ))276+ .filter(ProjectEvent.guards.Landed)277+ .findLast(({ landing }) => landing.ask !== undefined);278 279 const shown =280 landedAt === undefined281 ? undefined39 unmodified lines321 },322 }).toStrictEqual({323 claimed: { ask: parseIso, claimant: "alice" },324 landed: { ask: parseIso, author: "alice", shown },318- replayed: ["1 AskOpened"],319- resumed: ["3 Pushed", "4 Judged", "5 Landed", "6 AskClosed"],325+ replayed: ["1 AskOpened", "2 Landed"],326+ resumed: ["4 Pushed", "5 Judged", "6 Landed", "7 AskClosed"],327 unbroken: { first: true, second: true },328 });329 // Over JSON, the same events replay and end.330 expect({ after: brief(after), kept: brief(kept) }).toStrictEqual({114 unmodified lines445 const noon = "2026-10-07T12:00:00Z";446 447 describe("a Project DO's watch room, over a fake state and a real shell", () => {448 it.effect(442- "replays only the newest 500 events to a socket opened from 0 when 601 are recorded, in order, and tags it by the number it opened from",449+ "replays only the newest 500 events to a socket opened from 0 when 602 are recorded, in order, and tags it by the number it opened from",450 () =>451 Effect.gen(function* () {452 yield* advanceTo(noon);453 454 const { accepted, state } = fakeState();455 const room = watchRoom(state, yield* shellOver(":memory:"));456 const call = through(room);457 451- // parse-iso opens (1 event), then 300 claims, each released (600).458+ // parse-iso opens and its opening lands (2 events), then 300459+ // claims, each released (600).460 yield* opening(call);461 yield* Effect.forEach(462 Array.range(1, 300),463 () =>13 unmodified lines477 expect({478 count: frames.length,479 first: framed(frames.slice(0, 2)),480 last: framed(frames.slice(-1)),473- unbroken: frames.every(({ seq }, index) => seq === 102 + index),481+ unbroken: frames.every(({ seq }, index) => seq === 103 + index),482 }).toStrictEqual({483 count: 500,476- first: ["102 Claimed", "103 Released"],477- last: ["601 Released"],484+ first: ["103 Claimed", "104 Released"],485+ last: ["602 Released"],486 unbroken: true,487 });488 expect(accepted.map(({ tags }) => tags)).toStrictEqual([489 [WATCH_TAG, "since:0"],18 unmodified lines508 const fromNow = doSocket();509 const gone = doSocket();510 511 yield* room.admit(fromStart.socket, 0);504- yield* room.admit(fromNow.socket, 1);505- yield* room.admit(gone.socket, 1);512+ yield* room.admit(fromNow.socket, 2);513+ yield* room.admit(gone.socket, 2);514 close(gone.socket);515 516 yield* call("claim", [bob, doParseIso]);517 yield* call("listAsks", [anyone]);3 unmodified lines521 fromNow: framed(yield* fromNow.frames),522 fromStart: framed(yield* fromStart.frames),523 gone: framed(yield* gone.frames),524 }).toStrictEqual({517- fromNow: ["2 Claimed", "3 Released"],518- fromStart: ["1 AskOpened", "2 Claimed", "3 Released"],525+ fromNow: ["3 Claimed", "4 Released"],526+ fromStart: ["1 AskOpened", "2 Landed", "3 Claimed", "4 Released"],527 gone: [],528 });529 }).pipe(Effect.provide(doWorld))530 );12 unmodified lines543 yield* call("claim", [bob, doParseIso]);544 545 const watched = doSocket();546 539- yield* room.admit(watched.socket, 2);547+ yield* room.admit(watched.socket, 3);548 yield* advanceTo("2026-10-08T12:00:00Z");549 yield* room.alarm();550 551 expect(44 unmodified lines596 yield* opening(call);597 598 const watched = doSocket();599 592- yield* room.admit(watched.socket, 1);600+ yield* room.admit(watched.socket, 2);601 // Hibernation woke it without its attachment.602 watched.socket.serializeAttachment(null);603 604 yield* call("claim", [bob, doParseIso]);605 598- expect(framed(yield* watched.frames)).toStrictEqual(["2 Claimed"]);606+ expect(framed(yield* watched.frames)).toStrictEqual(["3 Claimed"]);607 }).pipe(Effect.provide(doWorld))608 );609 });610 125 unmodified lines736 yield* opening(call);737 738 const heard = yield* hearing(relayedFrom(namespace));739 732- yield* heardUntil(heard, (events) => events.length >= 1);740+ yield* heardUntil(heard, (events) => events.length >= 2);741 yield* call("claim", [bob, doParseIso]);742 yield* call("release", [bob, doParseIso]);743 744 expect({745 heard: brief(738- yield* heardUntil(heard, (events) => events.length >= 3)746+ yield* heardUntil(heard, (events) => events.length >= 4)747 ),748 opened: yield* opened,749 }).toStrictEqual({742- heard: ["1 AskOpened", "2 Claimed", "3 Released"],750+ heard: ["1 AskOpened", "2 Landed", "3 Claimed", "4 Released"],751 opened: [0],752 });753 }).pipe(Effect.provide(doWorld)),754 15_0009 unmodified lines764 yield* call("claim", [bob, doParseIso]);765 766 const heard = yield* hearing(relayedFrom(namespace));767 760- yield* heardUntil(heard, (events) => events.length >= 2);768+ yield* heardUntil(heard, (events) => events.length >= 3);769 770 // The DO restarts: its end of the socket closes.771 (yield* server)?.close(1012, "restarting");772 8 unmodified lines781 yield* call("release", [bob, doParseIso]);782 783 expect({784 heard: brief(777- yield* heardUntil(heard, (events) => events.length >= 3)785+ yield* heardUntil(heard, (events) => events.length >= 4)786 ),787 opened: yield* opened,788 }).toStrictEqual({781- heard: ["1 AskOpened", "2 Claimed", "3 Released"],782- opened: [0, 2],789+ heard: ["1 AskOpened", "2 Landed", "3 Claimed", "4 Released"],790+ opened: [0, 3],791 });792 }).pipe(Effect.provide(doWorld)),793 15_000794 );11 unmodified lines806 yield* call("claim", [bob, doParseIso]);807 808 expect({809 heard: brief(802- yield* heardUntil(heard, (events) => events.length >= 2)810+ yield* heardUntil(heard, (events) => events.length >= 3)811 ),812 opened: yield* opened,805- }).toStrictEqual({ heard: ["1 AskOpened", "2 Claimed"], opened: [] });813+ }).toStrictEqual({814+ heard: ["1 AskOpened", "2 Landed", "3 Claimed"],815+ opened: [],816+ });817 }).pipe(Effect.provide(doWorld)),818 15_000819 );820 });20 unmodified linesmodified:apps/web/e2e/deployed.e2e.ts+36 added-13 removed
4 unmodified lines5 * log, a commit and the refs), each asserted on its key text, each saved6 * as one screenshot in `e2e/out/` for the shot list.7 *8 * It runs only against `WEB_URL` (a stage's web origin) and is skipped9- * without it. `WEB_PROJECT` and `WEB_ASK` pick the project and the ask10- * (datekit's format-ordinal, which the seed opens on every stage, unless11- * given), and `WEB_FILE` the file opened at line 3 (datekit's `src/add.ts`12- * unless given; its first folder is the one the code page must list, so13- * burrow's run names `packages/kit/src/http.ts`). `WEB_README_PHRASE` is14- * a phrase of the project's README, which its page must carry as the15- * server sends it (datekit's opening words unless given). It only reads.9+ * without it. `WEB_PROJECT` picks the project (datekit unless given) and10+ * `WEB_ASK` the ask, `WEB_FILE` the file opened at line 3 (its first folder11+ * is the one the code page must list) and `WEB_README_PHRASE` a phrase of12+ * the project's README, which its page must carry as the server sends it.13+ * Each defaults to the seeded example's own (`examples`: datekit's14+ * format-ordinal, `src/add.ts` and opening words; burrow's15+ * drop-legacy-fetch, `packages/kit/src/http.ts` and "six small TypeScript16+ * 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 { Config, Effect, Option } from "effect";21 22+/**23+ * What the check looks at in each seeded example unless told otherwise: an24+ * ask the seed opens, a file whose first folder the code page lists, and a25+ * phrase of its README.26+ */27+const examples = {28+ burrow: {29+ ask: "drop-legacy-fetch",30+ file: "packages/kit/src/http.ts",31+ readme: "six small TypeScript packages",32+ },33+ datekit: {34+ ask: "format-ordinal",35+ file: "src/add.ts",36+ readme: "Small, dependency-free date helpers",37+ },38+} as const;39+40 /** What the check reads of its env: where the web lives, and which ask to look at. */41 const settings = Effect.runSync(42 Effect.gen(function* () {43+ const project = yield* Config.NonEmptyString("WEB_PROJECT").pipe(44+ Config.withDefault("datekit")45+ );46+47+ const example = project === "burrow" ? examples.burrow : examples.datekit;48+49 return {50 ask: yield* Config.NonEmptyString("WEB_ASK").pipe(26- Config.withDefault("format-ordinal")51+ Config.withDefault(example.ask)52 ),53 file: yield* Config.NonEmptyString("WEB_FILE").pipe(29- Config.withDefault("src/add.ts")54+ Config.withDefault(example.file)55 ),31- project: yield* Config.NonEmptyString("WEB_PROJECT").pipe(32- Config.withDefault("datekit")33- ),56+ project,57 readme: yield* Config.NonEmptyString("WEB_README_PHRASE").pipe(35- Config.withDefault("Small, dependency-free date helpers")58+ Config.withDefault(example.readme)59 ),60 web: Option.map(61 yield* Config.option(Config.NonEmptyString("WEB_URL")),62 (url) => url.replace(/\/+$/u, "")219 unmodified linesmodified:apps/web/src/features/auth/session-slot.tsx+1 added-1 removed
25 unmodified lines26 readonly searchStr: string;27 }) => `${location.pathname}${location.searchStr}`;28 29 /** Sign-in, coming back to `here` afterwards. */30-const signInHref = (here: string) =>30+export const signInHref = (here: string) =>31 `/auth/signin?${new URLSearchParams({ return: here }).toString()}`;32 33 /** The nav's own action style: muted text, ink on hover. */34 const ACTION =52 unmodified linesmodified:apps/web/src/features/code/commit-view.tsx+25 added-13 removed
14 unmodified lines15 } from "@repo/protocol/domain/code";16 import { CreditRole } from "@repo/protocol/domain/credit";17 import { Handle } from "@repo/protocol/ids";18 import type { ProjectName } from "@repo/protocol/ids";19-import { Match, Schema } from "effect";19+import { Match, Option, Schema } from "effect";20 import type { DateTime } from "effect";21 import type { ReactNode } from "react";22 23 import { answerPath } from "../ask/ask-page.tsx";2 unmodified lines26 import { HandleLink } from "../shared/handle.tsx";27 import { PageShell } from "../shared/layout.tsx";28 import { OutcomeView } from "../shared/outcome.tsx";29 import { When } from "../shared/time.tsx";30+import { askOf } from "../why/rows.ts";31 import { blobHref, commitHref, shortSha, treeHref } from "./paths.ts";32 33 const LINK = "decoration-rule underline hover:decoration-current";34 141 unmodified lines176 readonly split?: boolean;177 }) => {178 const { commit, files, truncated } = diff;179 const { landing } = commit;180+181+ const linked =182+ landing === undefined ? undefined : Option.getOrUndefined(askOf(landing));183+184 const body = bodyWithoutTrailers(commit);185 const here = commitHref(project, commit.sha);186 187 return (66 unmodified lines254 className="border-rule flex flex-col gap-3 border-t pt-4"255 >256 <h2 className="text-lg font-semibold">Landing</h2>257 <dl className="flex flex-wrap gap-x-8 gap-y-2 text-sm">253- {landing.ask === undefined ? null : (258+ {linked === undefined ? null : (259 <>260 <div>256- <dt className={LABEL}>Ask</dt>261+ <dt className={LABEL}>262+ {linked.kind === "opened" ? "Opened" : "Ask"}263+ </dt>264 <dd>265 <a266 className={`${ID} ${LINK}`}260- href={askPath(project, landing.ask)}267+ href={askPath(project, linked.ask)}268 >262- {landing.ask}269+ {linked.ask}270 </a>271 </dd>272 </div>266- <div>267- <dt className={LABEL}>Answer</dt>268- <dd>269- <a className={LINK} href={answerPath(project, landing.ask)}>270- The answer and its checks271- </a>272- </dd>273- </div>273+ {linked.kind === "opened" ? null : (274+ <div>275+ <dt className={LABEL}>Answer</dt>276+ <dd>277+ <a278+ className={LINK}279+ href={answerPath(project, linked.ask)}280+ >281+ The answer and its checks282+ </a>283+ </dd>284+ </div>285+ )}286 </>287 )}288 <div>289 <dt className={LABEL}>Author</dt>52 unmodified linesmodified:apps/web/src/features/code/log-view.tsx+9 added-5 removed
6 unmodified lines7 */8 import type { CommitView } from "@repo/protocol/domain/code";9 import { Outcome } from "@repo/protocol/domain/outcome";10 import type { ProjectName, RepoPath } from "@repo/protocol/ids";11-import { DateTime } from "effect";11+import { DateTime, Option } from "effect";12 13 import { askPath } from "../project/asks.tsx";14 import { ProjectNav } from "../project/project-nav.tsx";15 import { CreditTrailers } from "../shared/credits.tsx";16 import { EmptyState } from "../shared/empty.tsx";17 import { HandleLink } from "../shared/handle.tsx";18 import { PageShell } from "../shared/layout.tsx";19 import { When } from "../shared/time.tsx";20+import { askOf } from "../why/rows.ts";21 import { Pager } from "./pager.tsx";22 import { blobHref, commitHref, commitsHref, shortSha } from "./paths.ts";23 import { revLabel } from "./tree-view.tsx";24 40 unmodified lines65 readonly project: ProjectName;66 }) => {67 const { landing } = commit;68 69+ const linked =70+ landing === undefined ? undefined : Option.getOrUndefined(askOf(landing));71+72 return (73 <li74 className="border-rule flex flex-col gap-2 border-t py-3"75 data-commit={commit.sha}19 unmodified lines95 </p>96 ) : (97 <div className="flex flex-col gap-2 text-sm">98 <p className="flex flex-wrap gap-x-4 gap-y-1">95- {landing.ask === undefined ? null : (99+ {linked === undefined ? null : (100 <span>101 <span className="text-muted-foreground text-xs font-medium">98- Ask102+ {linked.kind === "opened" ? "Opened" : "Ask"}103 </span>{" "}104 <a105 className={`${ID} ${LINK}`}102- href={askPath(project, landing.ask)}106+ href={askPath(project, linked.ask)}107 >104- {landing.ask}108+ {linked.ask}109 </a>110 </span>111 )}112 <span>121 unmodified linesmodified:apps/web/src/features/code/refs-view.tsx+6 added-14 removed
8 unmodified lines9 * when they hold more than one, a list of packages, each with its newest10 * tag and its count, sits above the tags, and `?package=` lists one11 * package's tags alone.12 */13+import { packageOf } from "@repo/protocol/domain/code";14 import type { RefsView as Refs, TagRef } from "@repo/protocol/domain/code";15 import { defaultStringifySearch } from "@tanstack/react-router";15-import { Schema } from "effect";16+import { Option, Schema } from "effect";17 18 import { answerPath } from "../ask/ask-page.tsx";19 import { ProjectNav } from "../project/project-nav.tsx";20 import { EmptyState } from "../shared/empty.tsx";1 unmodified line22 import { PageShell } from "../shared/layout.tsx";23 import { Pager } from "./pager.tsx";24 import { commitHref, shortSha, treeHref } from "./paths.ts";25 25-/**26- * The package a tag versions, by the platform's rule (`packageOf` in27- * `@repo/project/code/refs`, which orders the tags; a test holds the two28- * equal): the name before its last `@` past the first character.29- */30-export const packageOfTag = (tag: string): string | undefined => {31- const at = tag.lastIndexOf("@");32-33- return at > 0 ? tag.slice(0, at) : undefined;34-};35-26 /** A `?package=` from the address, decoded; none for anything but a name. */27 export const packageParamOf = Schema.decodeUnknownOption(28 Schema.NonEmptyString.check(Schema.isMaxLength(255))29 );12 unmodified lines42 const packagesOf = (tags: readonly TagRef[]): readonly PackageRun[] => {43 const runs = new Map<string, PackageRun>();44 45 for (const tag of tags) {56- const name = packageOfTag(tag.name);46+ const name = Option.getOrUndefined(packageOf(tag.name));47 48 if (name !== undefined) {49 const run = runs.get(name);50 87 unmodified lines138 139 const tags =140 only === undefined141 ? refs.tags152- : refs.tags.filter((tag) => packageOfTag(tag.name) === only);142+ : refs.tags.filter(143+ (tag) => Option.getOrUndefined(packageOf(tag.name)) === only144+ );145 146 const shown = tags.slice(from, from + TAGS_PAGE);147 const claims = forks.filter((fork) => fork.kind === "claim");148 const working = forks.filter((fork) => fork.kind === "working");138 unmodified linesmodified:apps/web/src/features/proposal/failure.tsx+14 added-18 removed
7 unmodified lines8 import { Unauthenticated } from "@repo/protocol/principal";9 import { Cause, Option, Schema } from "effect";10 import { LogIn } from "lucide-react";11 12+import { signInHref } from "../auth/session-slot.tsx";12-import { FailureView } from "../today/today-page.tsx";13+import { FailureView, Notice } from "../today/today-page.tsx";14 15 const isUnauthenticated = Schema.is(Unauthenticated);16 16-/** Sign-in, coming back to `here` afterwards. */17-const signInHref = (here: string) =>18- `/auth/signin?${new URLSearchParams({ return: here }).toString()}`;19-17 export const ProposalFailure = ({18 cause,19 doing,20 here,4 unmodified lines25 /** The page's own address (`hereOf`), where sign-in comes back to. */26 readonly here: string;27 }) =>28 Option.exists(Cause.findErrorOption(cause), isUnauthenticated) ? (32- <output className="border-rule flex items-start gap-2 border-t border-b py-3 text-sm">33- <LogIn aria-hidden="true" className="mt-0.5 size-4 shrink-0" />34- <span>35- You are not signed in, or your session has ended.{" "}36- <a37- className="decoration-rule font-medium underline hover:decoration-current"38- href={signInHref(here)}39- >40- Sign in41- </a>{" "}42- to {doing}; you come back to this page.43- </span>44- </output>29+ <Notice30+ icon={<LogIn aria-hidden="true" className="mt-0.5 size-4 shrink-0" />}31+ >32+ You are not signed in, or your session has ended.{" "}33+ <a34+ className="decoration-rule font-medium underline hover:decoration-current"35+ href={signInHref(here)}36+ >37+ Sign in38+ </a>{" "}39+ to {doing}; you come back to this page.40+ </Notice>41 ) : (42 <FailureView cause={cause} />43 );modified:apps/web/src/features/propose/propose-view.tsx+2 added-1 removed
21 unmodified lines22 import { Checkbox } from "../../components/ui/checkbox.tsx";23 import { Label } from "../../components/ui/label.tsx";24 import { Spinner } from "../../components/ui/spinner.tsx";25 import { Textarea } from "../../components/ui/textarea.tsx";26+import { signInHref } from "../auth/session-slot.tsx";27 import { CommandLine } from "../shared/command.tsx";28 29 /** What `proposeAsk` takes, from its one schema. */30 export type ProposePayload = typeof ProposeAsk.payloadSchema.Type;62 unmodified lines93 <span>94 Proposing an ask is for signed-in members.{" "}95 <a96 className="decoration-rule font-medium underline hover:decoration-current"96- href={`/auth/signin?${new URLSearchParams({ return: proposeFormPath(project, about) }).toString()}`}97+ href={signInHref(proposeFormPath(project, about))}98 >99 Sign in100 </a>{" "}101 to propose one, or propose from your clone:132 unmodified linesmodified:apps/web/src/features/today/today-page.tsx+2 added-1 removed
103 unmodified lines104 const TITLE = "text-lg font-semibold";105 106 const LABEL = "text-muted-foreground text-xs font-medium";107 108+/** A one-line notice under a rule: an icon, then what to know. */108-const Notice = ({109+export const Notice = ({110 children,111 icon,112 }: {113 readonly children: ReactNode;300 unmodified linesmodified:apps/web/src/features/why/range-summary.tsx+20 added-6 removed
47 unmodified lines48 {linked.ask}49 </a>50 );51 52+/** The words an opening's own commit subject says, which its row need not say again. */53+const openingWords = (ask: string) => `Open ask ${ask}`;54+55 /**56 * The ask a landing links: "<ask> answer" for the one it answers, with its54- * answer's page; "Open ask <ask>" for the one it opened, which has none.57+ * answer's page; "Open ask <ask>" for the one it opened, which has none, or58+ * the ask alone when the commit's subject (`subject`) already says so.59 */60 const AskLinks = ({61 linked,62 project,63+ subject,64 }: {65 readonly linked: LandingAsk;66 readonly project: ProjectName;67+ readonly subject?: string;68 }) => {69 const ask = <AskLink linked={linked} project={project} />;70 65- return linked.kind === "opened" ? (66- <span>Open ask {ask}</span>67- ) : (71+ if (linked.kind === "opened") {72+ return subject === openingWords(linked.ask) ? (73+ ask74+ ) : (75+ <span>Open ask {ask}</span>76+ );77+ }78+79+ return (80 <>81 {ask}82 <a className={LINK} href={answerPath(project, linked.ask)}>83 answer18 unmodified lines102 */103 const Landed = ({104 landing,105 project,106+ subject,107 }: {108 readonly landing: LandingView;109 readonly project: ProjectName;110+ readonly subject: string;111 }) => {112 const verdict = Option.getOrUndefined(verdictWords(landing));113 const linked = Option.getOrUndefined(askOf(landing));114 1 unmodified line116 <>117 {linked === undefined ? null : (118 <>119 {DOT}106- <AskLinks linked={linked} project={project} />120+ <AskLinks linked={linked} project={project} subject={subject} />121 </>122 )}123 {DOT}124 <HandleLink handle={landing.author} />31 unmodified lines156 </a>157 {landing === undefined ? (158 <Adopted author={commit?.author.name ?? "unknown"} />159 ) : (146- <Landed landing={landing} project={project} />160+ <Landed landing={landing} project={project} subject={subject} />161 )}162 </span>163 );164 };99 unmodified linesmodified:apps/web/test/code.test.tsx+74 added-10 removed
6 unmodified lines7 * of these pages carries a `<file-tree-container` or a `<diffs-container`.8 */9 import { describe, expect, it } from "@effect/vitest";10 import { Brand } from "@repo/brand";11-import { packageOf } from "@repo/project/code/refs";11 import { Client, Contracts } from "@repo/protocol/contracts";12 import type { Contract } from "@repo/protocol/contracts";13 import {14 CommitDiff,29 unmodified lines44 import { BlobView } from "../src/features/code/blob-view.tsx";45 import { CommitView } from "../src/features/code/commit-view.tsx";46 import { LOG_PAGE, LogView } from "../src/features/code/log-view.tsx";47 import {49- packageOfTag,48 packageParamOf,49 RefsView,50 TAGS_PAGE,51 } from "../src/features/code/refs-view.tsx";378 unmodified lines430 expect(row).toContain("Asked-by:");431 expect(hrefsOf(row)).toContain("/people/ines-v");432 });433 434+ it("links the ask an opening's landing opened, and reads it as an opening", () => {435+ const [opening] = decodeCommits([436+ {437+ author: signature("Okonkwo", "2026-10-06T15:00:00.000Z"),438+ body: "",439+ committer: signature("platform", "2026-10-06T15:00:00.000Z"),440+ landing: {441+ assisted: [],442+ author: "okonkwo",443+ credits: [{ handle: "okonkwo", role: "Decided-by" }],444+ landedAt: "2026-10-06T15:00:00.000Z",445+ opened: "parse-iso-week",446+ parent: IMPORTED,447+ project: "datekit",448+ sha: LANDED,449+ },450+ parents: [IMPORTED],451+ sha: LANDED,452+ subject: "Open ask parse-iso-week",453+ trailers: [{ key: "Decided-by", value: "okonkwo" }],454+ tree: "4".repeat(40),455+ },456+ ]);457+458+ const row = slice(459+ markupOf(460+ <LogView461+ commits={opening === undefined ? [] : [opening]}462+ from={0}463+ now={now}464+ project={datekit}465+ rev="main"466+ />467+ ),468+ "data-commit",469+ LANDED470+ );471+472+ expect(hrefsOf(row)).toContain("/datekit/asks/parse-iso-week");473+ expect(row).toContain("Opened");474+ expect(row).not.toContain(">Ask<");475+ });476+477 it("says an imported commit came before adoption", () => {478 const row = slice(markupOf(page), "data-commit", IMPORTED);479 480 expect(row).toContain("before adoption");172 unmodified lines653 expect(hrefsOf(markup)).toContain("/datekit/answers/parse-iso-week");654 expect(markup).toContain('data-outcome="Landed"');655 });656 657+ it("links the ask an opening opened, and no answer, since it answers none", () => {658+ const markup = markupOf(659+ <CommitView660+ diff={decodeDiff({661+ commit: {662+ ...landedCommit,663+ landing: {664+ assisted: [],665+ author: "okonkwo",666+ credits: [{ handle: "okonkwo", role: "Decided-by" }],667+ landedAt: "2026-10-06T15:00:00.000Z",668+ opened: "parse-iso-week",669+ parent: IMPORTED,670+ project: "datekit",671+ sha: LANDED,672+ },673+ subject: "Open ask parse-iso-week",674+ },675+ files: [],676+ truncated: false,677+ })}678+ now={now}679+ project={datekit}680+ />681+ );682+683+ expect(hrefsOf(markup)).toContain("/datekit/asks/parse-iso-week");684+ expect(hrefsOf(markup)).not.toContain("/datekit/answers/parse-iso-week");685+ expect(markup).toContain("Opened");686+ });687+688 it("links its parent, and counts and names the files it changed", () => {689 const text = textOf(page);690 691 expect(hrefsOf(markupOf(page))).toContain(`/datekit/commit/${IMPORTED}`);229 unmodified lines921 Option.none(),922 Option.none(),923 ]);924 });853-854- it("groups by the same package as the platform's order", () => {855- const names = ["v1.0.0", "@scope@1", "@scope", "a@b@1.0.0", "pkg@2"];856-857- expect(names.map(packageOfTag)).toStrictEqual(858- names.map((name) => Option.getOrUndefined(packageOf(name)))859- );860- });925 });926 927 /** A payload the platform was sent: one of the contracts'. */928 type Sent = Rpc.Payload<Contract>;267 unmodified linesmodified:apps/web/test/dev-backend.test.ts+19 added-3 removed
149 unmodified lines150 const anyone = yield* clientOf(as());151 const ines = yield* clientOf(as(decider));152 const { projects } = yield* anyone.listProjects({});153 const { unattended } = yield* ines.today({});154+ const burrow = ProjectName.make("burrow");155 155- return { landedAt: unattended.map(({ landedAt }) => landedAt), projects };156+ const landed = yield* Effect.orDie(157+ Effect.fromNullishOr((yield* anyone.listRefs({ project: burrow })).landed)158+ );159+160+ // burrow has only its asks' openings, each a landing; the last is main.161+ const { landing: opening } = yield* anyone.landing({162+ project: burrow,163+ sha: landed,164+ });165+166+ return {167+ landedAt: unattended.map(({ landedAt }) => landedAt),168+ opening,169+ projects,170+ };171 })172 );173 174 /**36 unmodified lines211 it.live(212 "lists each project with when it last landed, as D1's project list does",213 () =>214 Effect.gen(function* () {200- const { landedAt, projects } = yield* listedWithLanding;215+ const { landedAt, opening, projects } = yield* listedWithLanding;216 217 expect(218 projects.map(({ landedAt: at, project }) => [project, at])219 ).toStrictEqual([205- ["burrow", undefined],220+ ["burrow", opening.landedAt],221 ["datekit", landedAt[0]],222 ]);223+ expect(opening.opened).toBeDefined();224 expect(landedAt).toHaveLength(1);225 })226 );227 137 unmodified linesmodified:apps/web/test/why.test.tsx+24 added
257 unmodified lines258 hrefsOf(row).filter((href) => href.includes("/answers/"))259 ).toStrictEqual([]);260 });261 262+ it('says "Open ask" once when the commit\'s subject already says it, still linking the ask', () => {263+ const said = Schema.decodeSync(WhyView)({264+ ...Schema.encodeSync(WhyView)(opening),265+ commits: Schema.encodeSync(WhyView)(opening).commits.map((commit) =>266+ commit.sha === OPENED267+ ? { ...commit, subject: "Open ask format-ordinal" }268+ : commit269+ ),270+ });271+272+ const row = rowOf(273+ markupOf(274+ <WhyLines project={datekit} rev="main" text={TEXT} view={said} />275+ ),276+ "2-3"277+ );278+279+ expect(textOf(row).split("Open ask format-ordinal")).toHaveLength(2);280+ expect(hrefsOf(row)).toContain("/datekit/asks/format-ordinal");281+ expect(282+ hrefsOf(row).filter((href) => href.includes("/answers/"))283+ ).toStrictEqual([]);284+ });285+286 it("keeps an answering landing's ask and answer links, and an adopted commit's words", () => {287 const markup = markupOf(opened);288 289 expect(hrefsOf(rowOf(markup, "1-1"))).toStrictEqual(149 unmodified linesmodified:docs/adr/0019-the-web-reads-repos-through-public-contracts.md+1 added
16 unmodified lines17 - Raw bytes (`GET /<project>/raw/<rev>/<path>`) carry `x-content-type-options: nosniff` and a sandboxing CSP (`default-src 'none'; img-src 'self' data:; style-src 'unsafe-inline'; sandbox`) on every answer, refusals included. HTML and XML are served as plain text, and SVG as an image, which the sandbox keeps from running script. A read by commit SHA is cached as immutable. The web passes the route on untouched.18 - Reads addressed by object id (trees, blobs, commits, a commit's changes, a file's why) are cached per isolate, keyed by the object's id. Only finished reads are kept, never one still under way, because Workers cancels a request whose client left without interrupting its fibers. `main` is resolved on every call.19 - A README renders as GitHub-flavoured Markdown in one fixed plugin order, its relative links and images pointing into the repo at the SHA, then sanitized with GitHub's allow-list. The order is the security property, so it lives in one tested module.20 - Why each line is there is a first-parent blame from the revision, up to 200 commits. A line whose commit is a platform landing names its ask, answer, people and verdict from the project's own record, so a trailer forged on an imported commit never reads as a landing.21+- An ask's opening is a landing that answers no ask, so its landing names the ask it opened (`opened`, a migrate family's parent) and never `ask`, which credits, Today and the record read as an answer. The project derives `opened` from its record when it is read, so openings recorded before the field existed link their ask too, with nothing rewritten. Each read's results are kept beyond one isolate as ADR 0020 records.22 - The port lists tags already peeled to their commits, since an annotated tag names a tag object a commit read cannot open.23 - Artifacts' import brings no tags. An operator may backfill an imported repo's `refs/tags/*` from its source, through a short-lived write token minted over REST. This is the one write that skips the gateway, and it writes tags only, never `main`.24 - Each read is an Artifacts operation, billed past a monthly allowance and limited to 2,000 a repo every 10 s. Every walk is capped: 50,000 paths, 200 commits scanned for a path's log or for why, 300 files and 2 MiB of text in a commit's diff, and 1 MiB per file.added:docs/adr/0020-code-history-is-kept-by-immutable-ids.md+26 added
1+---2+status: accepted3+---4+5+# Code history is kept by immutable ids, in a bucket of its own6+7+Why each line of a file is there, and a path's history, are what a walk of up to 200 first-parent commits computes, and a cold walk on a large import took tens of seconds in one isolate, then again in the next. What a walk computes from a commit is fixed for good by that commit's content, so the platform keeps it in an R2 bucket, `code-cache-<stage>` (binding `CODE_CACHE`, platform only), behind the `CodeStore` port in `@repo/project`. A key is `<repo>/<kind>/v<version>/<commit>/<scan>/<sha256(path)>`: the canonical repo only, `why` or `path-log`, the version of the algorithm that computed it, a commit id (never `main` or a tag's name, which resolve first), how many commits the walk scanned, and the path hashed to keep the key under R2's 1,024 bytes. A value holds ids and ranges encoded with Schema, never a file's text and never a landing: each view asks the project's record for its landings, so a new landing or an opening's ask shows at once.8+9+## Considered Options10+11+- **The Cache API.** It is per colo, so a reader in another colo pays the walk again, and every stage lives on `workers.dev`, where we assume `cache.put` keeps nothing.12+- **Workers KV.** Its namespace id would be written per stage into `wrangler.jsonc`, and it is eventually consistent, where R2 is strongly consistent and its binding is only a bucket name.13+- **The Project Durable Object's storage.** It would put every reader's lookup and put on the project's single-threaded object, beside its claims and landings.14+- **The `evidence` bucket.** It keeps failing lanes' logs, another job with its own name.15+- **Every tree in the store.** Tried live and reverted: each store call cost what a repo read does, so a repo's first view did three times the calls and took 32-38 s.16+- **A per-commit path index.** Counted over local copies, building it reads every changed folder of every commit in the window, about three times the trees of one walk, and the first view would pay for it. Not built.17+18+## Consequences19+20+- Reads go isolate cache, then store, then walk; what a walk computes is put in both. A store that fails, or a value that no longer decodes, is a miss, never the read's failure, and the walk puts a good value back.21+- A walk may start from what is kept at a first-parent ancestor up to 16 commits back, carrying line ranges forward through each diff, so a new landing on `main` costs a handful of reads. A result built forward that way keeps that ancestor's place in history, so past the 200-commit window it can differ from a walk started fresh; both are correct for the commits they name.22+- A version moves whenever its algorithm changes, so an old value is never read as a new one, and nothing in the bucket ever goes stale.23+- A store answers one Worker invocation a few dozen calls a second whatever is under way, so the number of calls is the cost. A file of at most 256 KiB is read whole at each commit (its git blob id is the SHA-1 of its bytes), one call a commit instead of its folders; a larger file, a folder or a missing path walks the folders. A commit that changes only a file's mode does not show in that file's history.24+- A view's reads run in one repo session (`inRepoSession` in `@repo/artifacts`): the binding adapter opens one handle per repo for the session and releases it when the view ends. A call Artifacts refuses as rate limited is asked again with a growing wait, a few times, then fails the view, which keeps nothing.25+- A cold view of a file with 200 commits of history still makes about 200 calls, 5-8 s in one invocation; a warm one answers in under a second. Going lower needs work that runs off the reader's request, such as an index built when something lands.26+- Removing the store is a deletion: the port's default stores nothing, and every read still answers.modified:packages/config/test/web-wiring.test.ts+3 added-4 removed
219 unmodified lines220 expect(workers.map(({ dir }) => dir)).toContain("apps/web");221 });222 223 // Each Worker grows on its own, so each has limits of its own, about224- // 15% above its bundle as measured once the code browser and drafting225- // landed (the platform's entry stays at the ceiling they landed under,226- // 14% above it).224+ // 15% above its bundle as last measured (the platform's entry, its only225+ // module, 1,679,675: both its limits at 1,900,000, 13% above).226 it("holds each Worker it measures to limits of its own", () => {227 expect(budgets).toStrictEqual({229- "apps/platform": { entry: 1_900_000, javascript: 1_918_000 },228+ "apps/platform": { entry: 1_900_000, javascript: 1_900_000 },229 "apps/sandbox": { entry: 656_000, javascript: 656_000 },230 "apps/web": { entry: 818_000, javascript: 4_075_000 },231 });232 expect(Object.keys(budgets).toSorted()).toStrictEqual(25 unmodified linesmodified:packages/project/src/code/refs.ts+1 added-13 removed
4 unmodified lines5 * `refs/tags/*` is read: nothing of the platform's own (its landed mirror,6 * compose refs, notes) and no branch but main ever shows.7 */8 import { RepoHost } from "@repo/artifacts/repo-host";9-import { TagName } from "@repo/protocol/domain/code";9+import { packageOf, TagName } from "@repo/protocol/domain/code";10 import type { RefsView, TagRef } from "@repo/protocol/domain/code";11 import { Array, Effect, Option, Schema } from "effect";12 13 import type { CodeProject } from "../code.ts";63 unmodified lines77 return leftIsLonger === longerIsNewer ? -1 : 1;78 };79 80 /**81- * The package a tag versions: the name before its last `@`, when that `@`82- * is past the first character (`@changesets/cli@2.27.1` versions83- * `@changesets/cli`, `get-workspaces@1.0.11` versions `get-workspaces`).84- * A tag with no such `@` (`v1.2.3`, a bare scope) versions no package.85- */86-export const packageOf = (tag: string): Option.Option<string> => {87- const at = tag.lastIndexOf("@");88-89- return at > 0 ? Option.some(tag.slice(0, at)) : Option.none();90-};91-92-/**81 * Tags in the order a reader meets them, from their names alone: the tags82 * that version no package first; then each package's tags as one run, the83 * package with the most tags first (a monorepo's main package), ties by84 * name; newest first within each (`compareTags`).73 unmodified linesmodified:packages/project/src/project.ts+7 added-2 removed
4380 unmodified lines4381 writes.events.push(askOpened(each, now));4382 }4383 }4384 4385- writes.landings.push({4385+ const landing: LandingView = {4386 assisted: opening.assisted,4387 author: opening.asker,4388 credits: landed.credits,4389 landedAt: now,2 unmodified lines4392 parent: main,4393 project: name,4394 requestId: landed.requestId,4395 sha: landed.sha,4396- });4396+ };4397+4398+ writes.landings.push(landing);4399+ // Heard as every landing is (main moved), so a list of landings4400+ // shows the opening; it answers no ask, so it credits nothing.4401+ writes.events.push(ProjectEventInput.Landed({ at: now, landing }));4402 writes.project.set(4403 "row",4404 yield* withPolicyAt({ ...row, landed: landed.sha }, landed.sha, now)4405 );1400 unmodified linesmodified:packages/project/test/code-history.test.ts+41 added
666 unmodified lines667 )668 );669 });670 671+describe("what the store keeps", () => {672+ it.effect(673+ "is keyed under the project's own repo alone, and holds no landing",674+ () =>675+ Effect.gen(function* () {676+ const kept = yield* Ref.make<ReadonlyMap<string, string>>(new Map());677+678+ const recording = Layer.succeed(CodeStore, {679+ get: (key) =>680+ Effect.map(Ref.get(kept), (all) =>681+ Option.fromUndefinedOr(all.get(key))682+ ),683+ put: (key, value) =>684+ Ref.update(kept, (all) => new Map([...all, [key, value]])),685+ });686+687+ yield* Effect.gen(function* () {688+ const { grown } = yield* history;689+ const { code, landed } = yield* recordOf(grown);690+691+ yield* Ref.set(landed, [landingOf(grown, "grow-format")]);692+ yield* onIsolate(whyOf(code, Option.none(), format));693+ yield* onIsolate(logOf(code, formatLog(grown)));694+ }).pipe(Effect.provide(Layer.merge(RepoHostMemory, recording)));695+696+ const all = [...(yield* Ref.get(kept))];697+698+ expect(all.length).toBeGreaterThan(0);699+ expect(700+ all.filter(([key]) => !key.startsWith(`${repo}/`))701+ ).toStrictEqual([]);702+ expect(703+ all.filter(704+ ([, value]) =>705+ value.includes("grow-format") || value.includes("landedAt")706+ )707+ ).toStrictEqual([]);708+ })709+ );710+});711+712 /**713 * The memory store, the session each commit, tree, blob and log read ran714 * in noted in `sessions`, in order.715 */256 unmodified linesmodified:packages/project/test/code-tags.test.ts+2 added-1 removed
5 unmodified lines6 * pages in behind every one-tag package.7 */8 import { describe, expect, it } from "@effect/vitest";9 import { RepoHostMemory } from "@repo/artifacts/repo-host/memory";10+import { packageOf } from "@repo/protocol/domain/code";11 import { ProjectName, RepoName } from "@repo/protocol/ids";12 import { Effect, Option } from "effect";13 14 import { refsOf } from "../src/code.ts";15 import type { CodeProject } from "../src/code.ts";15-import { packageOf, sortTags } from "../src/code/refs.ts";16+import { sortTags } from "../src/code/refs.ts";17 import { writer } from "./code-fixtures.ts";18 19 /** Changesets' kinds of tag, shuffled: plain, scoped and unscoped. */20 const shuffled = [84 unmodified linesmodified:packages/project/test/do-reads.test.ts+18 added
4 unmodified lines5 */6 import { describe, expect, it } from "@effect/vitest";7 import { Brand } from "@repo/brand";8 import { CheckSpec } from "@repo/protocol/domain/check";9+import { ProjectEvent } from "@repo/protocol/domain/event";10 import type { LandingView } from "@repo/protocol/domain/landing";11 import {12 AskId,13 CommitSha,93 unmodified lines107 });108 109 const { claim } = yield* api.claim(bob, parseIso.id);110 111+ const landedEvents = (yield* api.events(0, 100)).flatMap(({ event }) =>112+ ProjectEvent.guards.Landed(event) ? [event.landing] : []113+ );114+115 return {116 adopted,117 after: {118 forks: yield* api.forks(),3 unmodified lines122 },123 before,124 claim,125 landed,126+ landedEvents,127 };128 });129 130 const world = Layer.mergeAll(worldOf(scenario, "memory"), NoVisibility, NoEnv);131 132 describe("a project's reads for its code and its people", () => {133 it.effect(134+ "hear an ask's opening as a landing, naming the ask it opened, so a list of landings shows it",135+ () =>136+ Effect.map(read.pipe(Effect.provide(world)), (got) => {137+ expect(138+ got.landedEvents.map(({ ask, opened, sha }) => ({ ask, opened, sha }))139+ ).toStrictEqual([140+ { ask: undefined, opened: parseIso.id, sha: got.landed },141+ ]);142+ })143+ );144+145+ it.effect(146 "say where main landed, which commits are landings, the forks and the public policy",147 () =>148 Effect.map(read.pipe(Effect.provide(world)), (got) => {149 // Before the first landing there is no policy, and nothing to say why.175 unmodified linesmodified:packages/project/test/project.test.ts+4 added-2 removed
890 unmodified lines891 it.effect(892 "5. its events come in order, and the projection heard every one",893 () =>894 Effect.map(seen, ({ answered }) => {895+ // The ask's opening lands too, and is heard as a landing.896 expect(answered.events).toStrictEqual([897 "AskOpened",898+ "Landed",899 "Claimed",900 "Pushed",901 "Pushed",902 "Judged",307 unmodified lines1210 ({ after, before }) => {1211 expect(before).toStrictEqual({1212 alarm: Option.some(DateTime.add(noon, { seconds: 1 })),1213 fork: false,1212- outbox: ["MakeFork", "Projected"],1214+ outbox: ["MakeFork", "Projected", "Projected"],1215 });1216 expect(after).toStrictEqual({1217 fork: true,1218 outbox: [],1217- projected: ["Claimed", "AskOpened"],1219+ projected: ["Claimed", "AskOpened", "Landed"],1220 });1221 }1222 )1223 );211 unmodified linesmodified:packages/protocol/src/domain/code.ts+14 added-1 removed
2 unmodified lines3 * and "why" per line, each read from the project's canonical repo only (no4 * payload names a repo). Every read names the 40-hex commit it resolved5 * to (`at`), so any page can become a permalink.6 */7-import { Schema } from "effect";7+import { Option, Schema } from "effect";8 9 import {10 AskId,11 BlobSha,15 unmodified lines27 28 export type TagName = typeof TagName.Type;29 30 /**31+ * The package a tag versions: the name before its last `@`, when that `@`32+ * is past the first character (`@changesets/cli@2.27.1` versions33+ * `@changesets/cli`, `get-workspaces@1.0.11` versions `get-workspaces`).34+ * A tag with no such `@` (`v1.2.3`, a bare scope) versions no package. The35+ * platform orders tags by it and the refs page groups them by it.36+ */37+export const packageOf = (tag: string): Option.Option<string> => {38+ const at = tag.lastIndexOf("@");39+40+ return at > 0 ? Option.some(tag.slice(0, at)) : Option.none();41+};42+43+/**44 * A revision as a reader names it: `main` (the landed commit), a full45 * 40-hex commit id, or a tag's name. Decoded into one of the three where46 * it is read; anything else is `UnknownRevision`.47 */158 unmodified linesmodified:scripts/startup-budget.ts+7 added-2 removed
32 unmodified lines33 * held to 1,900,000 (the ceiling, 14% above) and 1,918,000 of JavaScript;34 * the sandbox's 570,424, held to 656,000; the web's entry 710,962, held to35 * 818,000, and its JavaScript 3,543,318, held to 4,075,000. The web's36 * JavaScript counts the Worker's server modules only: chunks the browser37- * alone loads (Pierre's) are assets.37+ * alone loads (Pierre's) are assets. Once the code store, the README on38+ * the server and the people page's reasons had landed, no limit was raised:39+ * the platform's entry, its only module, measured 1,679,675 (both its40+ * limits now 1,900,000, 13% above); the sandbox's 570,582 (656,000, 15%);41+ * the web's entry 711,006 (818,000, 15%) and its JavaScript 3,567,68242+ * (4,075,000, 14%).43 */44 import { BunRuntime, BunServices } from "@effect/platform-bun";45 import { Console, Data, Effect, FileSystem, Path, pipe } from "effect";46 import { ChildProcess, ChildProcessSpawner } from "effect/process";5 unmodified lines52 }53 54 /** Each Worker's limits, by its folder. */55 export const budgets = {51- "apps/platform": { entry: 1_900_000, javascript: 1_918_000 },56+ "apps/platform": { entry: 1_900_000, javascript: 1_900_000 },57 "apps/sandbox": { entry: 656_000, javascript: 656_000 },58 "apps/web": { entry: 818_000, javascript: 4_075_000 },59 } as const satisfies Record<string, Budget>;60 133 unmodified linesmodified:AGENTS.md+5 added-5 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` and `PUBLIC_WEB_URL` among them, and each port's factory takes its binding as the generated Env types it, without a cast) |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) |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); `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` and `showProposal` 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) |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); `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 |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/web/test/production-bundle.test.ts` (no dev-world module in the web's production build); `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); `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`). 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 or Artifacts 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); `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) |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); `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). No fence: one push deduped by (repo, sha) across the gateway's record and OnPush's |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); `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`). 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) |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); `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); `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). 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`) |26-| 12 | **Lifecycles are pure transitions.** `transition(state, command, now)`. Per DO call: hydrate, transition, persist, settle. Deadlines run on DO alarms. Call them lifecycles. | `globalTimers` and `globalTimersInEffect`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts` (model tests over effect/Arbitrary histories, each seen catching its planted bug); `packages/project/test/drafting.model.test.ts` (a proposal's `DraftCommand.DraftStarted` and `DraftSettled` over generated histories); `apps/platform/test/project-do.test.ts`. No fence: `Effect.sleep` and `Effect.delay` in `packages/project/src` |26+| 12 | **Lifecycles are pure transitions.** `transition(state, command, now)`. Per DO call: hydrate, transition, persist, settle. Deadlines run on DO alarms. Call them lifecycles. | `globalTimers` and `globalTimersInEffect`; `packages/project/test/claim.model.test.ts` and `packages/project/test/landing.model.test.ts` (model tests over effect/Arbitrary histories, each seen catching its planted bug); `packages/project/test/drafting.model.test.ts` (a proposal's `DraftCommand.DraftStarted` and `DraftSettled` over generated histories; a Ready round's files survive a later failed round); `apps/platform/test/project-do.test.ts`. No fence: `Effect.sleep` and `Effect.delay` in `packages/project/src` |27 28 ## Verify29 30 `bun run verify` runs `lockfile:check`, `check`, `typecheck`, `test`, `brand:check` and `bytes:check`, and stops at the first failure. Run `bun run fix`, then `bun run verify`, before you stop. When a check fails, fix the cause. Loosening, skipping or disabling a check needs the user's sign-off.118 unmodified linesmodified:GLOSSARY.md+2 added-2 removed
71 unmodified lines72 The cost-ordered chain of stages that narrows a push to a checked tree or a refusal.73 _Avoid_: CI, pipeline, merge queue74 75 **Landing**:76-The platform's commit of a checked tree to main, written by the platform with credit trailers.76+The platform's commit of a checked tree to main, written by the platform with credit trailers. An ask's opening is a landing too: it opens an ask and answers none.77 _Avoid_: merge, ship78 79 **Landed SHA**:80 The commit the platform itself last landed on main; the only commit a project's rules are read from.18 unmodified lines99 The record of one check run: base, head, patch id, level and the platform as verifier, kept with the landing.100 _Avoid_: approval, review101 102 **Why**:103-A line's landing: the ask, the answer, the people and the verdict that put that line on main.103+A line's landing: the ask it answered (with its answer and verdict) or the ask it opened, and the people, that put that line on main.104 _Avoid_: blame105 106 **Patch id**:107 The platform's own fingerprint of an answer's change set: a hash over each path the answer changes, with its content before and after, so the same change gives the same id however its commits were made.112 unmodified linesmodified:README.md+5 added-4 removed
44 unmodified lines45 6. It lands the checked tree on `main` as its own commit crediting every person, or answers with a refusal.46 47 Around the loop:48 49-- **A code browser on the web.** A project's page shows its clone line, its files and its README, rendered as GitHub-flavoured Markdown with links and images pointing into the repo at the commit. Beside it are a file tree, highlighted files with `#L` line links, raw bytes served under a sandboxing CSP, the history, each commit's diff, and one refs page (main, tags and claim forks). Every page names the commit it shows, so any page is a permalink.50-- **Why each line is there.** A file's why page attributes each line to the landing that put it on `main`, naming its ask, answer, people and verdict. Imported history reads "before adoption".49+- **A code browser on the web.** A project's page shows its clone line, its files and its README, rendered as GitHub-flavoured Markdown with links and images pointing into the repo at the commit. Beside it are a file tree, highlighted files with `#L` line links, raw bytes served under a sandboxing CSP, the history, each commit's diff, and one refs page (main, tags and claim forks; a monorepo's tags grouped by package, each package's newest first). The README arrives in the server's HTML, so a crawler or `curl` reads it too. Every page names the commit it shows, so any page is a permalink.50+- **Why each line is there.** A file's why page attributes each line to the landing that put it on `main`, naming its ask, answer, people and verdict, or the ask an opening opened. Imported history reads "before adoption". Why and a file's history are kept by commit in an R2 bucket, so every isolate reads them back ([ADR 0020](docs/adr/0020-code-history-is-kept-by-immutable-ids.md)): on the dev stage's imports (changesets, click; 200 commits of history) a first view took 5.3 to 7.7 s, down from 18.6 to 39.6 s, and a view already kept answers in under a second.51 - **Asks drafted for a want.** A member proposes a want with `--draft` (or the web's propose form). The platform's agent, a Workers AI model, drafts the ask file and its failing test, runs them red first on the Checker, and puts the draft to a decider with its evidence. Nothing lands until a decider accepts, and the landing discloses the agent with `Assisted-by` ([ADR 0018](docs/adr/0018-asks-are-drafted-in-a-workflow-and-put-to-a-decider.md)).52-- **A people page.** Who decides which paths, who is vouched for or denounced, each layer's readers, writers and disclosure, and the caps, budget and claim timing, all read from the config folder at the landed commit. It has no edit control: these change by landing a change to the config folder.52+- **A people page.** Who decides which paths, who is vouched for or denounced, each layer's readers, writers and disclosure, and the caps, budget and claim timing, all read from the config folder at the landed commit. It has no edit control: these change by landing a change to the config folder. A project whose config has not evaluated says why (no config folder, or one that failed) and what makes it evaluate; `myr policy` prints the same as text.53 - **The platform's own front page.** The platform's `/` says what the host serves (clone URLs, MCP, agent skills, sign-in, the CLI and the web app), in HTML for a browser and as Markdown for an agent.54 55 The web reads code only through public contracts the platform serves ([ADR 0019](docs/adr/0019-the-web-reads-repos-through-public-contracts.md)). On the dev stage, eight open-source repos are imported and kept for previewing it: anyhow, ky, gum, click, awesome, changesets, stb and fuzzel.56 197 unmodified lines254 | 1 | Today full-screen at a terminal, `myr today --tui` (`myr today` goes back to the contract's projected command, which prints the same) | `apps/cli/src/tui/`, `apps/cli/test/tui/`, the `@opentui/*` lines in `apps/cli/package.json`; `today` in `wrapped`, `entries` and `Every` in `apps/cli/src/surfaces.ts`, its row in `packages/agent-kit/src/command-doc.ts` and its word in `packages/agent-kit/test/command-doc.test.ts` |255 | 1 | Agent extras: the Markdown ask page, per-project well-known skills, and `myr schema` | `apps/web/src/features/ask/markdown.ts`, `apps/web/test/ask-markdown.test.ts`; `packages/agent-kit/src/well-known.ts`, `apps/platform/src/well-known.ts`, `apps/platform/test/well-known.test.ts`, `apps/web/src/routes/[.]well-known/agent-skills/$.ts`; `apps/cli/test/schema.test.ts` and the `schema` command in `apps/cli/src/surfaces.ts` |256 | 1 | The pi adapter | `apps/cli/src/pi.ts`, `apps/cli/test/pi.test.ts`, its entry and its `neverBundle` line in `apps/cli/tsdown.config.ts`, the pi dev dependency in `apps/cli/package.json`, and the adapter's line in the package manifest's `pi` key in `scripts/lib/release.ts` |257 | 2 | Why each line is there, on the web (the file toolbar's Why link goes) | `packages/git/src/blame.ts`, `packages/git/src/line-diff.ts` (with `tree-diff.ts` keeping its own diff), `packages/git/test/{blame,line-diff}.test.ts`, `packages/project/src/code/why.ts`, `packages/project/test/code-why.test.ts`, `whyOf` in `packages/project/src/code.ts`, the `why` contract's handlers, `apps/web/src/routes/$project/why/`, `apps/web/src/features/why/`, `apps/web/src/client/why.ts`, `apps/web/test/why.test.tsx`, `apps/web/e2e/why.e2e.ts` |258+| 2 | Code history kept across isolates (each isolate walks why and a file's history again, as it did before; nothing else changes) | `packages/project/src/code-store/binding.ts` and its R2 cases in `packages/project/test/code-store.test.ts`; the `CODE_CACHE` bucket in `apps/platform/wrangler.jsonc` (then `bun run --cwd apps/platform types`), its decode in `apps/platform/src/platform.ts`, its `CodeStoreR2` line in `apps/platform/src/ports.ts`, its line in `apps/platform/test/fake-env.ts` and its rows in `apps/platform/test/bindings.test.ts` and `apps/web/test/env.test-d.ts`; `codeCache` in `infra/stages.ts` and its rows in `packages/config/test/bootstrap.test.ts`. Going further, `packages/project/src/code-store.ts`, `packages/project/src/code-store/`, `packages/project/src/code/history.ts`, `packages/project/test/code-history.test.ts` and the store's `CodeStore` line in `apps/platform/src/surfaces.ts` go too, which edits `nearestKept` and its callers out of `packages/project/src/code/{why,log}.ts` |259 | 2 | A README rendered as Markdown (it shows as plain text instead) | `apps/web/src/features/markdown/`, `apps/web/test/markdown.test.tsx`, `apps/web/test/markdown-resolve.test.ts`, and the `react-markdown`, `remark-gfm`, `rehype-*` and `@tailwindcss/typography` lines in `apps/web/package.json` |260 | 3 | The people page | `apps/web/src/routes/$project/people.tsx`, `apps/web/src/features/project-people/`, `apps/web/src/client/policy.ts`, `apps/web/test/project-people.test.tsx`, `apps/web/e2e/people.e2e.ts`, and its tab in the project nav |261 | 2 | `myr why`, verdicts as git notes, and the `ReachedInternals` stage | `apps/cli/src/local/why.ts`, `apps/cli/test/local/why.test.ts`; `packages/git/src/notes.ts`, `apps/platform/src/workflows/notes.ts`, `packages/git/test/notes.test.ts`, `apps/platform/test/notes.test.ts` (verdicts still reach `status`, `verdict` and MCP); `packages/gate/src/imports.ts`, `packages/gate/test/imports.test.ts` and its branch in `packages/gate/src/stages/shape.ts` |262 | 2 | The null-answer codemod: a check that passes against an answer whose exports do nothing is `WeakCheck` (built and tested; no ask runs it yet, since it needs a third check run and a step in the Checker's image) | `packages/checks/src/null-answer.ts`, `packages/checks/test/null-answer.test.ts`, `packages/checks/test/fixtures/null-answer/`, and its `./null-answer` export and `ts-morph` line in `packages/checks/package.json` |41 unmodified lines304 ### Three Workers, and who holds what305 306 | Worker | Holds | Reached by |307 | --- | --- | --- |307-| `platform` | `ARTIFACTS` (the public namespace) and `ARTIFACTS_PRIVATE` (layer repos), the `PROJECT` Durable Object, the `ANSWER` and `ON_PUSH` Workflows, the `FRONT_PAGE` database, `OAUTH_KV`, the `EVIDENCE` and `RELEASES` buckets, `LOADER` (a Worker Loader for config code), `AI` (Workers AI, for drafting asks), the `SANDBOX` service, rate limits, the push-event trigger and every secret | git, the CLI, MCP clients and the web |308+| `platform` | `ARTIFACTS` (the public namespace) and `ARTIFACTS_PRIVATE` (layer repos), the `PROJECT` Durable Object, the `ANSWER` and `ON_PUSH` Workflows, the `FRONT_PAGE` database, `OAUTH_KV`, the `EVIDENCE`, `RELEASES` and `CODE_CACHE` buckets, `LOADER` (a Worker Loader for config code), `AI` (Workers AI, for drafting asks), the `SANDBOX` service, rate limits, the push-event trigger and every secret | git, the CLI, MCP clients and the web |309 | `sandbox` | the `CHECKER` and `LANDER` Durable Objects and their containers; no Artifacts binding: each job carries a short-lived token for one repo | only the platform's `SANDBOX` binding; it has no public URL |310 | `web` | `PLATFORM` (a service binding) and public vars; no storage and no secret | browsers, and agents reading Markdown |311 312 Bindings are declared per stage in each app's `wrangler.jsonc`, and the platform decodes its whole env once, at start (`apps/platform/src/platform.ts`).62 unmodified lines