Show discussions on the web, partial: a Discussions tab and crumbs, the list and thread pages at /<project>/discussions and /<project>/discussions/<discussion>, read-only with the post command copyable, atoms keyed to refetch on DiscussionPosted, the dev world's handlers and two seeded datekit discussions (one turned into a proposal), nine-tab pins in nav and project tests, and PRODUCT.md's tab list; apps/web/test/discussions.test.tsx is written but not yet run
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parent 3d92a38 · Browse files · 28 files·+970 added−194 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
28 files+970 added−194 removed
- tests:+395 added−176 removed
- other:+575 added−18 removed
Provenance
- Commit
7f85b26- Tree
574dd35- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent
3d92a38
28 files changed+970 added−194 removed
modified:apps/platform/src/adapters/do-projects.ts+1 added-2 removed
93 unmodified lines949596979899989910010110273 unmodified lines93 unmodified lines layerAccess: (caller, layer) => on("layerAccess", [caller, layer]), layerFacts: (caller) => on("layerFacts", [caller]), ledger: (caller) => assumingMade(on("ledger", [caller])), listAsks: (caller) => assumingMade(on("listAsks", [caller])), listDiscussions: (caller) => assumingMade(on("listDiscussions", [caller])), listDiscussions: (caller) => assumingMade(on("listDiscussions", [caller])), onAlarm: () => on("onAlarm", []), openAsk: (caller, input) => assumingMade(on("openAsk", [caller, input])), policy: () => on("policy", []), postDiscussion: (caller, input) =>73 unmodified linesmodified:apps/platform/test/mcp.test.ts+5 added-1 removed
432 unmodified lines433 args: { ask: nope, files: askFiles, project },434 refusal: new NotDecider({}),435 },436 postDiscussion: {437- args: { body: "Hello", discussion: DiscussionId.make("disc-000001"), project },437+ args: {438+ body: "Hello",439+ discussion: DiscussionId.make("disc-000001"),440+ project,441+ },442 refusal: new UnknownDiscussion({443 discussion: DiscussionId.make("disc-000001"),444 }),445 },542 unmodified linesadded:apps/web/src/client/discussion.ts+27 added
123456789101112131415161718192021222324252627import type { DiscussionId, ProjectName } from "@repo/protocol/ids";import { Atom } from "effect/reactivity";
import { ContractsClient } from "../surfaces.ts";import { keys } from "./keys.ts";
export const discussionsAtom = Atom.family((project: ProjectName) => Atom.withServerValueInitial( ContractsClient.query( "listDiscussions", { project }, { reactivityKeys: keys.discussions(project) } ) ));
export const discussionAtom = Atom.family((project: ProjectName) => Atom.family((discussion: DiscussionId) => Atom.withServerValueInitial( ContractsClient.query( "showDiscussion", { discussion, project }, { reactivityKeys: keys.discussion(project, discussion) } ) ) ));modified:apps/web/src/client/keys.ts+16 added-1 removed
1 // Each key is one string: Reactivity treats every element of a key list as a key of its own.2-import type { AskId, ProjectName, ProposalId } from "@repo/protocol/ids";2+import type {3+ AskId,4+ DiscussionId,5+ ProjectName,6+ ProposalId,7+} from "@repo/protocol/ids";8 9 export const keys = {10 ask: (project: ProjectName, ask: AskId): readonly string[] => [11 `ask:${project}/${ask}`,12 `project:${project}`,13 ],14 code: (project: ProjectName): readonly string[] => [`code:${project}`],15+ discussion: (16+ project: ProjectName,17+ discussion: DiscussionId18+ ): readonly string[] => [19+ `discussion:${project}/${discussion}`,20+ `discussions:${project}`,21+ ],22+ discussions: (project: ProjectName): readonly string[] => [23+ `discussions:${project}`,24+ ],25 // Not the project's key, so a page's reads can refetch without replaying every event.26 events: (project: ProjectName): readonly string[] => [`events:${project}`],27 front: (): readonly string[] => ["front"],28 ledger: (project: ProjectName): readonly string[] => [`ledger:${project}`],8 unmodified linesmodified:apps/web/src/client/watch.ts+4 added
50 unmodified lines51 AskClosed: () => [...keys.project(project), ...keys.front()],52 AskOpened: () => [...keys.project(project), ...keys.front()],53 Claimed: () => keys.project(project),54 Decided: () => keys.project(project),55+ DiscussionPosted: ({ discussion }) => [56+ ...keys.discussion(project, discussion),57+ ...keys.project(project),58+ ],59 Judged: ({ ask }) => keys.ask(project, ask),60 Landed: () => [61 ...keys.project(project),62 ...keys.front(),76 unmodified linesmodified:apps/web/src/dev/front-page.ts+1 added
78 unmodified lines79 Decided: () => rows,80 Judged: () => rows,81 Landed: () => rows,82 Lapsed: ({ ask }) => withClaims(rows, keyOf(project, ask), -1),83+ DiscussionPosted: () => rows,84 LedgerAppended: () => rows,85 ProposalDrafted: () => rows,86 ProposalOpened: () => rows,87 Pushed: () => rows,204 unmodified linesmodified:apps/web/src/dev/handlers.ts+12 added
236 unmodified lines237 on(project, (api) => api.landing(who, sha))238 ),239 ledger: ({ project }) =>240 Effect.flatMap(caller, (who) => on(project, (api) => api.ledger(who))),241+ listDiscussions: ({ project }) =>242+ Effect.flatMap(caller, (who) =>243+ on(project, (api) => api.listDiscussions(who))244+ ),245 listAsks: ({ project }) =>246 Effect.flatMap(caller, (who) =>247 on(project, (api) => api.listAsks(who))248 ),26 unmodified lines275 openAsk: ({ project, ...input }) =>276 Effect.flatMap(person, (who) =>277 on(project, (api) => api.openAsk(who, input))278 ),279+ postDiscussion: ({ project, ...input }) =>280+ Effect.flatMap(person, (who) =>281+ on(project, (api) => api.postDiscussion(who, input))282+ ),283 projectPolicy: ({ project }) => on(project, (api) => api.policy()),284 proposeAsk: ({ project, ...input }) =>285 Effect.flatMap(person, (who) =>286 on(project, (api) => api.proposeAsk(who, input))20 unmodified lines307 on(project, (api) => api.showAsk(who, ask))308 ),309 showCommit: ({ at, project, sha }) =>310 code(project, (of) => commitOf(of, sha, Option.fromUndefinedOr(at))),311+ showDiscussion: ({ discussion, project }) =>312+ Effect.flatMap(caller, (who) =>313+ on(project, (api) => api.showDiscussion(who, discussion))314+ ),315 showProposal: ({ project, proposal }) =>316 Effect.flatMap(caller, (who) =>317 on(project, (api) => api.showProposal(who, proposal))318 ),67 unmodified linesmodified:apps/web/src/dev/seed.ts+31 added-5 removed
242 unmodified lines243 ask: AskId.make("add-months-clamp"),244 reason: "Its check pins a common year only; leap years need a case too.",245 });246 247+ // Two discussions: one open, one a maintainer turned into a proposal.248+ yield* at(14);249+250+ const talked = yield* api.postDiscussion(as(visitors.regular), {251+ body: "Weeks start on Monday in ISO 8601, but on Sunday in the US; which does parseISO assume?",252+ title: "Which day starts a week?",253+ });254+255+ yield* api.postDiscussion(as(decider), {256+ body: "ISO, always: a locale never changes what a date string means.",257+ discussion: talked.discussion.id,258+ });259+260+ yield* at(15);261+262+ const asked = yield* api.postDiscussion(as(visitors.proposer), {263+ body: "Could parseISO take week dates like 2026-W41-3 too?",264+ title: "ISO week dates",265+ });266+267+ yield* at(16);268+ yield* api.proposeAsk(as(decider), {269+ discussion: asked.discussion.id,270+ want: "parseISO reads an ISO week date to the day it names.",271+ });272+273 yield* Effect.forEach(274 DECLINED,275 (want, index) =>276 Effect.gen(function* () {251- yield* at(11 + index * 2);277+ yield* at(17 + index * 2);278 279 const { proposal } = yield* api.proposeAsk(as(visitors.regular), {280 want,281 });282 257- yield* at(12 + index * 2);283+ yield* at(18 + index * 2);284 285 const decision = yield* decisionOn(api, decider, proposal.id);286 287 yield* api.decide(as(decider), {8 unmodified lines296 return api;297 });298 299 const seedBurrow = Effect.flatMap(274- started(burrow.project, operator, burrow.files, 15),275- (api) => opened(api, burrowPeople.decider, burrow.asks, 17)300+ started(burrow.project, operator, burrow.files, 21),301+ (api) => opened(api, burrowPeople.decider, burrow.asks, 23)302 );303 278-const STRAY_MINUTE = 21;304+const STRAY_MINUTE = 27;305 306 export const seedEnd = devMinute(STRAY_MINUTE);307 308 const strayPush = (api: ProjectApi) =>37 unmodified linesmodified:apps/web/src/features/answer/subject.ts+1 added
18 unmodified lines19 Decided: () => [],20 Judged: ({ ask }) => [ask],21 Landed: () => [],22 Lapsed: ({ ask }) => [ask],23+ DiscussionPosted: () => [],24 LedgerAppended: () => [],25 ProposalDrafted: () => [],26 ProposalOpened: () => [],27 Pushed: ({ ask }) => [ask],117 unmodified linesadded:apps/web/src/features/discussion/discussion-view.tsx+112 added
1+import { Brand } from "@repo/brand";2+import type {3+ Discussion,4+ DiscussionPost,5+} from "@repo/protocol/domain/discussion";6+import type { ProjectName, ProposalId } from "@repo/protocol/ids";7+import type { DateTime } from "effect";8+import type { ReactNode } from "react";9+10+import { CommandLine } from "../shared/command.tsx";11+import { FactBlock } from "../shared/facts.tsx";12+import { HandleLink } from "../shared/handle.tsx";13+import { AppLink } from "../shared/link.tsx";14+import { Workspace } from "../shared/shell/workspace.tsx";15+import { When } from "../shared/time.tsx";16+import { replyCommand, STATE_LABEL } from "./discussions-view.tsx";17+18+const LINK = "decoration-rule underline hover:decoration-current";19+20+const proposalPath = (project: ProjectName, proposal: ProposalId) =>21+ `/${project}/proposals/${proposal}`;22+23+const Post = ({24+ now,25+ post,26+}: {27+ readonly now: DateTime.Utc;28+ readonly post: DiscussionPost;29+}) => (30+ <article31+ className="border-rule flex min-w-0 flex-col gap-2 border-b py-3"32+ data-post={post.by}33+ >34+ <p className="text-label text-muted-foreground">35+ <HandleLink handle={post.by} />36+ {" · "}37+ <When at={post.at} now={now} />38+ </p>39+ <p className="text-ui max-w-(--measure) [overflow-wrap:anywhere] whitespace-pre-wrap">40+ {post.body}41+ </p>42+ </article>43+);44+45+const Became = ({ discussion }: { readonly discussion: Discussion }) =>46+ discussion.proposal === undefined ? null : (47+ <p className="text-ui" data-became={discussion.proposal}>48+ {"A maintainer turned this discussion into "}49+ <AppLink50+ className={`text-mono font-mono ${LINK}`}51+ to={proposalPath(discussion.project, discussion.proposal)}52+ >53+ {discussion.proposal}54+ </AppLink>55+ , which expires unless a maintainer accepts it.56+ </p>57+ );58+59+const ThreadFacts = ({ discussion }: { readonly discussion: Discussion }) => (60+ <FactBlock label="This discussion">61+ {discussion.state === "open" ? (62+ <>63+ <p className="text-ui">64+ Reply from a terminal; anyone not denounced may. A maintainer may turn65+ the thread into a proposal with{" "}66+ <code className="text-mono font-mono">{`${Brand.cli} propose --discussion ${discussion.id}`}</code>67+ .68+ </p>69+ <CommandLine command={replyCommand(discussion)} numbered />70+ </>71+ ) : (72+ <p className="text-ui">73+ {discussion.state === "closed"74+ ? "This discussion is closed: it takes no more posts."75+ : "This discussion became a proposal: it takes no more posts."}76+ </p>77+ )}78+ </FactBlock>79+);80+81+export const DiscussionView = ({82+ discussion,83+ now,84+}: {85+ readonly discussion: Discussion;86+ readonly now: DateTime.Utc;87+}): ReactNode => (88+ <Workspace89+ facts={<ThreadFacts discussion={discussion} />}90+ factsHeading="This discussion"91+ meta={92+ <>93+ <code className="text-mono font-mono">{discussion.id}</code>94+ {" · opened by "}95+ <HandleLink handle={discussion.opener} />{" "}96+ <When at={discussion.openedAt} now={now} />97+ </>98+ }99+ state={100+ <span data-state={discussion.state}>{STATE_LABEL[discussion.state]}</span>101+ }102+ title={discussion.title}103+ variant="document"104+ >105+ <Became discussion={discussion} />106+ <div className="border-rule flex flex-col border-t" data-posts="">107+ {discussion.posts.map((post, index) => (108+ <Post key={index} now={now} post={post} />109+ ))}110+ </div>111+ </Workspace>112+);added:apps/web/src/features/discussion/discussions-view.tsx+115 added
1+import { Brand } from "@repo/brand";2+import type {3+ DiscussionListing,4+ DiscussionState,5+} from "@repo/protocol/domain/discussion";6+import type { ProjectName } from "@repo/protocol/ids";7+import type { DateTime } from "effect";8+import type { ReactNode } from "react";9+10+import { CommandLine } from "../shared/command.tsx";11+import { EmptyState } from "../shared/empty.tsx";12+import { FactBlock } from "../shared/facts.tsx";13+import { HandleLink } from "../shared/handle.tsx";14+import { AppLink } from "../shared/link.tsx";15+import { discussionPath } from "../shared/paths.ts";16+import { Workspace } from "../shared/shell/workspace.tsx";17+import { When } from "../shared/time.tsx";18+19+const LINK = "decoration-rule underline hover:decoration-current";20+21+const plural = (count: number, one: string, many: string) =>22+ `${count} ${count === 1 ? one : many}`;23+24+/** Every state reads as a word beside its mark, never by colour alone. */25+export const STATE_LABEL = {26+ closed: "Closed",27+ open: "Open",28+ proposed: "Became a proposal",29+} as const satisfies Record<DiscussionState, string>;30+31+export const openCommand = (project: ProjectName) =>32+ `${Brand.cli} discussion post --project ${project} --title "<title>" --body "<post>"`;33+34+export const replyCommand = (35+ listing: Pick<DiscussionListing, "id" | "project">36+) =>37+ `${Brand.cli} discussion post ${listing.id} --project ${listing.project} --body "<post>"`;38+39+const Row = ({40+ listing,41+ now,42+}: {43+ readonly listing: DiscussionListing;44+ readonly now: DateTime.Utc;45+}) => (46+ <li47+ className="border-rule flex min-w-0 flex-col gap-1 border-b py-3"48+ data-discussion={listing.id}49+ data-state={listing.state}50+ >51+ <AppLink52+ className={`text-ui font-medium ${LINK}`}53+ to={discussionPath(listing.project, listing.id)}54+ >55+ {listing.title}56+ </AppLink>57+ <p className="text-label text-muted-foreground flex flex-wrap gap-x-3">58+ <span>59+ <code className="text-mono font-mono">{listing.id}</code>60+ </span>61+ <span>62+ {"opened by "}63+ <HandleLink handle={listing.opener} />64+ </span>65+ <span>{plural(listing.posts, "post", "posts")}</span>66+ <span>67+ {"last post "}68+ <When at={listing.lastPostAt} now={now} />69+ </span>70+ <span>{STATE_LABEL[listing.state]}</span>71+ </p>72+ </li>73+);74+75+const PostFacts = ({ project }: { readonly project: ProjectName }) => (76+ <FactBlock label="How to post">77+ <p className="text-ui">78+ Anyone not denounced may open a thread or reply, from a terminal. A79+ discussion lands nothing itself; a maintainer may turn one into a80+ proposal.81+ </p>82+ <CommandLine command={openCommand(project)} numbered />83+ </FactBlock>84+);85+86+export const DiscussionsView = ({87+ discussions,88+ now,89+ project,90+}: {91+ readonly discussions: readonly DiscussionListing[];92+ readonly now: DateTime.Utc;93+ readonly project: ProjectName;94+}): ReactNode => (95+ <Workspace96+ count={plural(discussions.length, "discussion", "discussions")}97+ facts={<PostFacts project={project} />}98+ factsHeading="Discussions here"99+ title="Discussions"100+ variant="list"101+ >102+ {discussions.length === 0 ? (103+ <EmptyState104+ command={openCommand(project)}105+ title="No discussions yet. Open one from a terminal; anyone not denounced may."106+ />107+ ) : (108+ <ul className="border-rule flex flex-col border-t" data-discussions="">109+ {discussions.map((listing) => (110+ <Row key={listing.id} listing={listing} now={now} />111+ ))}112+ </ul>113+ )}114+ </Workspace>115+);modified:apps/web/src/features/project/project-header.tsx+1 added-1 removed
1 /**2 * A project's one header (ADR 0041): its name, posture, description, facts3- * and three actions, then its eight tabs. Every page of the project draws it3+ * and three actions, then its nine tabs. Every page of the project draws it4 * the same; only the current tab moves.5 */6 import { Brand } from "@repo/brand";7 import type { Handle, ProjectName } from "@repo/protocol/ids";340 unmodified linesmodified:apps/web/src/features/shared/shell/sections.ts+12 added-1 removed
1 unmodified line2 import { Option } from "effect";3 4 import { INBOX_PATH, segmentsOf } from "../paths.ts";5 6-/** A project's eight tabs (ADR 0041), in the header's order. */6+/** A project's nine tabs (ADR 0041, with Discussions), in the header's order. */7 export type ProjectTab =8 | "asks"9 | "code"10+ | "discussions"11 | "landings"12 | "overview"13 | "people"14 | "policy"30 unmodified lines45 label: "Proposals",46 tab: "proposals",47 to: `/${project}`,48 },49+ { label: "Discussions", tab: "discussions", to: `/${project}/discussions` },50 { hash: "who-decides", label: "People", tab: "people", to: `/${project}` },51 { label: "Policy", tab: "policy", to: `/${project}/people` },52 { label: "Visibility", tab: "visibility", to: `/${project}/visibility` },53 ];5 unmodified lines59 blob: "code",60 commit: "code",61 commits: "code",62 decisions: "asks",63+ discussions: "discussions",64 people: "policy",65 proposals: "proposals",66 raw: "code",67 refs: "code",4 unmodified lines72 73 /** A crumb names the page itself, which may be narrower than its tab. */74 type PageSection =75 | "code"76+ | "discussions"77 | "landings"78 | "overview"79 | "people"80 | "refs"1 unmodified line82 83 const PAGE_TO = (project: string) =>84 ({85 code: `/${project}/tree/main`,86+ discussions: `/${project}/discussions`,87 landings: `/${project}/commits/main`,88 overview: `/${project}`,89 people: `/${project}/people`,90 refs: `/${project}/refs`,5 unmodified lines96 asks: "overview",97 blob: "code",98 commit: "landings",99 commits: "landings",100+ discussions: "discussions",101 people: "people",102 refs: "refs",103 tree: "code",104 visibility: "visibility",70 unmodified lines175 }176 177 const SECTION_LABEL = {178 code: "Code",179+ discussions: "Discussions",180 landings: "Landings",181 overview: "Asks",182 people: "Policy",183 refs: "Refs",52 unmodified lines236 commit: (project: string, sha: string) => [237 ...projectCrumbs(project, "landings", true),238 { label: sha.slice(0, 7), mono: true },239 ],240+ discussions: (project: string, discussion: string) => [241+ ...projectCrumbs(project, "discussions", true),242+ { label: discussion, mono: true },243+ ],244 decisions: (project: string, decision: string) => [245 { label: project, to: `/${project}` },246 { label: "Inbox", to: INBOX_PATH },247 { label: decision, mono: true },53 unmodified linesmodified:apps/web/src/features/shared/ask-progress.ts+1 added
97 unmodified lines98 Landed: constVoid,99 Lapsed: ({ ask }) => {100 change(ask, startedOver);101 },102+ DiscussionPosted: constVoid,103 LedgerAppended: constVoid,104 ProposalDrafted: constVoid,105 ProposalOpened: constVoid,106 Pushed: ({ ask, at, head }) => {109 unmodified linesmodified:apps/web/src/features/shared/paths.ts+9 added
1 import type {2 AskId,3 DecisionId,4+ DiscussionId,5 Handle,6 ProjectName,7 } from "@repo/protocol/ids";8 import { Result } from "effect";30 unmodified lines39 40 /** A handle is URL-safe by its schema. */41 export const personPath = (handle: Handle) => `/people/${handle}`;42 43+export const discussionsPath = (project: ProjectName) =>44+ `/${project}/discussions`;45+46+export const discussionPath = (47+ project: ProjectName,48+ discussion: DiscussionId49+) => `/${project}/discussions/${discussion}`;50+51 /** A project's Visibility tab (ADR 0041), and the regions on it a link may open. */52 export const visibilityPath = (project: ProjectName) =>53 `/${project}/visibility`;54 31 unmodified linesadded:apps/web/src/routes/$owner/$project/discussions/$discussion.tsx+120 added
1+import { useAtomMount, useAtomValue } from "@effect/atom-react";2+import { Client, ShowDiscussion } from "@repo/protocol/contracts";3+import { DiscussionId, ProjectName } from "@repo/protocol/ids";4+import { createFileRoute, notFound } from "@tanstack/react-router";5+import { createServerFn } from "@tanstack/react-start";6+import { env } from "cloudflare:workers";7+import { DateTime, Effect, Option, Schema } from "effect";8+import { AsyncResult } from "effect/reactivity";9+10+import { discussionAtom } from "../../../../client/discussion.ts";11+import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12+import { watchAtom } from "../../../../client/watch.ts";13+import { NotFoundView } from "../../../../features/ask/refused.tsx";14+import { DiscussionView } from "../../../../features/discussion/discussion-view.tsx";15+import { pageHead } from "../../../../features/shared/head.ts";16+import { notFoundFor, Refusals } from "../../../../features/shared/refusals.ts";17+import { branchPage } from "../../../../server/cache-headers.ts";18+import { serverClient } from "../../../../server/client.ts";19+20+type Shown = typeof ShowDiscussion.successSchema.Type;21+22+export const readDiscussion = (name: string, id: string) =>23+ Effect.gen(function* () {24+ const project = yield* Schema.decodeEffect(ProjectName)(name).pipe(25+ Effect.mapError(() => notFound())26+ );27+28+ const discussion = yield* Schema.decodeEffect(DiscussionId)(id).pipe(29+ Effect.mapError(() => notFound())30+ );31+32+ const client = yield* Client;33+34+ const shown = yield* client.showDiscussion({ discussion, project }).pipe(35+ Effect.catchTags({36+ UnknownDiscussion: notFoundFor,37+ UnknownProject: notFoundFor,38+ })39+ );40+41+ return yield* Schema.encodeEffect(ShowDiscussion.successSchema)(shown);42+ });43+44+const discussionPage = createServerFn({ method: "GET" })45+ .validator(46+ (params: { readonly discussion: string; readonly project: string }) =>47+ params48+ )49+ .handler(({ data }) =>50+ Effect.runPromise(51+ readDiscussion(data.project, data.discussion).pipe(52+ Effect.provide(serverClient(env))53+ )54+ )55+ );56+57+const FreshDiscussion = ({58+ project,59+ read,60+}: {61+ readonly project: ProjectName;62+ readonly read: Shown;63+}) => {64+ useAtomMount(watchAtom(project));65+66+ const { discussion } = Option.getOrElse(67+ AsyncResult.value(68+ useAtomValue(discussionAtom(project)(read.discussion.id))69+ ),70+ () => read71+ );72+73+ return <DiscussionView discussion={discussion} now={DateTime.nowUnsafe()} />;74+};75+76+const DiscussionPage = () => {77+ const read = Schema.decodeSync(ShowDiscussion.successSchema)(78+ Route.useLoaderData()79+ );80+81+ const { id, project } = read.discussion;82+83+ return (84+ <SeededAtoms85+ id={`${project}/${id}`}86+ seeds={[seedSuccess(discussionAtom(project)(id), read)]}87+ >88+ <FreshDiscussion project={project} read={read} />89+ </SeededAtoms>90+ );91+};92+93+const decodeRefusals = Schema.decodeUnknownOption(Refusals);94+95+const Unknown = ({ data }: { readonly data?: unknown }) => (96+ <NotFoundView97+ nothing="Nothing is at this address: a project's name is lowercase words joined by single dashes, and a discussion's id reads disc- and six digits."98+ refusals={Option.getOrUndefined(decodeRefusals(data))}99+ title="No such discussion"100+ />101+);102+103+export const Route = createFileRoute(104+ "/$owner/$project/discussions/$discussion"105+)({106+ staticData: { shell: "project" },107+ loader: ({ params }) => discussionPage({ data: params }),108+ headers: () => branchPage,109+ head: ({ loaderData, params: { discussion, project } }) =>110+ pageHead(111+ loaderData === undefined112+ ? { title: `${discussion} · ${project}` }113+ : {114+ description: loaderData.discussion.title,115+ title: `${loaderData.discussion.title} · ${project}`,116+ }117+ ),118+ component: DiscussionPage,119+ notFoundComponent: Unknown,120+});added:apps/web/src/routes/$owner/$project/discussions/index.tsx+102 added
1+import { useAtomMount, useAtomValue } from "@effect/atom-react";2+import { Client, ListDiscussions } from "@repo/protocol/contracts";3+import { ProjectName } from "@repo/protocol/ids";4+import { createFileRoute, notFound } from "@tanstack/react-router";5+import { createServerFn } from "@tanstack/react-start";6+import { env } from "cloudflare:workers";7+import { DateTime, Effect, Option, Schema } from "effect";8+import { AsyncResult } from "effect/reactivity";9+10+import { discussionsAtom } from "../../../../client/discussion.ts";11+import { SeededAtoms, seedSuccess } from "../../../../client/seeded.ts";12+import { watchAtom } from "../../../../client/watch.ts";13+import { DiscussionsView } from "../../../../features/discussion/discussions-view.tsx";14+import { UnknownProjectView } from "../../../../features/project/unknown-project.tsx";15+import { pageHead } from "../../../../features/shared/head.ts";16+import { branchPage } from "../../../../server/cache-headers.ts";17+import { serverClient } from "../../../../server/client.ts";18+19+type Listed = typeof ListDiscussions.successSchema.Type;20+21+export const readDiscussions = (name: string) =>22+ Effect.gen(function* () {23+ const project = yield* Schema.decodeEffect(ProjectName)(name).pipe(24+ Effect.mapError(() => notFound())25+ );26+27+ const client = yield* Client;28+29+ const listed = yield* client30+ .listDiscussions({ project })31+ .pipe(Effect.catchTag("UnknownProject", () => Effect.fail(notFound())));32+33+ return {34+ listed: yield* Schema.encodeEffect(ListDiscussions.successSchema)(listed),35+ project,36+ };37+ });38+39+const discussionsPage = createServerFn({ method: "GET" })40+ .validator((name: string) => name)41+ .handler(({ data }) =>42+ Effect.runPromise(43+ readDiscussions(data).pipe(Effect.provide(serverClient(env)))44+ )45+ );46+47+const FreshDiscussions = ({48+ project,49+ read,50+}: {51+ readonly project: ProjectName;52+ readonly read: Listed;53+}) => {54+ useAtomMount(watchAtom(project));55+56+ const { discussions } = Option.getOrElse(57+ AsyncResult.value(useAtomValue(discussionsAtom(project))),58+ () => read59+ );60+61+ return (62+ <DiscussionsView63+ discussions={discussions}64+ now={DateTime.nowUnsafe()}65+ project={project}66+ />67+ );68+};69+70+const DiscussionsPage = () => {71+ const { listed, project } = Route.useLoaderData();72+ const read = Schema.decodeSync(ListDiscussions.successSchema)(listed);73+ const name = ProjectName.make(project);74+75+ return (76+ <SeededAtoms77+ id={`${name}/discussions`}78+ seeds={[seedSuccess(discussionsAtom(name), read)]}79+ >80+ <FreshDiscussions project={name} read={read} />81+ </SeededAtoms>82+ );83+};84+85+const Unknown = () => {86+ const { project } = Route.useParams();87+88+ return <UnknownProjectView name={project} />;89+};90+91+export const Route = createFileRoute("/$owner/$project/discussions/")({92+ staticData: { shell: "project" },93+ loader: ({ params }) => discussionsPage({ data: params.project }),94+ headers: () => branchPage,95+ head: ({ params: { project } }) =>96+ pageHead({97+ title: `Discussions · ${project}`,98+ description: `${project}'s discussions: public threads that land nothing themselves.`,99+ }),100+ component: DiscussionsPage,101+ notFoundComponent: Unknown,102+});added:apps/web/test/discussions.test.tsx+273 added
1+import { describe, expect, it } from "@effect/vitest";2+import { Brand } from "@repo/brand";3+import { Client, Contracts } from "@repo/protocol/contracts";4+import {5+ Discussion,6+ DiscussionListing,7+} from "@repo/protocol/domain/discussion";8+import { DiscussionId, ProjectName } from "@repo/protocol/ids";9+import { UnknownDiscussion, UnknownProject } from "@repo/protocol/refusal";10+import { asTester, unanswered } from "@repo/protocol/testing";11+import { isNotFound } from "@tanstack/react-router";12+import { DateTime, Effect, Layer, Schema } from "effect";13+import { RpcTest } from "effect/rpc";14+15+import { DiscussionView } from "../src/features/discussion/discussion-view.tsx";16+import { DiscussionsView } from "../src/features/discussion/discussions-view.tsx";17+import {18+ crumbsFor,19+ projectSections,20+ projectTabOf,21+} from "../src/features/shared/shell/sections.ts";22+import { readDiscussion } from "../src/routes/$owner/$project/discussions/$discussion.tsx";23+import { readDiscussions } from "../src/routes/$owner/$project/discussions/index.tsx";24+import { inOrder, markupOf, plainText } from "./ask-fixtures.ts";25+import { elementWith, mainOf } from "./records.ts";26+import { renderAt } from "./render.tsx";27+28+const datekit = ProjectName.make("oscabriel/datekit");29+30+const now = DateTime.makeUnsafe("2026-10-07T13:00:00Z");31+32+const first = DiscussionId.make("disc-000001");33+34+const second = DiscussionId.make("disc-000002");35+36+const open = Schema.decodeSync(Discussion)({37+ id: "disc-000001",38+ openedAt: "2026-10-07T12:00:00.000Z",39+ opener: "wren",40+ posts: [41+ {42+ at: "2026-10-07T12:00:00.000Z",43+ body: "Weeks start on Monday in ISO 8601; which does parseISO assume?",44+ by: "wren",45+ },46+ {47+ at: "2026-10-07T12:30:00.000Z",48+ body: "ISO, always.",49+ by: "ines-v",50+ },51+ ],52+ project: "oscabriel/datekit",53+ state: "open",54+ title: "Which day starts a week?",55+});56+57+const proposed = Schema.decodeSync(Discussion)({58+ id: "disc-000002",59+ openedAt: "2026-10-07T12:10:00.000Z",60+ opener: "tove",61+ posts: [62+ {63+ at: "2026-10-07T12:10:00.000Z",64+ body: "Could parseISO take week dates too?",65+ by: "tove",66+ },67+ ],68+ project: "oscabriel/datekit",69+ proposal: "prop-000001",70+ state: "proposed",71+ title: "ISO week dates",72+});73+74+const listings = Schema.decodeSync(Schema.Array(DiscussionListing))([75+ {76+ id: "disc-000001",77+ lastPostAt: "2026-10-07T12:30:00.000Z",78+ openedAt: "2026-10-07T12:00:00.000Z",79+ opener: "wren",80+ posts: 2,81+ project: "oscabriel/datekit",82+ state: "open",83+ title: "Which day starts a week?",84+ },85+ {86+ id: "disc-000002",87+ lastPostAt: "2026-10-07T12:10:00.000Z",88+ openedAt: "2026-10-07T12:10:00.000Z",89+ opener: "tove",90+ posts: 1,91+ project: "oscabriel/datekit",92+ proposal: "prop-000001",93+ state: "proposed",94+ title: "ISO week dates",95+ },96+]);97+98+const commandsOf = (markup: string) =>99+ [100+ ...markup.matchAll(/<code\b[^>]*select-all[^>]*>(?<line>.*?)<\/code>/gsu),101+ ].map((found) =>102+ plainText((found.groups?.line ?? "").replaceAll(/ \\\n\s*/gu, " ")).trim()103+ );104+105+const list = (106+ <DiscussionsView discussions={listings} now={now} project={datekit} />107+);108+109+describe("a project's discussions page", () => {110+ it("lists each thread by title, opener, posts, last post and state, each linked to its page", () => {111+ const markup = mainOf(markupOf(list));112+ const rows = elementWith(markup, "data-discussions");113+114+ expect(markup).toMatch(/<h1\b[^>]*>Discussions<\/h1>/u);115+ expect(rows).toContain('href="/oscabriel/datekit/discussions/disc-000001"');116+ expect(rows).toContain('href="/oscabriel/datekit/discussions/disc-000002"');117+ expect(118+ inOrder(plainText(rows), [119+ "Which day starts a week?",120+ "wren",121+ "2 posts",122+ "30 min ago",123+ "Open",124+ "ISO week dates",125+ "tove",126+ "1 post",127+ "Became a proposal",128+ ])129+ ).toBeTruthy();130+ });131+132+ it("shows the command to open a thread, copyable, and no form", () => {133+ const markup = markupOf(list);134+135+ expect(commandsOf(markup)).toContain(136+ `${Brand.cli} discussion post --project oscabriel/datekit --title "<title>" --body "<post>"`137+ );138+ expect(markup).not.toMatch(/<form\b|<textarea\b/u);139+ });140+141+ it("says so, with the command, when there are none", () => {142+ const markup = markupOf(143+ <DiscussionsView discussions={[]} now={now} project={datekit} />144+ );145+146+ expect(plainText(mainOf(markup))).toContain("No discussions yet");147+ expect(markup).not.toContain("data-discussions");148+ });149+150+ it.effect("is the Discussions tab, with its crumbs", () =>151+ Effect.gen(function* () {152+ const markup = yield* renderAt("/oscabriel/datekit/discussions", list);153+ const crumbs = elementWith(markup, 'aria-label="Breadcrumb"');154+155+ expect(plainText(crumbs)).toContain("Discussions");156+ expect(157+ projectSections("oscabriel/datekit").find(158+ ({ tab }) => tab === "discussions"159+ )160+ ).toStrictEqual({161+ label: "Discussions",162+ tab: "discussions",163+ to: "/oscabriel/datekit/discussions",164+ });165+ expect([166+ projectTabOf("/oscabriel/datekit/discussions"),167+ projectTabOf("/oscabriel/datekit/discussions/disc-000001"),168+ ]).toStrictEqual(["discussions", "discussions"]);169+ expect(170+ crumbsFor("/oscabriel/datekit/discussions/disc-000001")171+ ).toStrictEqual([172+ { label: "oscabriel/datekit", to: "/oscabriel/datekit" },173+ { label: "Discussions", to: "/oscabriel/datekit/discussions" },174+ { label: "disc-000001", mono: true },175+ ]);176+ })177+ );178+});179+180+describe("a discussion's page", () => {181+ it("shows the posts in order, each by its person and time, and the reply command while open", () => {182+ const markup = markupOf(<DiscussionView discussion={open} now={now} />);183+ const main = mainOf(markup);184+ const posts = elementWith(main, "data-posts");185+186+ expect(main).toMatch(/<h1\b[^>]*>Which day starts a week\?<\/h1>/u);187+ expect(188+ inOrder(plainText(posts), [189+ "wren",190+ "1 h ago",191+ "Weeks start on Monday in ISO 8601; which does parseISO assume?",192+ "ines-v",193+ "30 min ago",194+ "ISO, always.",195+ ])196+ ).toBeTruthy();197+ expect(posts).toMatch(/<a\b[^>]*href="\/people\/wren"[^>]*>wren<\/a>/u);198+ expect(commandsOf(markup)).toContain(199+ `${Brand.cli} discussion post disc-000001 --project oscabriel/datekit --body "<post>"`200+ );201+ expect(markup).not.toMatch(/<form\b|<textarea\b/u);202+ });203+204+ it("names the proposal a maintainer turned it into, linked, and offers no reply", () => {205+ const markup = markupOf(<DiscussionView discussion={proposed} now={now} />);206+207+ const became = elementWith(mainOf(markup), "data-became");208+209+ expect(became).toMatch(210+ /<a\b[^>]*href="\/oscabriel\/datekit\/proposals\/prop-000001"[^>]*>prop-000001<\/a>/u211+ );212+ expect(plainText(markup)).toContain("Became a proposal");213+ expect(plainText(markup)).toContain("takes no more posts");214+ expect(commandsOf(markup)).toStrictEqual([]);215+ });216+});217+218+const platformOf = () =>219+ Layer.effect(Client, RpcTest.makeClient(Contracts)).pipe(220+ Layer.provide(221+ Layer.mergeAll(222+ unanswered,223+ Contracts.toLayerHandler("listDiscussions", ({ project }) =>224+ project === datekit225+ ? Effect.succeed({ discussions: listings })226+ : Effect.fail(new UnknownProject({ project }))227+ ),228+ Contracts.toLayerHandler(229+ "showDiscussion",230+ ({ discussion, project }) => {231+ if (project !== datekit) {232+ return Effect.fail(new UnknownProject({ project }));233+ }234+235+ return discussion === first236+ ? Effect.succeed({ discussion: open })237+ : Effect.fail(new UnknownDiscussion({ discussion }));238+ }239+ ),240+ asTester241+ )242+ )243+ );244+245+describe("the discussion reads", () => {246+ it.effect("list a project's discussions and show one", () =>247+ Effect.gen(function* () {248+ const listed = yield* readDiscussions("oscabriel/datekit");249+ const shown = yield* readDiscussion("oscabriel/datekit", "disc-000001");250+251+ expect(listed.listed.discussions.map(({ id }) => id)).toStrictEqual([252+ "disc-000001",253+ "disc-000002",254+ ]);255+ expect(shown.discussion.id).toBe("disc-000001");256+ }).pipe(Effect.provide(platformOf()))257+ );258+259+ it.effect(260+ "are not-founds for an unknown project, discussion or address",261+ () =>262+ Effect.gen(function* () {263+ const failed = yield* Effect.all([264+ Effect.flip(readDiscussions("oscabriel/no-such-project")),265+ Effect.flip(readDiscussion("oscabriel/datekit", second)),266+ Effect.flip(readDiscussion("oscabriel/datekit", "not-an-id")),267+ Effect.flip(readDiscussions("Not_A-Project")),268+ ]);269+270+ expect(failed.map(isNotFound)).toStrictEqual([true, true, true, true]);271+ }).pipe(Effect.provide(platformOf()))272+ );273+});modified:apps/web/test/nav.test.tsx+2 added-1 removed
24 unmodified lines25 { href: "/oscabriel/datekit/tree/main", text: "Code" },26 { href: "/oscabriel/datekit#open-asks", text: "Asks" },27 { href: "/oscabriel/datekit#recent-landings", text: "Landings" },28 { href: "/oscabriel/datekit#proposals", text: "Proposals" },29+ { href: "/oscabriel/datekit/discussions", text: "Discussions" },30 { href: "/oscabriel/datekit#who-decides", text: "People" },31 { href: "/oscabriel/datekit/people", text: "Policy" },32 { href: "/oscabriel/datekit/visibility", text: "Visibility" },33 ].map((link) => ({ current: link.text === current, ...link }));34 35 describe("a project's tabs", () => {35- it("links all eight, in ADR 0041's order, and marks only the page being read", () => {36+ it("links all nine, in ADR 0041's order, and marks only the page being read", () => {37 const markup = renderToStaticMarkup(38 <ProjectTabs current="code" project={datekit} />39 );40 123 unmodified linesmodified:apps/web/test/project.test.tsx+1 added
128 unmodified lines129 "Code",130 "Asks",131 "Landings",132 "Proposals",133+ "Discussions",134 "People",135 "Policy",136 "Visibility",137 ];1358 unmodified linesmodified:packages/agent-kit/test/docs.test.ts+1 added-1 removed
184 unmodified lines185 "AskClosed",186 "AskOpened",187 "Claimed",188 "Decided",189- "DiscussionPosted",189+ "DiscussionPosted",190 "Judged",191 "Landed",192 "Lapsed",193 "LedgerAppended",66 unmodified linesmodified:packages/project/src/attention/discussions.ts+5 added-1 removed
1 import type { Discussion } from "@repo/protocol/domain/discussion";2 import type { DiscussionId, ProjectName, ProposalId } from "@repo/protocol/ids";3 import type { Person } from "@repo/protocol/principal";4-import { CapReached, Denounced, DiscussionClosed } from "@repo/protocol/refusal";4+import {5+ CapReached,6+ Denounced,7+ DiscussionClosed,8+} from "@repo/protocol/refusal";9 import { Array, Data, Option, Result } from "effect";10 import type { DateTime } from "effect";11 12 import { ProjectEventInput } from "../events.ts";126 unmodified linesmodified:packages/project/src/deciders.ts+1 added-5 removed
94 unmodified lines95 expireDecisions,96 openDecision,97 } from "./attention/decisions.ts";98 import type { Decided } from "./attention/decisions.ts";99-import {100- DiscussionCommand,101- post,102- promoted,103-} from "./attention/discussions.ts";99+import { DiscussionCommand, post, promoted } from "./attention/discussions.ts";100 import { AttentionEffect, platformHandle } from "./attention/effects.ts";101 import {102 draft,103 DraftCommand,2278 unmodified linesmodified:packages/project/src/project.ts+1 added-1 removed
97 unmodified lines98 import type { Evidence } from "@repo/protocol/domain/common";99 import type { AgentTrailer, Credit } from "@repo/protocol/domain/credit";100 import { DecisionSubject } from "@repo/protocol/domain/decision";101 import type { Choice, Decision } from "@repo/protocol/domain/decision";102+import type { Discussion } from "@repo/protocol/domain/discussion";103 import { ProjectEvent } from "@repo/protocol/domain/event";104 import type { AskKind } from "@repo/protocol/domain/kind";105 import { LandingView } from "@repo/protocol/domain/landing";106 import { Outcome } from "@repo/protocol/domain/outcome";107 import type { StageName } from "@repo/protocol/domain/outcome";108 import type { ImportSource, PublicPolicy } from "@repo/protocol/domain/policy";109 import { Policy } from "@repo/protocol/domain/policy";109-import type { Discussion } from "@repo/protocol/domain/discussion";110 import type { Proposal } from "@repo/protocol/domain/proposal";111 import {112 AskId,113 CommitSha,5462 unmodified linesmodified:packages/project/test/discussions.test.ts+80 added-69 removed
225 unmodified lines226 const promoted = Effect.flatMap(made, promoting).pipe(227 Effect.provide(world)228 );229 230- it.effect("take a thread from anyone not denounced, and a reply from them too", () =>231- Effect.map(talked, (run) => {232- expect(run.opened.discussion).toMatchObject({233- id: first,234- opener: Handle.make("dave"),235- project,236- state: "open",237- title: "Which day starts a week?",238- });239- expect(run.opened.discussion.posts).toHaveLength(1);240- expect(241- run.replied.discussion.posts.map(({ body, by }) => [by, body])242- ).toStrictEqual([243- ["dave", "Weeks start on Monday in ISO 8601; which does parse assume?"],244- ["carol", "ISO, always."],245- ]);246- // A thread opened with a title alone reads the title as its first post.247- expect(248- run.titleOnly.discussion.posts.map(({ body }) => body)249- ).toStrictEqual(["Does format take a locale?"]);250- expect(run.refused).toStrictEqual({251- erinOpens: new Denounced({}),252- erinReplies: new Denounced({}),253- nowhere: new UnknownDiscussion({ discussion: unknown }),254- });255- })230+ it.effect(231+ "take a thread from anyone not denounced, and a reply from them too",232+ () =>233+ Effect.map(talked, (run) => {234+ expect(run.opened.discussion).toMatchObject({235+ id: first,236+ opener: Handle.make("dave"),237+ project,238+ state: "open",239+ title: "Which day starts a week?",240+ });241+ expect(run.opened.discussion.posts).toHaveLength(1);242+ expect(243+ run.replied.discussion.posts.map(({ body, by }) => [by, body])244+ ).toStrictEqual([245+ [246+ "dave",247+ "Weeks start on Monday in ISO 8601; which does parse assume?",248+ ],249+ ["carol", "ISO, always."],250+ ]);251+ // A thread opened with a title alone reads the title as its first post.252+ expect(253+ run.titleOnly.discussion.posts.map(({ body }) => body)254+ ).toStrictEqual(["Does format take a locale?"]);255+ expect(run.refused).toStrictEqual({256+ erinOpens: new Denounced({}),257+ erinReplies: new Denounced({}),258+ nowhere: new UnknownDiscussion({ discussion: unknown }),259+ });260+ })261 );262 263+ it.effect(264+ "list newest post first with the posts counted, show one whole, and tell each post",258- it.effect("list newest post first with the posts counted, show one whole, and tell each post", () =>259- Effect.map(talked, (run) => {260- expect(run.shown.discussion).toStrictEqual(run.replied.discussion);261- expect(262- run.listed.discussions.map(({ id, posts, state }) => [263- id,264- posts,265- state,266- ])267- ).toStrictEqual([268- ["disc-000002", 1, "open"],269- ["disc-000001", 2, "open"],270- ]);271- expect(272- run.events.flatMap(({ event }) =>273- ProjectEvent.guards.DiscussionPosted(event)274- ? [[event.discussion, event.by]]275- : []276- )277- ).toStrictEqual([278- ["disc-000001", "dave"],279- ["disc-000001", "carol"],280- ["disc-000002", "dave"],281- ]);282- })265+ () =>266+ Effect.map(talked, (run) => {267+ expect(run.shown.discussion).toStrictEqual(run.replied.discussion);268+ expect(269+ run.listed.discussions.map(({ id, posts, state }) => [270+ id,271+ posts,272+ state,273+ ])274+ ).toStrictEqual([275+ ["disc-000002", 1, "open"],276+ ["disc-000001", 2, "open"],277+ ]);278+ expect(279+ run.events.flatMap(({ event }) =>280+ ProjectEvent.guards.DiscussionPosted(event)281+ ? [[event.discussion, event.by]]282+ : []283+ )284+ ).toStrictEqual([285+ ["disc-000001", "dave"],286+ ["disc-000001", "carol"],287+ ["disc-000002", "dave"],288+ ]);289+ })290 );291 292 it.effect("become a proposal only by a maintainer", () =>293 Effect.map(promoted, (run) => {9 unmodified lines303 });304 })305 );306 307+ it.effect(308+ "once proposed, take no more posts and no second proposal, and are kept so",300- it.effect("once proposed, take no more posts and no second proposal, and are kept so", () =>301- Effect.map(promoted, (run) => {302- expect(run.closed).toStrictEqual({303- again: new DiscussionClosed({ discussion: first }),304- reply: new DiscussionClosed({ discussion: first }),305- });306- expect(run.stored).toStrictEqual([run.after.discussion]);307- })309+ () =>310+ Effect.map(promoted, (run) => {311+ expect(run.closed).toStrictEqual({312+ again: new DiscussionClosed({ discussion: first }),313+ reply: new DiscussionClosed({ discussion: first }),314+ });315+ expect(run.stored).toStrictEqual([run.after.discussion]);316+ })317 );318 }319 );320 321 describe("the cap on open discussions", () => {322+ it.effect(323+ "holds a person the project has not vouched for to twenty, and a vouched one to none",313- it.effect("holds a person the project has not vouched for to twenty, and a vouched one to none", () =>314- Effect.gen(function* () {315- const run = yield* Effect.flatMap(made, filling);324+ () =>325+ Effect.gen(function* () {326+ const run = yield* Effect.flatMap(made, filling);327 317- expect(run.daveAtCap).toStrictEqual(318- new CapReached({ cap: DISCUSSIONS_PER_PERSON, limit: "discussions" })319- );320- // The cap is on threads held open, not on posts.321- expect(run.daveReplies.discussion.posts).toHaveLength(2);322- expect(run.carolBeyond).toBe("allowed");323- }).pipe(Effect.provide(worldOf(scenario, "memory")))328+ expect(run.daveAtCap).toStrictEqual(329+ new CapReached({ cap: DISCUSSIONS_PER_PERSON, limit: "discussions" })330+ );331+ // The cap is on threads held open, not on posts.332+ expect(run.daveReplies.discussion.posts).toHaveLength(2);333+ expect(run.carolBeyond).toBe("allowed");334+ }).pipe(Effect.provide(worldOf(scenario, "memory")))335 );336 });modified:packages/protocol/test/fixtures/contracts.json+33 added-104 removed
50 unmodified lines51 "by": "alice",52 "choice": "accept",53 "note": "Worth it."54 },55- "deciders": [56- "alice"57- ],55+ "deciders": ["alice"],56 "default": "decline",57 "evidence": [58 {59 "href": "https://example.com/7",49 unmodified lines109 {110 "key": "PAYMENTS_KEY",111 "required": true,112 "sensitive": true,115- "tags": [116- "payments"117- ],113+ "tags": ["payments"],114 "value": {115 "setAt": "2026-10-07T12:00:00.000Z",116 "setBy": "alice"117 }41 unmodified lines159 },160 "success": {161 "proposal": {162 "expiresAt": "2026-10-21T12:00:00.000Z",167- "files": [168- "config/asks/iso-week.ask.ts"169- ],163+ "files": ["config/asks/iso-week.ask.ts"],164 "id": "prop-000001",165 "openedAt": "2026-10-07T12:00:00.000Z",166 "project": "oscabriel/datekit",167 "proposer": "dave",46 unmodified lines214 "entries": [215 {216 "ask": {217 "ask": "iso-week",224- "blockedBy": [225- "drop-moment"226- ],218+ "blockedBy": ["drop-moment"],219 "claimed": false,220 "kind": "fix",221 "reserve": "newcomers",222 "territory": "@datekit/parse",140 unmodified lines363 "success": {364 "asks": [365 {366 "ask": "iso-week",375- "blockedBy": [376- "drop-moment"377- ],367+ "blockedBy": ["drop-moment"],368 "claimed": false,369 "kind": "fix",370 "reserve": "newcomers",371 "territory": "@datekit/parse",8 unmodified lines380 "project": "oscabriel/datekit"381 },382 "success": {383 "at": "1111111111111111111111111111111111111111",394- "paths": [395- "README.md",396- "src/parse/iso.ts"397- ],384+ "paths": ["README.md", "src/parse/iso.ts"],385 "truncated": false386 }387 },388 "listProjects": {167 unmodified lines556 "tree": "5555555555555555555555555555555555555555",557 "verifier": "platform"558 }559 },573- "parents": [574- "1111111111111111111111111111111111111111"575- ],560+ "parents": ["1111111111111111111111111111111111111111"],561 "sha": "4444444444444444444444444444444444444444",562 "subject": "Parse ISO week dates",563 "trailers": [564 {26 unmodified lines591 "ask": {592 "askedBy": "alice",593 "blockedBy": [],594 "brief": {610- "context": [611- "ISO 8601 weeks start on Monday."612- ],595+ "context": ["ISO 8601 weeks start on Monday."],596 "current": "Week 1 of 2027 parses as week 53 of 2026.",614- "outOfScope": [615- "Locale-specific weeks"616- ],617- "terms": [618- "ISO week"619- ],597+ "outOfScope": ["Locale-specific weeks"],598+ "terms": ["ISO week"],599 "want": "An ISO week date parses to the Monday of that week."600 },601 "check": {602 "_tag": "RedThenGreen",9 unmodified lines612 "reserve": "newcomers",613 "state": "open",614 "territory": {615 "module": "@datekit/parse",637- "paths": [638- "packages/parse/**"639- ],640- "publicFiles": [641- "packages/parse/src/index.ts"642- ]616+ "paths": ["packages/parse/**"],617+ "publicFiles": ["packages/parse/src/index.ts"]618 }619 },620 "landed": "4444444444444444444444444444444444444444"621 }19 unmodified lines641 "warnAfterMs": 7200000642 },643 "deciders": [644 {670- "handles": [671- "alice"672- ],645+ "handles": ["alice"],646 "paths": "**"647 }648 ],649 "judge": {677- "paths": [678- "config/**",679- ".env.schema"680- ],681- "pointers": [682- "package.json#/scripts"683- ]650+ "paths": ["config/**", ".env.schema"],651+ "pointers": ["package.json#/scripts"]652 },653 "kinds": [654 {655 "checkKind": "redThenGreen",1 unmodified line657 "finish": "optional",658 "name": "fix",659 "oneWay": false,660 "race": 1,693- "requires": [694- "want",695- "check",696- "territory"697- ],661+ "requires": ["want", "check", "territory"],662 "strength": "assertion"663 }664 ],665 "modules": [666 {667 "module": "@datekit/parse",704- "paths": [705- "packages/parse/**"706- ],707- "publicFiles": [708- "packages/parse/src/index.ts"709- ]668+ "paths": ["packages/parse/**"],669+ "publicFiles": ["packages/parse/src/index.ts"]670 }671 ],672 "ratchets": [673 {17 unmodified lines691 },692 "doctor": "bun run doctor",693 "image": "checker:default",694 "setup": "bun install --frozen-lockfile --ignore-scripts",735- "setupEgress": [736- "registry.npmjs.org"737- ],695+ "setupEgress": ["registry.npmjs.org"],696 "test": "bun test {path}"697 },698 "source": "config",699 "vouch": {11 unmodified lines711 "note": "spam"712 }713 ],714 "weakening": {757- "markers": [758- ".skip(",759- "@ts-ignore"760- ]715+ "markers": [".skip(", "@ts-ignore"]716 }717 }718 }719 },14 unmodified lines734 },735 "success": {736 "proposal": {737 "expiresAt": "2026-10-21T12:00:00.000Z",783- "files": [784- "config/asks/iso-week.ask.ts"785- ],738+ "files": ["config/asks/iso-week.ask.ts"],739 "id": "prop-000001",740 "openedAt": "2026-10-07T12:00:00.000Z",741 "project": "oscabriel/datekit",742 "proposer": "dave",85 unmodified lines828 "ask": {829 "askedBy": "alice",830 "blockedBy": [],831 "brief": {879- "context": [880- "ISO 8601 weeks start on Monday."881- ],832+ "context": ["ISO 8601 weeks start on Monday."],833 "current": "Week 1 of 2027 parses as week 53 of 2026.",883- "outOfScope": [884- "Locale-specific weeks"885- ],886- "terms": [887- "ISO week"888- ],834+ "outOfScope": ["Locale-specific weeks"],835+ "terms": ["ISO week"],836 "want": "An ISO week date parses to the Monday of that week."837 },838 "check": {839 "_tag": "RedThenGreen",9 unmodified lines849 "reserve": "newcomers",850 "state": "open",851 "territory": {852 "module": "@datekit/parse",906- "paths": [907- "packages/parse/**"908- ],909- "publicFiles": [910- "packages/parse/src/index.ts"911- ]853+ "paths": ["packages/parse/**"],854+ "publicFiles": ["packages/parse/src/index.ts"]855 }856 },857 "brief": "# iso-week\n\nAn ISO week date parses to the Monday of that week.\n"858 }81 unmodified lines940 "tree": "5555555555555555555555555555555555555555",941 "verifier": "platform"942 }943 },1001- "parents": [1002- "1111111111111111111111111111111111111111"1003- ],944+ "parents": ["1111111111111111111111111111111111111111"],945 "sha": "4444444444444444444444444444444444444444",946 "subject": "Parse ISO week dates",947 "trailers": [948 {34 unmodified lines983 }984 ],985 "proposal": {986 "expiresAt": "2026-10-21T12:00:00.000Z",1046- "files": [1047- "config/asks/iso-week.ask.ts"1048- ],987+ "files": ["config/asks/iso-week.ask.ts"],988 "id": "prop-000001",989 "openedAt": "2026-10-07T12:00:00.000Z",990 "project": "oscabriel/datekit",991 "proposer": "dave",121 unmodified lines1113 "by": "alice",1114 "choice": "accept",1115 "note": "Worth it."1116 },1178- "deciders": [1179- "alice"1180- ],1117+ "deciders": ["alice"],1118 "default": "decline",1119 "evidence": [1120 {1121 "href": "https://example.com/7",10 unmodified lines1132 "proposal": "prop-000001"1133 }1134 }1135 ],1199- "expiringSoon": [1200- "dec-000001"1201- ],1202- "newcomers": [1203- "dave"1204- ],1136+ "expiringSoon": ["dec-000001"],1137+ "newcomers": ["dave"],1138 "overflow": 0,1139 "unattended": [1140 {1141 "ask": "iso-week",131 unmodified lines1273 "success": {1274 "_tag": "AskOpened",1275 "ask": {1276 "ask": "iso-week",1344- "blockedBy": [1345- "drop-moment"1346- ],1277+ "blockedBy": ["drop-moment"],1278 "claimed": false,1279 "kind": "fix",1280 "reserve": "newcomers",1281 "territory": "@datekit/parse",23 unmodified lines1305 "at": "2026-10-07T12:00:00.000Z",1306 "email": "carol@example.com",1307 "name": "Carol"1308 },1378- "parents": [1379- "1111111111111111111111111111111111111111"1380- ],1309+ "parents": ["1111111111111111111111111111111111111111"],1310 "sha": "4444444444444444444444444444444444444444",1311 "subject": "Parse ISO week dates",1312 "trailers": [1313 {92 unmodified linesmodified:scripts/lib/swarm/views/counter.ts+1 added
38 unmodified lines39 AskClosed: () => "",40 AskOpened: () => "",41 Claimed: ({ ask, claimant }) => `${claimant} claimed ${ask}`,42 Decided: () => "",43+ DiscussionPosted: () => "",44 Judged: () => "",45 Landed: ({ landing }) =>46 `${landing.ask ?? "main"} landed as ${short(landing.sha)}`,47 Lapsed: () => "",219 unmodified linesmodified:PRODUCT.md+2 added-1 removed
72 unmodified lines73 - Pages per job on the web:74 - **Landing** (`/`): what the gate does, the issue and pull-request flow beside the ask, answer and gate flow, the seven stages, and the latest landings and refused answers across projects. A signed-in reader goes on to the inbox.75 - **Explore** (`/explore`): every public project as a card with its posture, the projects taking answers first.76 - **Front page** (`/asks`): open asks across projects a viewer may take, grouped by project with each project's posture said once, in the group heading, filtered by kind, by open to take and by asks held for newcomers; a split family is one row with its children as a fan. The same list as Markdown by `Accept: text/markdown`.77- - **Project** (`/$project`, the Overview tab): a header that stays across the tabs (the name, the posture said once, a description, its facts and Watch, Clone and Contribute), then the tabs Overview, Code, Asks, Landings, Proposals, People, Policy and Visibility. Overview holds its asks, recent landings and README, beside an about column with how a change lands here and who decides. The same as the project's `llms.txt` by `Accept: text/markdown`.77+ - **Project** (`/$project`, the Overview tab): a header that stays across the tabs (the name, the posture said once, a description, its facts and Watch, Clone and Contribute), then the tabs Overview, Code, Asks, Landings, Proposals, Discussions, People, Policy and Visibility. Overview holds its asks, recent landings and README, beside an about column with how a change lands here and who decides. The same as the project's `llms.txt` by `Accept: text/markdown`.78 - **Code** (`/$project/tree/…`, `blob/…`, `why/…`, `commits/…`, `commit/…`, `refs`): the files at any commit, tag or answer fork with a persistent tree, highlighted code with `#L` links, why each line is there, the landings by day, each commit's diff, and the refs; raw bytes under a sandboxing CSP.79 - **Ask** (`/$project/asks/$ask`): the want, the territory, the check, who may claim, and the commands; the same as Markdown by `Accept: text/markdown` or at `/$project/asks/$ask.md`.80 - **Answer** (`/$project/answers/$ask`): the outcome, the gate's stages, the rounds, the lanes, held-back results as one line per area, the refusal, and the landing. A waiting answer says the one thing the contributor needs; a landed one is told as a sentence first, then credits its people, and only then shows its sealed roots.81 - **Person** (`/people/$handle`): their credits by role and area, in words, never a number or a score.82 - **Policy** (`/$project/people`): who decides which paths, who is vouched for or denounced, the limits and the agent rules, read from the config folder at the landed commit, with the commands that change them.83+ - **Discussions** (`/$project/discussions`, `/$project/discussions/$discussion`): a project's public, freeform threads, open to anyone not denounced, that land nothing themselves; each page shows its posts, the proposal a maintainer turned it into, and the command to post, since the web adds no form for it.84 - **Proposals** (`/$project/proposals/new`, `/$project/proposals/$proposal`): a want proposed from the web or the CLI, the platform's agent's draft if one was asked for (the ask file, the check, its red-first runs), and the decision it waits on.85 - **Inbox** (`/inbox`; `/home` and `/today` move here): the reader's own page. A maintainer's decisions in sections (due today, within the budget, waiting for tomorrow), each with its evidence, safe default, expiry and one-tap choices whose consequence is written under each, against the budget said as a sentence; the asks the reader holds and where each answer stands in the gate; the asks they may take next. Each decision has its own page (`/$project/decisions/$decision`), where a finish shows the answer's diff with refusals marked at their lines.86 - **Visibility** (`/$project/visibility`; `/$project/ledger` and `/$project/env` move here): the posture, each declared layer with its reason, each sealed area's count, authors, committed root and admission; the Environment, every item the project's committed `.env.schema` declares, parsed at the landed commit and never resolved, with who set a sensitive item's value and when, never a value; and the ledger, newest first.87 - **Settings** (`/settings`): the theme, the system's or its opposite, kept in this browser's `localStorage`, never a cookie.37 unmodified lines