Merge build/1312-home into main
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by oscabriel · committed by oscabriel · parents 9000f4e, d45955c · Browse files · 11 files·+1223 added−71 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
11 files+1223 added−71 removed
- tests:+445 added−38 removed
- other:+778 added−33 removed
Provenance
- Commit
2232fc4- Tree
0de7e51- Author
oscabriel <oscarhernandeziv@gmail.com>- Committer
oscabriel <oscarhernandeziv@gmail.com>- Parent 1
9000f4e- Parent 2
d45955c
11 files changed+1223 added−71 removed
modified:apps/web/src/features/code/refs-view.tsx+8 added-12 removed
10 unmodified lines11 * when they hold more than one, a list of packages, each with its newest12 * tag and its count, sits above the tags, and `?package=` lists one13 * package's tags alone.14 */15-import type { ClaimState } from "@repo/protocol/domain/claim";15 import { packageOf } from "@repo/protocol/domain/code";16 import type {17 ForkRef,18 RefsView as Refs,8 unmodified lines27 import { FactBlock } from "../shared/facts.tsx";28 import { HandleLink } from "../shared/handle.tsx";29 import { AppLink } from "../shared/link.tsx";30 import { answerPath, personPath } from "../shared/paths.ts";32-import { MetaCode, MetaLine, Row, RowGroup, RowList } from "../shared/row.tsx";33-import type { RowState } from "../shared/row.tsx";31+import {32+ CLAIM_STATES,33+ MetaCode,34+ MetaLine,35+ Row,36+ RowGroup,37+ RowList,38+} from "../shared/row.tsx";39 import { Workspace } from "../shared/shell/workspace.tsx";40 import { Pager } from "./pager.tsx";41 import { commitHref, shortSha, treeHref } from "./paths.ts";42 75 unmodified lines118 <HandleLink handle={handle} />119 </span>120 );121 117-/** Each claim state as a row says it: its mark and its word. */118-const CLAIM_STATES = {119- answered: { mark: "landed", word: "Answered" },120- lapsed: { mark: "notNeeded", word: "Lapsed" },121- live: { mark: "claimed", word: "Claimed" },122- released: { mark: "notNeeded", word: "Given up" },123- warned: { mark: "waiting", word: "Warned, no push lately" },124-} as const satisfies Record<ClaimState, RowState>;125-122 /** A group of rows, or what it would hold said plainly when it holds none. */123 const Group = ({124 children,125 counts,318 unmodified linesmodified:apps/web/src/features/docs/head.ts+1 added-2 removed
19 unmodified lines20212223242524252619 unmodified lines
/** The index's head. */export const docsIndexHead = () => pageHead({ description: "Guides for answering asks, running a project and connecting an agent, and a reference read from the platform's own schema.", description: "Guides, and a reference read from the platform's schema.", title: "Docs", });added:apps/web/src/features/home/home-page.tsx+401 added
1+/**2+ * A signed-in reader's own page: their work (each claim, its ask's want and3+ * where its answer stands, with the command that runs next); the decisions4+ * waiting for them when they decide somewhere; the open asks they may take;5+ * and the way to their record. No score and no count of credit (DESIGN.md).6+ * Signed out, it says what the page is and how to sign in. A view: what the7+ * server read, and the instant, in; markup out.8+ */9+import { Brand } from "@repo/brand";10+import type { Today } from "@repo/protocol/domain/decision";11+import type { FrontPageEntry } from "@repo/protocol/domain/front-page";12+import { Outcome } from "@repo/protocol/domain/outcome";13+import type { Handle } from "@repo/protocol/ids";14+import type { DateTime } from "effect";15+import type { ReactNode } from "react";16+17+import { signInHref } from "../auth/session-slot.tsx";18+import {19+ decisionHref,20+ decisionKey,21+ describeSubject,22+ subjectKind,23+} from "../decision/subject.ts";24+import { CommandLine } from "../shared/command.tsx";25+import { CopyAction } from "../shared/copy-action.tsx";26+import { EmptyState } from "../shared/empty.tsx";27+import { HandleLink } from "../shared/handle.tsx";28+import { AppLink } from "../shared/link.tsx";29+import {30+ answerPath,31+ ASKS_PATH,32+ askPath,33+ HOME_PATH,34+ personPath,35+} from "../shared/paths.ts";36+import { UnreachableNotice } from "../shared/pending.tsx";37+import {38+ AskRow,39+ CLAIM_STATES,40+ MetaCode,41+ MetaLine,42+ outcomeState,43+ Row,44+ RowGroup,45+} from "../shared/row.tsx";46+import { Workspace } from "../shared/shell/workspace.tsx";47+import { When } from "../shared/time.tsx";48+import { orderDecisions } from "../today/read.ts";49+import {50+ Decisions,51+ HomeRead,52+ isRunning,53+ Takeable,54+ WORK_SHOWN,55+} from "./read.ts";56+import type { Work } from "./read.ts";57+58+/** What the page is, said to a reader who is not signed in. */59+const WHAT_HOME_IS =60+ "Home is your own page: the asks you hold and where each answer stands, the decisions waiting for you, and the asks you may take next.";61+62+/** The decisions the page lists; the rest are on Today. */63+const DECISIONS_SHOWN = 5;64+65+const LINK =66+ "decoration-rule hover:decoration-foreground font-medium underline underline-offset-4";67+68+/** A block's empty state, under its header like its rows would be. */69+const Empty = (props: Parameters<typeof EmptyState>[0]) => (70+ <li className="pt-3">71+ <EmptyState {...props} />72+ </li>73+);74+75+/**76+ * What runs next on a claim: a refusal's own `next`, or, while the claim77+ * runs with nothing refused, its local check before a push.78+ */79+const nextOf = ({ answer, claim }: Work) => {80+ if (answer !== undefined) {81+ return Outcome.guards.Refused(answer.outcome)82+ ? {83+ command: answer.outcome.refusals[0].next,84+ label: "Copy next command",85+ }86+ : undefined;87+ }88+89+ return isRunning(claim)90+ ? { command: claim.checkCommand, label: "Copy check command" }91+ : undefined;92+};93+94+const WorkRow = ({95+ now,96+ work,97+}: {98+ readonly now: DateTime.Utc;99+ readonly work: Work;100+}) => {101+ const { answer, claim, want } = work;102+ const next = nextOf(work);103+104+ return (105+ <Row106+ action={next === undefined ? undefined : <CopyAction {...next} />}107+ data={{108+ "data-claim": claim.ask,109+ "data-project": claim.project,110+ "data-state": claim.state,111+ }}112+ href={113+ answer === undefined114+ ? askPath(claim.project, claim.ask)115+ : answerPath(claim.project, claim.ask)116+ }117+ id={`${claim.project}/${claim.ask}/${claim.fork}`}118+ meta={119+ <MetaLine120+ parts={[121+ claim.project,122+ want === undefined ? undefined : (123+ <MetaCode key="ask">{claim.ask}</MetaCode>124+ ),125+ <MetaCode key="fork">{claim.fork}</MetaCode>,126+ isRunning(claim) ? (127+ <span key="lapses">128+ lapses <When at={claim.lapsesAt} now={now} />129+ </span>130+ ) : undefined,131+ ]}132+ />133+ }134+ mono={want === undefined}135+ state={136+ answer === undefined137+ ? CLAIM_STATES[claim.state]138+ : outcomeState(answer.outcome)139+ }140+ title={want ?? claim.ask}141+ />142+ );143+};144+145+const WorkRows = ({146+ asks,147+ now,148+ read,149+}: {150+ readonly asks: Takeable;151+ readonly now: DateTime.Utc;152+ readonly read: typeof HomeRead.cases.Read.Type;153+}) => {154+ const [first] = Takeable.match(asks, {155+ Listed: ({ asks: listed }) => listed,156+ Unreachable: () => [],157+ });158+159+ return (160+ <div className="flex flex-col gap-3">161+ <RowGroup162+ counts={`${read.running} running`}163+ label="Your work"164+ name="Your work"165+ under="bar"166+ >167+ {read.work.length === 0 ? (168+ <Empty169+ command={170+ first === undefined171+ ? `${Brand.cli} front`172+ : `${Brand.cli} claim ${first.ask.ask} --project ${first.project}`173+ }174+ onward={175+ <AppLink className={LINK} to={ASKS_PATH}>176+ The open asks177+ </AppLink>178+ }179+ title={180+ first === undefined181+ ? "You hold no claim. Find an ask to take, then claim it."182+ : "You hold no claim. Claim the first ask you may take, or pick another below."183+ }184+ />185+ ) : (186+ read.work.map((work) => (187+ <WorkRow188+ key={`${work.claim.project}/${work.claim.ask}/${work.claim.fork}`}189+ now={now}190+ work={work}191+ />192+ ))193+ )}194+ </RowGroup>195+ {read.held > WORK_SHOWN ? (196+ <div className="flex flex-col items-start gap-2">197+ <p className="text-ui text-muted-foreground">198+ The newest {WORK_SHOWN} of your {read.held} claims; every one:199+ </p>200+ <CommandLine command={`${Brand.cli} status`} />201+ </div>202+ ) : null}203+ </div>204+ );205+};206+207+const DecisionRows = ({ today }: { readonly today: Today }) => (208+ <>209+ {orderDecisions(today)210+ .slice(0, DECISIONS_SHOWN)211+ .map((decision) => (212+ <Row213+ data={{214+ "data-decision": decision.id,215+ "data-project": decision.project,216+ }}217+ href={decisionHref(decision)}218+ id={decisionKey(decision)}219+ key={decisionKey(decision)}220+ meta={221+ <MetaLine222+ parts={[223+ decision.project,224+ subjectKind(decision.subject),225+ <MetaCode key="id">{decision.id}</MetaCode>,226+ ]}227+ />228+ }229+ state={{ mark: "now", word: "Yours to decide" }}230+ title={describeSubject(decision.subject)}231+ />232+ ))}233+ </>234+);235+236+const TODAY_LINK = (237+ <AppLink className={LINK} to="/today">238+ Today239+ </AppLink>240+);241+242+const DecisionsGroup = ({243+ children,244+ waiting,245+}: {246+ readonly children: ReactNode;247+ readonly waiting?: number;248+}) => (249+ <RowGroup250+ counts={waiting === undefined ? undefined : `${waiting} waiting`}251+ label="Decisions waiting"252+ name={<AppLink to="/today">Decisions waiting</AppLink>}253+ under="bar"254+ >255+ {children}256+ </RowGroup>257+);258+259+/** A decider's waiting decisions, or that none waits. */260+const Waiting = ({ today }: { readonly today: Today }) => {261+ const waiting = today.decisions.length + today.overflow;262+263+ return (264+ <DecisionsGroup waiting={waiting}>265+ {waiting === 0 ? (266+ <Empty267+ onward={TODAY_LINK}268+ title="Nothing waits for your decision. Today shows what landed without one."269+ />270+ ) : (271+ <DecisionRows today={today} />272+ )}273+ </DecisionsGroup>274+ );275+};276+277+/** The decisions block: a decider's waiting decisions; nothing for anyone else. */278+const DecisionsBlock = ({ decisions }: { readonly decisions: Decisions }) =>279+ Decisions.match(decisions, {280+ Decides: ({ today }) => <Waiting today={today} />,281+ NotDecider: () => null,282+ Unreachable: () => (283+ <DecisionsGroup>284+ <Empty285+ command={`${Brand.cli} today`}286+ onward={TODAY_LINK}287+ title="Your decisions did not come: the platform did not answer. Try Today, or read them from a terminal."288+ />289+ </DecisionsGroup>290+ ),291+ });292+293+const AskRows = ({ asks }: { readonly asks: readonly FrontPageEntry[] }) =>294+ asks.map(({ ask, project }) => (295+ <AskRow296+ key={`${project}/${ask.ask}`}297+ listing={ask}298+ project={project}299+ showProject300+ takeable301+ />302+ ));303+304+const EVERY_ASK = (305+ <AppLink className={LINK} to={ASKS_PATH}>306+ Every open ask307+ </AppLink>308+);309+310+/** The asks block's empty state: none to take, or none came. */311+const NoAsks = ({ title }: { readonly title: string }) => (312+ <Empty command={`${Brand.cli} front`} onward={EVERY_ASK} title={title} />313+);314+315+/** The asks the reader may take, or why none shows. */316+const AskList = ({ asks }: { readonly asks: Takeable }) =>317+ Takeable.match(asks, {318+ Listed: ({ asks: listed }) =>319+ listed.length === 0 ? (320+ <NoAsks title="No open ask is yours to take right now." />321+ ) : (322+ <AskRows asks={listed} />323+ ),324+ Unreachable: () => (325+ <NoAsks title="The asks did not come: the platform did not answer." />326+ ),327+ });328+329+const AsksBlock = ({ asks }: { readonly asks: Takeable }) => (330+ <RowGroup331+ label="Asks you may take"332+ name={<AppLink to={ASKS_PATH}>Asks you may take</AppLink>}333+ under="bar"334+ >335+ <AskList asks={asks} />336+ </RowGroup>337+);338+339+/** Who is signed in, and the way to their record. */340+const Record = ({ handle }: { readonly handle: Handle }) => (341+ <>342+ Signed in as <HandleLink handle={handle} />.{" "}343+ <AppLink className={LINK} to={personPath(handle)}>344+ Your record345+ </AppLink>346+ </>347+);348+349+const SignedIn = ({350+ now,351+ read,352+}: {353+ readonly now: DateTime.Utc;354+ readonly read: typeof HomeRead.cases.Read.Type;355+}) => (356+ <Workspace357+ crumbs={[{ label: "Home" }]}358+ meta={<Record handle={read.handle} />}359+ title="Home"360+ variant="list"361+ >362+ <div className="flex flex-col gap-8">363+ <WorkRows asks={read.asks} now={now} read={read} />364+ <DecisionsBlock decisions={read.decisions} />365+ <AsksBlock asks={read.asks} />366+ </div>367+ </Workspace>368+);369+370+/** Signed out: what the page is, the way in, and the command. */371+const SignedOut = () => (372+ <Workspace crumbs={[{ label: "Home" }]} title="Home">373+ <div className="flex max-w-[70ch] flex-col items-start gap-3">374+ <p className="text-body">{WHAT_HOME_IS}</p>375+ <p className="text-ui">376+ <a className={LINK} href={signInHref(HOME_PATH)}>377+ Sign in378+ </a>{" "}379+ to see yours, or read it from a terminal:380+ </p>381+ <CommandLine command={`${Brand.cli} status`} />382+ </div>383+ </Workspace>384+);385+386+export const HomeView = ({387+ now,388+ read,389+}: {390+ readonly now: DateTime.Utc;391+ readonly read: HomeRead;392+}) =>393+ HomeRead.match(read, {394+ Read: (signed) => <SignedIn now={now} read={signed} />,395+ SignedOut: () => <SignedOut />,396+ Unreachable: () => (397+ <Workspace crumbs={[{ label: "Home" }]} title="Home">398+ <UnreachableNotice />399+ </Workspace>400+ ),401+ });added:apps/web/src/features/home/read.ts+307 added
1+/**2+ * What `/home` reads, in a module with no view of its own: a route's loader3+ * runs before its page's view loads.4+ *5+ * - `HomeRead`: the reader's work (each claim from `status`, its ask's want6+ * and its latest answer), their Today when they decide somewhere, the7+ * open asks they may take (`frontPage`, read as them), or why there is8+ * none of it.9+ * - `readHome`: that read, made with whatever `Client` the caller gives10+ * (the server's, carrying the reader's own session).11+ */12+import { Client } from "@repo/protocol/contracts";13+import { AnswerView } from "@repo/protocol/domain/answer";14+import { ClaimView } from "@repo/protocol/domain/claim";15+import { Today } from "@repo/protocol/domain/decision";16+import { FrontPageEntry } from "@repo/protocol/domain/front-page";17+import { Handle } from "@repo/protocol/ids";18+import type { ProjectName } from "@repo/protocol/ids";19+import { NotDecider } from "@repo/protocol/refusal";20+import {21+ Array as Arr,22+ Cause,23+ DateTime,24+ Effect,25+ Exit,26+ Option,27+ Order,28+ Schema,29+} from "effect";30+31+import { isSignedOut } from "../today/read.ts";32+33+/** The asks the page lists: the first few the reader may take; the rest are at `/asks`. */34+const ASKS_SHOWN = 8;35+36+/** The claims the page lists, running first, then the newest; the rest are in `status`. */37+export const WORK_SHOWN = 10;38+39+/** How many reads of one kind the page makes at once. */40+const AT_ONCE = 4;41+42+/** One claim of the reader's, its ask's want, and its latest answer. */43+export const Work = Schema.Struct({44+ answer: Schema.optionalKey(AnswerView),45+ claim: ClaimView,46+ /** Absent when the ask did not come: the row names it by its id. */47+ want: Schema.optionalKey(Schema.NonEmptyString),48+});49+50+export type Work = typeof Work.Type;51+52+/** The decisions block: the reader's Today, or why there is none. */53+export const Decisions = Schema.TaggedUnion({54+ Decides: { today: Today },55+ NotDecider: {},56+ Unreachable: {},57+});58+59+export type Decisions = typeof Decisions.Type;60+61+/** The asks block: the first the reader may take, or that the list did not come. */62+export const Takeable = Schema.TaggedUnion({63+ Listed: { asks: Schema.Array(FrontPageEntry) },64+ Unreachable: {},65+});66+67+export type Takeable = typeof Takeable.Type;68+69+/** What the page read for its reader: their work, or why there is none. */70+export const HomeRead = Schema.TaggedUnion({71+ Read: {72+ asks: Takeable,73+ decisions: Decisions,74+ handle: Handle,75+ /** Every claim the reader holds, of which `work` is the first `WORK_SHOWN`. */76+ held: Schema.Int,77+ /** How many of those are still running. */78+ running: Schema.Int,79+ work: Schema.Array(Work),80+ },81+ SignedOut: {},82+ Unreachable: {},83+});84+85+export type HomeRead = typeof HomeRead.Type;86+87+/** What the loader sends: the read, and the instant it was made. */88+export const HomePageData = Schema.Struct({89+ now: Schema.DateTimeUtcFromString,90+ read: HomeRead,91+});92+93+export type HomePageData = typeof HomePageData.Type;94+95+/** A claim still running: its holder's to push to. */96+export const isRunning = (claim: ClaimView) =>97+ claim.state === "live" || claim.state === "warned";98+99+const openedOrder = Order.mapInput(100+ DateTime.Order,101+ (claim: ClaimView) => claim.openedAt102+);103+104+/** Running claims first, then the newest. */105+const workOrder: Order.Order<ClaimView> = Order.combine(106+ Order.mapInput(Order.Boolean, (claim: ClaimView) => !isRunning(claim)),107+ Order.flip(openedOrder)108+);109+110+const answerOrder = Order.mapInput(111+ DateTime.Order,112+ (answer: AnswerView) => answer.at113+);114+115+const isNotDecider = Schema.is(NotDecider);116+117+/** Where a claim's ask lives: one key per (project, ask). */118+export const askKey = ({ ask, project }: ClaimView) => `${project}/${ask}`;119+120+/**121+ * The asks whose id the reader's claims hold in more than one project.122+ * `status` names an answer's ask but not its project, so those asks' answers123+ * are read again one project at a time.124+ */125+const sharedAsks = (claims: readonly ClaimView[]) =>126+ new Set(127+ Object.entries(Arr.groupBy(claims, ({ ask }) => ask)).flatMap(128+ ([ask, holding]) =>129+ new Set(holding.map(({ project }) => project)).size > 1 ? [ask] : []130+ )131+ );132+133+/** The reader's answers in each of `projects`; a project that did not answer gives none. */134+const answersIn = (projects: readonly ProjectName[]) =>135+ Effect.gen(function* () {136+ const client = yield* Client;137+138+ return new Map(139+ yield* Effect.forEach(140+ projects,141+ (project) =>142+ client.status({ project }).pipe(143+ Effect.map(({ answers }) => [project, answers] as const),144+ Effect.orElseSucceed(() => [project, []] as const)145+ ),146+ { concurrency: AT_ONCE }147+ )148+ );149+ });150+151+/** Each shown claim's ask's want, by `askKey`; an ask that did not come is left out. */152+const wantsOf = (claims: readonly ClaimView[]) =>153+ Effect.gen(function* () {154+ const client = yield* Client;155+ const asks = Arr.dedupeWith(claims, (a, b) => askKey(a) === askKey(b));156+157+ return new Map(158+ yield* Effect.forEach(159+ asks,160+ (claim) =>161+ client.showAsk({ ask: claim.ask, project: claim.project }).pipe(162+ Effect.map(({ ask }) => [[askKey(claim), ask.brief.want] as const]),163+ Effect.orElseSucceed(() => [])164+ ),165+ { concurrency: AT_ONCE }166+ ).pipe(Effect.map((found) => found.flat()))167+ );168+ });169+170+/** The claims the page lists: running first, then the newest, the first `WORK_SHOWN`. */171+const shownOf = (claims: readonly ClaimView[]) =>172+ Arr.sort(claims, workOrder).slice(0, WORK_SHOWN);173+174+/**175+ * The reader's first claims, each with its want and its latest answer. An176+ * answer belongs to the newest claim on its ask in its project; an older177+ * claim on the same ask shows its own state. An ask whose id the reader178+ * holds in two projects takes its answers from `again`, read per project.179+ */180+export const pairWork = ({181+ again,182+ answers,183+ claims,184+ wants,185+}: {186+ readonly claims: readonly ClaimView[];187+ readonly answers: readonly AnswerView[];188+ readonly again: ReadonlyMap<ProjectName, readonly AnswerView[]>;189+ readonly wants: ReadonlyMap<string, string>;190+}): readonly Work[] => {191+ const shared = sharedAsks(claims);192+193+ /** The claim each (project, ask) gives its answer to: the newest, set last. */194+ const newest = new Map(195+ Arr.sort(claims, openedOrder).map(196+ (claim) => [askKey(claim), claim] as const197+ )198+ );199+200+ const answerOf = (claim: ClaimView) => {201+ if (newest.get(askKey(claim)) !== claim) {202+ return Option.none();203+ }204+205+ const [latest] = Arr.sort(206+ (shared.has(claim.ask)207+ ? (again.get(claim.project) ?? [])208+ : answers209+ ).filter(({ ask }) => ask === claim.ask),210+ Order.flip(answerOrder)211+ );212+213+ return Option.fromUndefinedOr(latest);214+ };215+216+ return shownOf(claims).map((claim): Work => ({217+ claim,218+ ...Option.match(answerOf(claim), {219+ onNone: () => ({}),220+ onSome: (answer) => ({ answer }),221+ }),222+ ...Option.match(Option.fromUndefinedOr(wants.get(askKey(claim))), {223+ onNone: () => ({}),224+ onSome: (want) => ({ want }),225+ }),226+ }));227+};228+229+/** `pairWork` over what the platform answers: the wants, and answers read again where needed. */230+const workOf = (claims: readonly ClaimView[], answers: readonly AnswerView[]) =>231+ Effect.gen(function* () {232+ const shown = shownOf(claims);233+ const shared = sharedAsks(claims);234+235+ const [again, wants] = yield* Effect.all(236+ [237+ answersIn(238+ Arr.dedupe(239+ shown.flatMap(({ ask, project }) =>240+ shared.has(ask) ? [project] : []241+ )242+ )243+ ),244+ wantsOf(shown),245+ ],246+ { concurrency: "unbounded" }247+ );248+249+ return pairWork({ again, answers, claims, wants });250+ });251+252+/** The reader's home, or why there is none, encoded for the page. */253+export const readHome = Effect.gen(function* () {254+ const client = yield* Client;255+256+ const [status, today, front] = yield* Effect.all(257+ [258+ Effect.exit(client.status({})),259+ Effect.exit(client.today({})),260+ Effect.option(client.frontPage({})),261+ ],262+ { concurrency: "unbounded" }263+ );264+265+ const decisions = Exit.match(today, {266+ onFailure: (cause) =>267+ Option.exists(Cause.findErrorOption(cause), isNotDecider)268+ ? Decisions.cases.NotDecider.make({})269+ : Decisions.cases.Unreachable.make({}),270+ onSuccess: (read) => Decisions.cases.Decides.make({ today: read }),271+ });272+273+ const asks = Option.match(front, {274+ onNone: () => Takeable.cases.Unreachable.make({}),275+ onSome: ({ entries }) =>276+ Takeable.cases.Listed.make({277+ asks: entries.filter(({ takeable }) => takeable).slice(0, ASKS_SHOWN),278+ }),279+ });280+281+ const read = yield* Exit.match(status, {282+ onFailure: (cause) =>283+ Effect.succeed(284+ isSignedOut(cause)285+ ? HomeRead.cases.SignedOut.make({})286+ : HomeRead.cases.Unreachable.make({})287+ ),288+ onSuccess: ({ answers, claims, handle }) =>289+ workOf(claims, answers).pipe(290+ Effect.map((work) =>291+ HomeRead.cases.Read.make({292+ asks,293+ decisions,294+ handle,295+ held: claims.length,296+ running: claims.filter(isRunning).length,297+ work,298+ })299+ )300+ ),301+ });302+303+ return yield* Schema.encodeEffect(HomePageData)({304+ now: yield* DateTime.now,305+ read,306+ });307+});modified:apps/web/src/features/shared/row.tsx+26 added-12 removed
18 unmodified lines19 * press. `j` and `k` reach each row's link (`data-list-key`). Every20 * `data-*` a list carries sits on the row's `<li>`.21 */22 import type { AskListing } from "@repo/protocol/domain/ask";23+import type { ClaimState } from "@repo/protocol/domain/claim";24 import { Outcome } from "@repo/protocol/domain/outcome";25 import type { ProjectName } from "@repo/protocol/ids";26 import type { MouseEvent, ReactNode } from "react";27 import { Fragment } from "react";269 unmodified lines297 readonly name: ReactNode;298 /** The group's facts after its name: a project's posture. */299 readonly facts?: ReactNode;300 /** Its counts at the end, in words: "7 open · 6 to take". */300- readonly counts?: string;301+ readonly counts?: string | undefined;302 /** The group's name in words, for its list (the name may be a link). */303 readonly label?: string;304 /** What the header sticks under. */305 readonly under?: keyof typeof STICK;54 unmodified lines360 361 return { clear, focused, select, selected };362 };363 364+/** An answer's latest outcome as a row's state: a retryable refusal turns back. */365+export const outcomeState = (outcome: Outcome): RowState =>366+ Outcome.match(outcome, {367+ AwaitingDecision: (): RowState => ({ mark: "waiting", word: "Waiting" }),368+ AwaitingFinish: (): RowState => ({ mark: "waiting", word: "Waiting" }),369+ Checking: (): RowState => ({ mark: "checking", word: "Checking" }),370+ Landed: (): RowState => ({ mark: "landed", word: "Landed" }),371+ Refused: ({ refusals }): RowState => ({372+ mark: refusals[0].retryable ? "retry" : "refused",373+ word: "Refused",374+ }),375+ WaitingOnParent: (): RowState => ({ mark: "waiting", word: "Waiting" }),376+ });377+378+/** Each claim state as a row says it: its mark and its word. */379+export const CLAIM_STATES = {380+ answered: { mark: "landed", word: "Answered" },381+ lapsed: { mark: "notNeeded", word: "Lapsed" },382+ live: { mark: "claimed", word: "Claimed" },383+ released: { mark: "notNeeded", word: "Given up" },384+ warned: { mark: "waiting", word: "Warned, no push lately" },385+} as const satisfies Record<ClaimState, RowState>;386+387 /** Where an open ask stands for its reader, as a row's state. */388 const askState = (389 listing: AskListing,390 takeable: boolean | undefined,3 unmodified lines394 return { mark: "landed", word: "Landed" };395 }396 397 if (progress?.latest !== undefined) {374- return Outcome.match(progress.latest, {375- AwaitingDecision: (): RowState => ({ mark: "waiting", word: "Waiting" }),376- AwaitingFinish: (): RowState => ({ mark: "waiting", word: "Waiting" }),377- Checking: (): RowState => ({ mark: "checking", word: "Checking" }),378- Landed: (): RowState => ({ mark: "landed", word: "Landed" }),379- Refused: ({ refusals }): RowState => ({380- mark: refusals[0].retryable ? "retry" : "refused",381- word: "Refused",382- }),383- WaitingOnParent: (): RowState => ({ mark: "waiting", word: "Waiting" }),384- });398+ return outcomeState(progress.latest);399 }400 401 if (listing.claimed || progress?.claimant !== undefined) {402 return { mark: "claimed", word: "Claimed" };97 unmodified linesmodified:apps/web/src/features/today/read.ts+5 added-1 removed
49 unmodified lines5051525354555657585960616263646562666768697081 unmodified lines49 unmodified linesconst isRefusal = Schema.is(Refusal);
const isUnauthenticated = Schema.is(Unauthenticated);
/** Whether a read failed because its reader is not signed in. */export const isSignedOut = (cause: Cause.Cause<unknown>) => Option.exists(Cause.findErrorOption(cause), isUnauthenticated);
/** A failed read of Today, as the page says it. */export const readOfCause = (cause: Cause.Cause<unknown>): TodayRead => { const error = Cause.findErrorOption(cause);
if (Option.isSome(error) && isRefusal(error.value)) { return TodayRead.cases.Refused.make({ refusal: error.value }); }
return Option.exists(error, isUnauthenticated) return isSignedOut(cause) ? TodayRead.cases.SignedOut.make({}) : TodayRead.cases.Unreachable.make({});};
81 unmodified linesmodified:apps/web/src/routes/home.tsx+30 added-6 removed
1 import { createFileRoute } from "@tanstack/react-router";2+import { createServerFn } from "@tanstack/react-start";3+import { getRequest } from "@tanstack/react-start/server";4+import { env } from "cloudflare:workers";5+import { Effect, Schema } from "effect";6 7+import { HomeView } from "../features/home/home-page.tsx";8+import { HomePageData, readHome } from "../features/home/read.ts";9 import { pageHead } from "../features/shared/head.ts";4-import { Workspace } from "../features/shared/shell/workspace.tsx";10+import { reloadOnEnter } from "../features/shared/shell/selection.ts";11 import { personalPage } from "../server/cache-headers.ts";12+import { serverClient } from "../server/client.ts";13 7-// `/home`: a signed-in reader's own page, where the landing sends them. A8-// page about its reader is kept by no cache.14+// `/home`: the signed-in reader's own page, where the landing sends them.15+// The loader reads it on the server with the reader's own session (their16+// cookie goes with the call), so the page arrives with its rows. A page17+// about its reader is kept by no cache.18 10-const HomePage = () => <Workspace title="Home">{null}</Workspace>;19+/** A page about its reader, kept by no cache. */20+export const homeHeaders = () => personalPage;21 22+const homePage = createServerFn({ method: "GET" }).handler(() =>23+ Effect.runPromise(24+ readHome.pipe(Effect.provide(serverClient(env, getRequest())))25+ )26+);27+28+const HomePage = () => {29+ const data = Schema.decodeSync(HomePageData)(Route.useLoaderData());30+31+ return <HomeView now={data.now} read={data.read} />;32+};33+34 export const Route = createFileRoute("/home")({13- component: HomePage,14- headers: () => personalPage,35+ loader: () => homePage(),36+ shouldReload: reloadOnEnter,37+ headers: homeHeaders,38 head: () => pageHead({ title: "Home" }),39+ component: HomePage,40 });added:apps/web/test/dev-client.ts+43 added
12345678910111213141516171819202122232425262728293031323334353637383940414243/** * A `Client` of a fresh dev world with its fixtures, as a route's loader * calls the platform on the server: signed in as `handle`, or as nobody. */import { Client, Contracts } from "@repo/protocol/contracts";import { Handle } from "@repo/protocol/ids";import { Effect, Layer } from "effect";import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";import { RpcClient, RpcSerialization } from "effect/rpc";
import { devServer } from "../src/dev/server.ts";import { devToken } from "../src/dev/sessions.ts";
export const fixturesClient = (handle?: string) => Layer.unwrap( Effect.gen(function* () { const { dispose, handler } = devServer({ fixtures: "on" });
yield* Effect.addFinalizer(() => Effect.promise(dispose));
return Layer.effect(Client)(RpcClient.make(Contracts)).pipe( Layer.provide( RpcClient.layerProtocolHttp({ transformClient: HttpClient.mapRequest((request) => handle === undefined ? request : HttpClientRequest.bearerToken( request, devToken(Handle.make(handle)) ) ), url: "http://localhost/rpc", }) ), Layer.provide([FetchHttpClient.layer, RpcSerialization.layerJson]), Layer.provide( Layer.succeed(FetchHttpClient.Fetch, (input, init) => handler(new Request(input, init)) ) ) ); }) );modified:apps/web/test/edge-cache.test.ts+1 added
457 unmodified lines458 );459 460 expect(reading.toSorted()).toStrictEqual([461 "../src/routes/$project/decisions/$decision.tsx",462+ "../src/routes/home.tsx",463 "../src/routes/today.tsx",464 ]);465 466 for (const path of reading) {24 unmodified linesadded:apps/web/test/home.test.tsx+399 added
1+/**2+ * `/home`, a signed-in reader's own page: their work (each claim, its ask's3+ * want, where its answer stands and the command that runs next), the4+ * decisions waiting when they decide somewhere, the asks they may take, and5+ * their record; each block says what to do when it is empty or did not6+ * come. Read on the server with the reader's session from the dev world and7+ * its fixtures, and drawn from reads made here. Signed out, it says what8+ * the page is and how to sign in. A page about its reader, kept by no cache.9+ */10+import { describe, expect, it } from "@effect/vitest";11+import { Brand } from "@repo/brand";12+import type { AnswerView } from "@repo/protocol/domain/answer";13+import { ClaimView } from "@repo/protocol/domain/claim";14+import { DecisionSubject, Today } from "@repo/protocol/domain/decision";15+import { FrontPageEntry } from "@repo/protocol/domain/front-page";16+import { Outcome } from "@repo/protocol/domain/outcome";17+import {18+ AskId,19+ CommitSha,20+ Handle,21+ ProjectName,22+ RequestId,23+} from "@repo/protocol/ids";24+import { ClaimLapsed } from "@repo/protocol/refusal";25+import { DateTime, Effect, Schema } from "effect";26+27+import { HomeView } from "../src/features/home/home-page.tsx";28+import {29+ askKey,30+ Decisions,31+ HomePageData,32+ HomeRead,33+ pairWork,34+ readHome,35+ Takeable,36+} from "../src/features/home/read.ts";37+import { homeHeaders, Route } from "../src/routes/home.tsx";38+import { fixturesClient } from "./dev-client.ts";39+import { textIn } from "./markup.ts";40+import { renderAt } from "./render.tsx";41+42+const NOW = "2026-10-07T12:00:00.000Z";43+44+/** The page as the route renders it from what the loader sent. */45+const pageFrom = (encoded: typeof HomePageData.Encoded) =>46+ Effect.gen(function* () {47+ const data = yield* Schema.decodeEffect(HomePageData)(encoded);48+49+ return yield* renderAt(50+ "/home",51+ <HomeView now={data.now} read={data.read} />52+ );53+ });54+55+/** The page drawn from a signed-in read made here. */56+const pageOf = (read: Partial<typeof HomeRead.cases.Read.Type>) =>57+ renderAt(58+ "/home",59+ <HomeView60+ now={DateTime.makeUnsafe(NOW)}61+ read={HomeRead.cases.Read.make({62+ asks: Takeable.cases.Listed.make({ asks: [] }),63+ decisions: Decisions.cases.NotDecider.make({}),64+ handle: Handle.make("bram"),65+ held: 0,66+ running: 0,67+ work: [],68+ ...read,69+ })}70+ />71+ );72+73+/** The sections' names, in order. */74+const sectionsOf = (markup: string) =>75+ [...markup.matchAll(/<section\b[^>]*aria-label="(?<name>[^"]+)"/gu)].map(76+ (found) => found.groups?.name77+ );78+79+/** The commands a reader can copy: each in the DOM as text. */80+const commandsOf = (markup: string) =>81+ [...markup.matchAll(/<code\b[^>]*>(?<command>.*?)<\/code>/gsu)].map((found) =>82+ textIn(found.groups?.command ?? "").trim()83+ );84+85+const claim = (fields: Partial<typeof ClaimView.Encoded> = {}) =>86+ Schema.decodeSync(ClaimView)({87+ ask: "fix-week-start",88+ base: "a".repeat(40),89+ checkCommand: `${Brand.cli} check fix-week-start --project datekit`,90+ claimant: "bram",91+ fork: "datekit--fix-week-start--bram",92+ lapsesAt: "2026-10-08T12:00:00.000Z",93+ openedAt: "2026-10-07T09:00:00.000Z",94+ project: "datekit",95+ remote: "https://git.example/datekit--fix-week-start--bram",96+ state: "live",97+ warnsAt: "2026-10-08T06:00:00.000Z",98+ ...fields,99+ });100+101+/** An answer refused because its claim lapsed, which a new claim can mend. */102+const refused = (ask: string): AnswerView => ({103+ ask: AskId.make(ask),104+ at: DateTime.makeUnsafe("2026-10-07T11:00:00Z"),105+ head: CommitSha.make("b".repeat(40)),106+ outcome: Outcome.cases.Refused.make({107+ refusals: [ClaimLapsed.of(AskId.make(ask))],108+ }),109+ requestId: RequestId.make(`req-${ask}`),110+});111+112+const decision = (id: string, handle: string, expiresAt: string) => ({113+ deciders: ["ines-v"] as const,114+ default: "decline" as const,115+ evidence: [],116+ expiresAt,117+ id,118+ openedAt: "2026-10-06T09:00:00.000Z",119+ project: "datekit",120+ subject: DecisionSubject.cases.Vouch.make({ handle: Handle.make(handle) }),121+});122+123+const today = Schema.decodeSync(Today)({124+ budget: { finishes: 0, total: 5, used: 1 },125+ decider: "ines-v",126+ decisions: [127+ decision("dec-000002", "lin-h", "2026-10-09T12:00:00.000Z"),128+ decision("dec-000001", "tamsin", "2026-10-08T12:00:00.000Z"),129+ ],130+ expiringSoon: [],131+ newcomers: [],132+ overflow: 0,133+ unattended: [],134+});135+136+const takeable = Schema.decodeSync(FrontPageEntry)({137+ ask: {138+ ask: "split-format",139+ blockedBy: [],140+ claimed: false,141+ kind: "migrate",142+ territory: "format",143+ want: "The format package calls the new parser.",144+ },145+ posture: "open",146+ project: "burrow",147+ takeable: true,148+});149+150+describe(HomeView, () => {151+ it.effect(152+ "shows a running claim by its want, with its check command, and a refused answer with its next command",153+ () =>154+ Effect.gen(function* () {155+ const markup = yield* pageOf({156+ held: 2,157+ running: 2,158+ work: [159+ {160+ claim: claim(),161+ want: "A week starts on the locale's first day.",162+ },163+ {164+ answer: refused("parse-iso-week"),165+ claim: claim({166+ ask: "parse-iso-week",167+ fork: "datekit--parse-iso-week--bram",168+ }),169+ want: "Parse an ISO week date.",170+ },171+ ],172+ });173+174+ expect(textIn(markup)).toContain(175+ "A week starts on the locale's first day."176+ );177+ expect(commandsOf(markup)).toStrictEqual(178+ expect.arrayContaining([179+ `${Brand.cli} check fix-week-start --project datekit`,180+ `${Brand.cli} claim parse-iso-week`,181+ ])182+ );183+ // A refusal a new push can mend turns back, in its own mark.184+ expect(markup).toContain("lucide-rotate-ccw");185+ expect(markup).toContain('href="/datekit/answers/parse-iso-week"');186+ })187+ );188+189+ it.effect(190+ "orders its blocks: your work, the decisions waiting, then the asks to take",191+ () =>192+ Effect.gen(function* () {193+ const markup = yield* pageOf({194+ asks: Takeable.cases.Listed.make({ asks: [takeable] }),195+ decisions: Decisions.cases.Decides.make({ today }),196+ });197+198+ expect(sectionsOf(markup)).toStrictEqual([199+ "Your work",200+ "Decisions waiting",201+ "Asks you may take",202+ ]);203+ expect(textIn(markup)).toContain("2 waiting");204+ expect(markup).toMatch(205+ /data-decision="dec-000001"[\s\S]*data-decision="dec-000002"/u206+ );207+ expect(markup).toContain('href="/today"');208+ })209+ );210+211+ it.effect("leaves the decisions out for a reader who decides nowhere", () =>212+ Effect.gen(function* () {213+ const markup = yield* pageOf({});214+215+ expect(sectionsOf(markup)).toStrictEqual([216+ "Your work",217+ "Asks you may take",218+ ]);219+ })220+ );221+222+ it.effect(223+ "says so, with a command, when the decisions or the asks did not come, rather than showing none",224+ () =>225+ Effect.gen(function* () {226+ const markup = yield* pageOf({227+ asks: Takeable.cases.Unreachable.make({}),228+ decisions: Decisions.cases.Unreachable.make({}),229+ });230+231+ const text = textIn(markup);232+233+ expect(text).toContain("Your decisions did not come");234+ expect(text).toContain("The asks did not come");235+ expect(text).not.toContain("No open ask is yours to take");236+ expect(commandsOf(markup)).toStrictEqual(237+ expect.arrayContaining([`${Brand.cli} today`, `${Brand.cli} front`])238+ );239+ })240+ );241+242+ it.effect(243+ "with no claim, gives the claim command for the first ask the reader may take",244+ () =>245+ Effect.gen(function* () {246+ const markup = yield* pageOf({247+ asks: Takeable.cases.Listed.make({ asks: [takeable] }),248+ });249+250+ expect(textIn(markup)).toContain("You hold no claim.");251+ expect(commandsOf(markup)).toContain(252+ `${Brand.cli} claim split-format --project burrow`253+ );254+ })255+ );256+257+ it.effect("links the reader's handle and their record", () =>258+ Effect.gen(function* () {259+ const markup = yield* pageOf({});260+261+ expect(textIn(markup)).toContain("Signed in as bram.");262+ expect(markup).toContain('href="/people/bram"');263+ })264+ );265+266+ it.effect(267+ "past the claims it shows, says how many there are and gives the command for every one",268+ () =>269+ Effect.gen(function* () {270+ const markup = yield* pageOf({271+ held: 14,272+ running: 1,273+ work: [{ claim: claim() }],274+ });275+276+ expect(textIn(markup)).toContain("The newest 10 of your 14 claims");277+ expect(commandsOf(markup)).toContain(`${Brand.cli} status`);278+ })279+ );280+});281+282+describe(pairWork, () => {283+ it("gives an answer to the newest claim on its ask, and an older claim its own state", () => {284+ const older = claim({285+ openedAt: "2026-10-01T09:00:00.000Z",286+ state: "lapsed",287+ });288+289+ const newer = claim();290+ const answer = refused("fix-week-start");291+292+ const work = pairWork({293+ again: new Map(),294+ answers: [answer],295+ claims: [older, newer],296+ wants: new Map([297+ [askKey(newer), "A week starts on the locale's first day."],298+ ]),299+ });300+301+ expect(302+ work.map(({ answer: paired, claim: held }) => [held.state, paired])303+ ).toStrictEqual([304+ ["live", answer],305+ ["lapsed", undefined],306+ ]);307+ expect(work.map(({ want }) => want)).toStrictEqual([308+ "A week starts on the locale's first day.",309+ "A week starts on the locale's first day.",310+ ]);311+ });312+313+ it("reads an ask held in two projects from each project's own answers", () => {314+ const inDatekit = claim();315+316+ const inBurrow = claim({317+ fork: "burrow--fix-week-start--bram",318+ project: "burrow",319+ });320+321+ const datekitAnswer = refused("fix-week-start");322+323+ const work = pairWork({324+ again: new Map([325+ [ProjectName.make("datekit"), [datekitAnswer]],326+ [ProjectName.make("burrow"), []],327+ ]),328+ // `status` across every project: which project this answer is in, it does not say.329+ answers: [datekitAnswer],330+ claims: [inDatekit, inBurrow],331+ wants: new Map(),332+ });333+334+ expect(335+ work.map(({ answer, claim: held }) => [held.project, answer])336+ ).toStrictEqual([337+ ["datekit", datekitAnswer],338+ ["burrow", undefined],339+ ]);340+ });341+});342+343+describe("home, read on the server with the reader's session", () => {344+ it.live(345+ "gives a contributor their work by its wants, the asks they may take and their record, and no decisions",346+ () =>347+ Effect.gen(function* () {348+ const markup = yield* pageFrom(yield* readHome);349+350+ expect(sectionsOf(markup)).toStrictEqual([351+ "Your work",352+ "Asks you may take",353+ ]);354+ expect(markup).toMatch(/data-claim="[^"]+"[^>]*data-project="vellum"/u);355+ expect(markup).toContain('href="/people/bram"');356+ expect(markup).toContain('href="/asks"');357+ }).pipe(Effect.provide(fixturesClient("bram")), Effect.scoped),358+ 60_000359+ );360+361+ it.live(362+ "gives a decider the decisions waiting for them, each linking its page, and Today",363+ () =>364+ Effect.gen(function* () {365+ const markup = yield* pageFrom(yield* readHome);366+367+ expect(sectionsOf(markup)).toStrictEqual([368+ "Your work",369+ "Decisions waiting",370+ "Asks you may take",371+ ]);372+ expect(markup).toMatch(/href="\/[a-z-]+\/decisions\/[^"]+"/u);373+ expect(markup).toContain('href="/today"');374+ }).pipe(Effect.provide(fixturesClient("ines-v")), Effect.scoped),375+ 60_000376+ );377+378+ it.live(379+ "signed out, says what the page is, how to sign in and come back, and the command",380+ () =>381+ Effect.gen(function* () {382+ const markup = yield* pageFrom(yield* readHome);383+384+ expect(textIn(markup)).toContain(`${Brand.cli} status`);385+ expect(markup).toContain(386+ `href="/auth/signin?return=${encodeURIComponent("/home")}"`387+ );388+ expect(sectionsOf(markup)).toStrictEqual([]);389+ }).pipe(Effect.provide(fixturesClient()), Effect.scoped),390+ 60_000391+ );392+393+ it("is kept by no cache: its response is private and never stored", () => {394+ expect(Route.options.headers).toBe(homeHeaders);395+ expect(homeHeaders()).toStrictEqual({396+ "Cache-Control": "private, no-store",397+ });398+ });399+});modified:apps/web/test/today.test.tsx+2 added-38 removed
9 unmodified lines10 * loader over the dev world with its fixtures, signed in as a decider.11 */12 import { describe, expect, it } from "@effect/vitest";13 import { Brand } from "@repo/brand";14-import { Client, Contracts } from "@repo/protocol/contracts";14 import { RefNameText } from "@repo/protocol/domain/common";15 import { DecisionSubject } from "@repo/protocol/domain/decision";16 import type { Choice, Decision, Today } from "@repo/protocol/domain/decision";17 import type { LandingView } from "@repo/protocol/domain/landing";9 unmodified lines27 RatchetName,28 RepoPath,29 } from "@repo/protocol/ids";30 import { DecisionClosed, NotDecider } from "@repo/protocol/refusal";32-import { Cause, DateTime, Effect, Layer, Schema } from "effect";33-import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";31+import { Cause, DateTime, Effect, Schema } from "effect";32 import { AsyncResult } from "effect/reactivity";35-import { RpcClient, RpcSerialization } from "effect/rpc";33 import type { ReactElement } from "react";34 import { renderToStaticMarkup } from "react-dom/server";35 39-import { devServer } from "../src/dev/server.ts";40-import { devToken } from "../src/dev/sessions.ts";36 import {37 allowedChoices,38 consequenceOf,39 describeSubject,7 unmodified lines47 TodayRead,48 TodayView,49 } from "../src/features/today/today-page.tsx";50 import { Route, todayHeaders } from "../src/routes/today.tsx";51+import { fixturesClient } from "./dev-client.ts";52 53 /** The entities React writes for text, and what each reads as. */54 const ENTITIES: ReadonlyMap<string, string> = new Map([55 ["'", "'"],514 unmodified lines570 });571 572 const vellum = ProjectName.make("vellum");573 578-/** A `Client` of a fresh dev world with its fixtures, signed in as `handle` (or as nobody). */579-const fixturesClient = (handle?: string) =>580- Layer.unwrap(581- Effect.gen(function* () {582- const { dispose, handler } = devServer({ fixtures: "on" });583-584- yield* Effect.addFinalizer(() => Effect.promise(dispose));585-586- return Layer.effect(Client)(RpcClient.make(Contracts)).pipe(587- Layer.provide(588- RpcClient.layerProtocolHttp({589- transformClient: HttpClient.mapRequest((request) =>590- handle === undefined591- ? request592- : HttpClientRequest.bearerToken(593- request,594- devToken(Handle.make(handle))595- )596- ),597- url: "http://localhost/rpc",598- })599- ),600- Layer.provide([FetchHttpClient.layer, RpcSerialization.layerJson]),601- Layer.provide(602- Layer.succeed(FetchHttpClient.Fetch, (input, init) =>603- handler(new Request(input, init))604- )605- )606- );607- })608- );609-574 /** The page the route renders from what `readToday` sent, as the browser decodes it. */575 const pageFrom = (encoded: typeof TodayPageData.Encoded) => {576 const data = Schema.decodeSync(TodayPageData)(encoded);577 51 unmodified lines