Skip to content
Myr

Home: each claim by its want with its next command, answers paired across projects, and blocks that say when the platform did not answer

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

Review fixes for /home: a claim row leads with its ask's want (showAsk), carries its check command or its refusal's next, and a retryable refusal turns back. An ask id held in two projects reads its answers per project (status with a project), so no answer is lost or misplaced. A Today that did not come, or asks that did not come, say so rather than hiding the block or reading as none. Claim states and an outcome's row state are one map each, shared with the refs page and the ask row.

authored by oscabriel · committed by oscabriel · parent b229cdb · Browse files · 8 files+927 added−332 removed
This commit

State

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

Diff stats

8 files+927 added−332 removed

  • tests:+367 added−92 removed
  • other:+560 added−240 removed

8 files+927 added−332 removed

modified:apps/web/src/features/code/refs-view.tsx+8 added-12 removed
10 unmodified lines
11 * 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 */15import type { ClaimState } from "@repo/protocol/domain/claim";15import { packageOf } from "@repo/protocol/domain/code";16import type {17 ForkRef,18 RefsView as Refs,
8 unmodified lines
27import { FactBlock } from "../shared/facts.tsx";28import { HandleLink } from "../shared/handle.tsx";29import { AppLink } from "../shared/link.tsx";30import { answerPath, personPath } from "../shared/paths.ts";32import { MetaCode, MetaLine, Row, RowGroup, RowList } from "../shared/row.tsx";33import type { RowState } from "../shared/row.tsx";31import {32 CLAIM_STATES,33 MetaCode,34 MetaLine,35 Row,36 RowGroup,37 RowList,38} from "../shared/row.tsx";39import { Workspace } from "../shared/shell/workspace.tsx";40import { Pager } from "./pager.tsx";41import { commitHref, shortSha, treeHref } from "./paths.ts";42
75 unmodified lines
118 <HandleLink handle={handle} />119 </span>120);121117/** Each claim state as a row says it: its mark and its word. */118const 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>;125122/** A group of rows, or what it would hold said plainly when it holds none. */123const Group = ({124 children,125 counts,
318 unmodified lines
modified:apps/web/src/features/home/home-page.tsx+272 added-181 removed
1/**2 * A signed-in reader's own page: their claims, each with where its answer3 * stands; the decisions waiting for them when they decide somewhere; the4 * open asks they may take; and the way to their record. No score and no5 * count of credit (DESIGN.md). Signed out, it says what the page is and how6 * to sign in. A view: what the server read, and the instant, in; markup out.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 */9import { Brand } from "@repo/brand";9import type { AnswerView } from "@repo/protocol/domain/answer";10import type { ClaimState, ClaimView } from "@repo/protocol/domain/claim";10import type { Today } from "@repo/protocol/domain/decision";11import type { FrontPageEntry } from "@repo/protocol/domain/front-page";12import { Outcome } from "@repo/protocol/domain/outcome";13import type { Handle } from "@repo/protocol/ids";15import { Array as Arr, DateTime } from "effect";14import type { DateTime } from "effect";15import type { ReactNode } from "react";1617import { signInHref } from "../auth/session-slot.tsx";18import {19 decisionHref,20 decisionKey,21 describeSubject,22 subjectKind,23} from "../decision/subject.ts";24import { CommandLine } from "../shared/command.tsx";25import { CopyAction } from "../shared/copy-action.tsx";26import { EmptyState } from "../shared/empty.tsx";27import { HandleLink } from "../shared/handle.tsx";28import { AppLink } from "../shared/link.tsx";29import {30 answerPath,31 ASKS_PATH,
1 unmodified line
33 HOME_PATH,34 personPath,35} from "../shared/paths.ts";36import { UnreachableNotice } from "../shared/pending.tsx";34import { AskRow, MetaCode, MetaLine, Row, RowGroup } from "../shared/row.tsx";35import type { RowState } from "../shared/row.tsx";37import {38 AskRow,39 CLAIM_STATES,40 MetaCode,41 MetaLine,42 outcomeState,43 Row,44 RowGroup,45} from "../shared/row.tsx";46import { Workspace } from "../shared/shell/workspace.tsx";47import { When } from "../shared/time.tsx";48import { orderDecisions } from "../today/read.ts";39import { HomeRead } from "./read.ts";49import {50 Decisions,51 HomeRead,52 isRunning,53 Takeable,54 WORK_SHOWN,55} from "./read.ts";56import type { Work } from "./read.ts";5758/** What the page is, said to a reader who is not signed in. */59const 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.";
3 unmodified lines
6465const LINK =66 "decoration-rule hover:decoration-foreground font-medium underline underline-offset-4";6751/** A claim still running: its holder's to push to. */52const running = (claim: ClaimView) =>53 claim.state === "live" || claim.state === "warned";68/** A block's empty state, under its header like its rows would be. */69const Empty = (props: Parameters<typeof EmptyState>[0]) => (70 <li className="pt-3">71 <EmptyState {...props} />72 </li>73);7455/** An answer's latest outcome as a row's state. */56const outcomeState = (answer: AnswerView): RowState =>57 Outcome.match(answer.outcome, {58 AwaitingDecision: (): RowState => ({ mark: "waiting", word: "Waiting" }),59 AwaitingFinish: (): RowState => ({ mark: "waiting", word: "Waiting" }),60 Checking: (): RowState => ({ mark: "checking", word: "Checking" }),61 Landed: (): RowState => ({ mark: "landed", word: "Landed" }),62 Refused: (): RowState => ({ mark: "refused", word: "Refused" }),63 WaitingOnParent: (): RowState => ({ mark: "waiting", word: "Waiting" }),64 });6566/** A claim with no answer yet, as a row's state. */67const CLAIM_STATES = {68 answered: { mark: "passed", word: "Answered" },69 lapsed: { mark: "notNeeded", word: "Lapsed" },70 live: { mark: "claimed", word: "Claimed" },71 released: { mark: "notNeeded", word: "Released" },72 warned: { mark: "waiting", word: "Push soon" },73} as const satisfies Record<ClaimState, RowState>;7475/**76 * Each claim's latest answer. An answer names its ask but not its project,77 * so it is matched only where one claim of the reader's holds that ask.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 */79const latestAnswers = (80 claims: readonly ClaimView[],81 answers: readonly AnswerView[]82): ReadonlyMap<ClaimView, AnswerView> => {83 const byAsk = Arr.groupBy(claims, ({ ask }) => ask);79const 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 }8885 return new Map(86 claims.flatMap((claim) => {87 if ((byAsk[claim.ask]?.length ?? 0) !== 1) {88 return [];89 }89 return isRunning(claim)90 ? { command: claim.checkCommand, label: "Copy check command" }91 : undefined;92};9391 const [latest] = answers92 .filter(({ ask }) => ask === claim.ask)93 .toSorted(94 (a, b) => DateTime.toEpochMillis(b.at) - DateTime.toEpochMillis(a.at)95 );94const 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);10397 return latest === undefined ? [] : [[claim, latest] as const];98 })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};144102/** Running claims first, then the newest. */103const claimOrder = (a: ClaimView, b: ClaimView) =>104 Number(running(b)) - Number(running(a)) ||105 DateTime.toEpochMillis(b.openedAt) - DateTime.toEpochMillis(a.openedAt);106107const ClaimRows = ({108 answers,145const WorkRows = ({146 asks,109 claims,147 now,148 read,149}: {112 readonly answers: readonly AnswerView[];113 readonly claims: readonly ClaimView[];150 readonly asks: Takeable;151 readonly now: DateTime.Utc;152 readonly read: typeof HomeRead.cases.Read.Type;153}) => {116 const latest = latestAnswers(claims, answers);154 const [first] = Takeable.match(asks, {155 Listed: ({ asks: listed }) => listed,156 Unreachable: () => [],157 });158159 return (119 <RowGroup120 counts={`${claims.filter(running).length} running`}121 label="Your claims"122 name="Your claims"123 under="bar"124 >125 {claims.toSorted(claimOrder).map((claim) => {126 const answer = latest.get(claim);127128 return (129 <Row130 data={{131 "data-claim": claim.ask,132 "data-project": claim.project,133 "data-state": claim.state,134 }}135 href={136 answer === undefined137 ? askPath(claim.project, claim.ask)138 : answerPath(claim.project, claim.ask)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 }140 id={`${claim.project}/${claim.ask}`}141 key={`${claim.project}/${claim.ask}`}142 meta={143 <MetaLine144 parts={[145 claim.project,146 <MetaCode key="fork">{claim.fork}</MetaCode>,147 running(claim) ? (148 <span key="lapses">149 lapses <When at={claim.lapsesAt} now={now} />150 </span>151 ) : undefined,152 ]}153 />174 onward={175 <AppLink className={LINK} to={ASKS_PATH}>176 The open asks177 </AppLink>178 }155 mono156 state={157 answer === undefined158 ? CLAIM_STATES[claim.state]159 : outcomeState(answer)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 }161 title={claim.ask}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 />163 );164 })}165 </RowGroup>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};206169const DecisionRows = ({ today }: { readonly today: Today }) => {207const 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);235236const TODAY_LINK = (237 <AppLink className={LINK} to="/today">238 Today239 </AppLink>240);241242const 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);258259/** A decider's waiting decisions, or that none waits. */260const Waiting = ({ today }: { readonly today: Today }) => {261 const waiting = today.decisions.length + today.overflow;262263 return (173 <RowGroup174 counts={`${waiting} waiting`}175 label="Decisions waiting"176 name={<AppLink to="/today">Decisions waiting</AppLink>}177 under="bar"178 >179 {orderDecisions(today)180 .slice(0, DECISIONS_SHOWN)181 .map((decision) => (182 <Row183 data={{184 "data-decision": decision.id,185 "data-project": decision.project,186 }}187 href={decisionHref(decision)}188 id={`${decision.project}/${decision.id}`}189 key={`${decision.project}/${decision.id}`}190 meta={191 <MetaLine192 parts={[193 decision.project,194 subjectKind(decision.subject),195 <MetaCode key="id">{decision.id}</MetaCode>,196 ]}197 />198 }199 state={{ mark: "now", word: "Yours to decide" }}200 title={describeSubject(decision.subject)}201 />202 ))}203 </RowGroup>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};276277/** The decisions block: a decider's waiting decisions; nothing for anyone else. */278const 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 });292207const AskRows = ({ asks }: { readonly asks: readonly FrontPageEntry[] }) => (293const 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 ));303304const EVERY_ASK = (305 <AppLink className={LINK} to={ASKS_PATH}>306 Every open ask307 </AppLink>308);309310/** The asks block's empty state: none to take, or none came. */311const NoAsks = ({ title }: { readonly title: string }) => (312 <Empty command={`${Brand.cli} front`} onward={EVERY_ASK} title={title} />313);314315/** The asks the reader may take, or why none shows. */316const 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 });328329const 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 >213 {asks.map(({ ask, project }) => (214 <AskRow215 key={`${project}/${ask.ask}`}216 listing={ask}217 project={project}218 showProject219 takeable220 />221 ))}335 <AskList asks={asks} />336 </RowGroup>337);338225/** The way to the reader's record. */339/** Who is signed in, and the way to their record. */340const Record = ({ handle }: { readonly handle: Handle }) => (341 <>228 Signed in as {handle}.{" "}342 Signed in as <HandleLink handle={handle} />.{" "}343 <AppLink className={LINK} to={personPath(handle)}>344 Your record345 </AppLink>346 </>347);348235const Signed = ({236 read,349const SignedIn = ({350 now,351 read,352}: {239 readonly read: typeof HomeRead.cases.Read.Type;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">249 {read.claims.length === 0 ? (250 <EmptyState251 command={`${Brand.cli} front`}252 onward={253 <AppLink className={LINK} to={ASKS_PATH}>254 The open asks255 </AppLink>256 }257 title="You hold no claim. Find an ask to take, then claim it."258 />259 ) : (260 <ClaimRows answers={read.answers} claims={read.claims} now={now} />261 )}262 {read.today === undefined ? null : <DecisionRows today={read.today} />}263 {read.asks.length === 0 ? (264 <EmptyState265 onward={266 <AppLink className={LINK} to={ASKS_PATH}>267 Every open ask268 </AppLink>269 }270 title="No open ask is yours to take right now."271 />272 ) : (273 <AskRows asks={read.asks} />274 )}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
20 unmodified lines
390 readonly now: DateTime.Utc;391 readonly read: HomeRead;392}) =>393 HomeRead.match(read, {303 Read: (signed) => <Signed now={now} read={signed} />,394 Read: (signed) => <SignedIn now={now} read={signed} />,395 SignedOut: () => <SignedOut />,396 Unreachable: () => (397 <Workspace crumbs={[{ label: "Home" }]} title="Home">398 <UnreachableNotice />
3 unmodified lines
modified:apps/web/src/features/home/read.ts+249 added-34 removed
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 claims and answers (`status`), their Today when6 * they decide somewhere, the open asks they may take (`frontPage`, read7 * as them), or why there is none of it.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 */12import { Client } from "@repo/protocol/contracts";
1 unmodified line
14import { ClaimView } from "@repo/protocol/domain/claim";15import { Today } from "@repo/protocol/domain/decision";16import { FrontPageEntry } from "@repo/protocol/domain/front-page";17import { Handle } from "@repo/protocol/ids";17import { Unauthenticated } from "@repo/protocol/principal";18import { Cause, DateTime, Effect, Exit, Option, Schema } from "effect";18import type { ProjectName } from "@repo/protocol/ids";19import { NotDecider } from "@repo/protocol/refusal";20import {21 Array as Arr,22 Cause,23 DateTime,24 Effect,25 Exit,26 Option,27 Order,28 Schema,29} from "effect";3031import { isSignedOut } from "../today/read.ts";3233/** The asks the page lists: the first few the reader may take; the rest are at `/asks`. */34const ASKS_SHOWN = 8;3536/** The claims the page lists, running first, then the newest; the rest are in `status`. */37export const WORK_SHOWN = 10;3839/** How many reads of one kind the page makes at once. */40const AT_ONCE = 4;4142/** One claim of the reader's, its ask's want, and its latest answer. */43export 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});4950export type Work = typeof Work.Type;5152/** The decisions block: the reader's Today, or why there is none. */53export const Decisions = Schema.TaggedUnion({54 Decides: { today: Today },55 NotDecider: {},56 Unreachable: {},57});5859export type Decisions = typeof Decisions.Type;6061/** The asks block: the first the reader may take, or that the list did not come. */62export const Takeable = Schema.TaggedUnion({63 Listed: { asks: Schema.Array(FrontPageEntry) },64 Unreachable: {},65});6667export type Takeable = typeof Takeable.Type;6869/** What the page read for its reader: their work, or why there is none. */70export const HomeRead = Schema.TaggedUnion({71 Read: {26 answers: Schema.Array(AnswerView),27 asks: Schema.Array(FrontPageEntry),28 claims: Schema.Array(ClaimView),72 asks: Takeable,73 decisions: Decisions,74 handle: Handle,30 /** Absent for a reader who decides nowhere, or whose Today did not come. */31 today: Schema.optionalKey(Today),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});
7 unmodified lines
91});9293export type HomePageData = typeof HomePageData.Type;9447const isUnauthenticated = Schema.is(Unauthenticated);95/** A claim still running: its holder's to push to. */96export const isRunning = (claim: ClaimView) =>97 claim.state === "live" || claim.state === "warned";9849/** A failed `status`, as the page says it: signed out, or the platform did not answer. */50const readOfCause = (cause: Cause.Cause<unknown>): HomeRead =>51 Option.exists(Cause.findErrorOption(cause), isUnauthenticated)52 ? HomeRead.cases.SignedOut.make({})53 : HomeRead.cases.Unreachable.make({});99const openedOrder = Order.mapInput(100 DateTime.Order,101 (claim: ClaimView) => claim.openedAt102);103104/** Running claims first, then the newest. */105const workOrder: Order.Order<ClaimView> = Order.combine(106 Order.mapInput(Order.Boolean, (claim: ClaimView) => !isRunning(claim)),107 Order.flip(openedOrder)108);109110const answerOrder = Order.mapInput(111 DateTime.Order,112 (answer: AnswerView) => answer.at113);114115const isNotDecider = Schema.is(NotDecider);116117/** Where a claim's ask lives: one key per (project, ask). */118export const askKey = ({ ask, project }: ClaimView) => `${project}/${ask}`;119120/**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 */125const 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 );132133/** The reader's answers in each of `projects`; a project that did not answer gives none. */134const answersIn = (projects: readonly ProjectName[]) =>135 Effect.gen(function* () {136 const client = yield* Client;137138 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 });150151/** Each shown claim's ask's want, by `askKey`; an ask that did not come is left out. */152const 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));156157 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 });169170/** The claims the page lists: running first, then the newest, the first `WORK_SHOWN`. */171const shownOf = (claims: readonly ClaimView[]) =>172 Arr.sort(claims, workOrder).slice(0, WORK_SHOWN);173174/**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 */180export 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);192193 /** 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 );199200 const answerOf = (claim: ClaimView) => {201 if (newest.get(askKey(claim)) !== claim) {202 return Option.none();203 }204205 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 );212213 return Option.fromUndefinedOr(latest);214 };215216 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};228229/** `pairWork` over what the platform answers: the wants, and answers read again where needed. */230const workOf = (claims: readonly ClaimView[], answers: readonly AnswerView[]) =>231 Effect.gen(function* () {232 const shown = shownOf(claims);233 const shared = sharedAsks(claims);234235 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 );248249 return pairWork({ again, answers, claims, wants });250 });251252/** The reader's home, or why there is none, encoded for the page. */253export const readHome = Effect.gen(function* () {254 const client = yield* Client;255256 const [status, today, front] = yield* Effect.all(257 [258 Effect.exit(client.status({})),62 // A reader who decides nowhere has no Today: the block is left out.63 Effect.option(client.today({})),259 Effect.exit(client.today({})),260 Effect.option(client.frontPage({})),261 ],262 { concurrency: "unbounded" }263 );26469 const read = Exit.match(status, {70 onFailure: readOfCause,71 onSuccess: ({ answers, claims, handle }) =>72 HomeRead.cases.Read.make({73 answers,74 asks: Option.match(front, {75 onNone: () => [],76 onSome: ({ entries }) =>77 entries.filter(({ takeable }) => takeable).slice(0, ASKS_SHOWN),78 }),79 claims,80 handle,81 ...Option.match(today, {82 onNone: () => ({}),83 onSome: (decisions) => ({ today: decisions }),84 }),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 });272273 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 });280281 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 });302303 return yield* Schema.encodeEffect(HomePageData)({304 now: yield* DateTime.now,305 read,306 });
1 unmodified line
modified:apps/web/src/features/shared/row.tsx+26 added-12 removed
18 unmodified lines
19 * press. `j` and `k` reach each row's link (`data-list-key`). Every20 * `data-*` a list carries sits on the row's `<li>`.21 */22import type { AskListing } from "@repo/protocol/domain/ask";23import type { ClaimState } from "@repo/protocol/domain/claim";24import { Outcome } from "@repo/protocol/domain/outcome";25import type { ProjectName } from "@repo/protocol/ids";26import type { MouseEvent, ReactNode } from "react";27import { Fragment } from "react";
269 unmodified lines
297 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 lines
360361 return { clear, focused, select, selected };362};363364/** An answer's latest outcome as a row's state: a retryable refusal turns back. */365export 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 });377378/** Each claim state as a row says it: its mark and its word. */379export 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>;386387/** Where an open ask stands for its reader, as a row's state. */388const askState = (389 listing: AskListing,390 takeable: boolean | undefined,
3 unmodified lines
394 return { mark: "landed", word: "Landed" };395 }396397 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 }400401 if (listing.claimed || progress?.claimant !== undefined) {402 return { mark: "claimed", word: "Claimed" };
97 unmodified lines
modified:apps/web/src/features/today/read.ts+5 added-1 removed
added:apps/web/test/dev-client.ts+43 added
modified:apps/web/test/home.test.tsx+322 added-54 removed
1/**2 * `/home`, a signed-in reader's own page, read on the server with their3 * session from the dev world and its fixtures: their claims with where each4 * answer stands, the decisions waiting when they decide somewhere, the asks5 * they may take, and their record. Signed out, it says what the page is6 * and how to sign in. A page about its reader, kept by no cache.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 */10import { describe, expect, it } from "@effect/vitest";11import { Brand } from "@repo/brand";10import { Client, Contracts } from "@repo/protocol/contracts";11import { Handle } from "@repo/protocol/ids";12import { Effect, Layer, Schema } from "effect";13import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";14import { RpcClient, RpcSerialization } from "effect/rpc";12import type { AnswerView } from "@repo/protocol/domain/answer";13import { ClaimView } from "@repo/protocol/domain/claim";14import { DecisionSubject, Today } from "@repo/protocol/domain/decision";15import { FrontPageEntry } from "@repo/protocol/domain/front-page";16import { Outcome } from "@repo/protocol/domain/outcome";17import {18 AskId,19 CommitSha,20 Handle,21 ProjectName,22 RequestId,23} from "@repo/protocol/ids";24import { ClaimLapsed } from "@repo/protocol/refusal";25import { DateTime, Effect, Schema } from "effect";2616import { devServer } from "../src/dev/server.ts";17import { devToken } from "../src/dev/sessions.ts";27import { HomeView } from "../src/features/home/home-page.tsx";19import { HomePageData, readHome } from "../src/features/home/read.ts";28import {29 askKey,30 Decisions,31 HomePageData,32 HomeRead,33 pairWork,34 readHome,35 Takeable,36} from "../src/features/home/read.ts";37import { homeHeaders, Route } from "../src/routes/home.tsx";38import { fixturesClient } from "./dev-client.ts";39import { textIn } from "./markup.ts";40import { renderAt } from "./render.tsx";4123/** A `Client` of a fresh dev world with its fixtures, signed in as `handle` (or as nobody). */24const fixturesClient = (handle?: string) =>25 Layer.unwrap(26 Effect.gen(function* () {27 const { dispose, handler } = devServer({ fixtures: "on" });42const NOW = "2026-10-07T12:00:00.000Z";4329 yield* Effect.addFinalizer(() => Effect.promise(dispose));3031 return Layer.effect(Client)(RpcClient.make(Contracts)).pipe(32 Layer.provide(33 RpcClient.layerProtocolHttp({34 transformClient: HttpClient.mapRequest((request) =>35 handle === undefined36 ? request37 : HttpClientRequest.bearerToken(38 request,39 devToken(Handle.make(handle))40 )41 ),42 url: "http://localhost/rpc",43 })44 ),45 Layer.provide([FetchHttpClient.layer, RpcSerialization.layerJson]),46 Layer.provide(47 Layer.succeed(FetchHttpClient.Fetch, (input, init) =>48 handler(new Request(input, init))49 )50 )51 );52 })53 );5455/** The page as the route renders it from what `readHome` sent. */44/** The page as the route renders it from what the loader sent. */45const pageFrom = (encoded: typeof HomePageData.Encoded) =>46 Effect.gen(function* () {47 const data = yield* Schema.decodeEffect(HomePageData)(encoded);48
2 unmodified lines
51 <HomeView now={data.now} read={data.read} />52 );53 });5466const textIn = (markup: string) =>67 markup68 .replaceAll(/<[^>]+>/gu, " ")69 .replaceAll("&#x27;", "'")70 .replaceAll(/\s+/gu, " ")71 .trim();55/** The page drawn from a signed-in read made here. */56const 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 );7273/** The sections' names, in order. */74const sectionsOf = (markup: string) =>75 [...markup.matchAll(/<section\b[^>]*aria-label="(?<name>[^"]+)"/gu)].map(76 (found) => found.groups?.name77 );7879/** The commands a reader can copy: each in the DOM as text. */80const commandsOf = (markup: string) =>81 [...markup.matchAll(/<code\b[^>]*>(?<command>.*?)<\/code>/gsu)].map((found) =>82 textIn(found.groups?.command ?? "").trim()83 );8485const 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 });100101/** An answer refused because its claim lapsed, which a new claim can mend. */102const 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});111112const 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});122123const 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});135136const 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});149150describe(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 });173174 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 );188189 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 });197198 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 );210211 it.effect("leaves the decisions out for a reader who decides nowhere", () =>212 Effect.gen(function* () {213 const markup = yield* pageOf({});214215 expect(sectionsOf(markup)).toStrictEqual([216 "Your work",217 "Asks you may take",218 ]);219 })220 );221222 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 });230231 const text = textIn(markup);232233 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 );241242 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 });249250 expect(textIn(markup)).toContain("You hold no claim.");251 expect(commandsOf(markup)).toContain(252 `${Brand.cli} claim split-format --project burrow`253 );254 })255 );256257 it.effect("links the reader's handle and their record", () =>258 Effect.gen(function* () {259 const markup = yield* pageOf({});260261 expect(textIn(markup)).toContain("Signed in as bram.");262 expect(markup).toContain('href="/people/bram"');263 })264 );265266 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 });275276 expect(textIn(markup)).toContain("The newest 10 of your 14 claims");277 expect(commandsOf(markup)).toContain(`${Brand.cli} status`);278 })279 );280});281282describe(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 });288289 const newer = claim();290 const answer = refused("fix-week-start");291292 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 });300301 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 });312313 it("reads an ask held in two projects from each project's own answers", () => {314 const inDatekit = claim();315316 const inBurrow = claim({317 fork: "burrow--fix-week-start--bram",318 project: "burrow",319 });320321 const datekitAnswer = refused("fix-week-start");322323 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 });333334 expect(335 work.map(({ answer, claim: held }) => [held.project, answer])336 ).toStrictEqual([337 ["datekit", datekitAnswer],338 ["burrow", undefined],339 ]);340 });341});342343describe("home, read on the server with the reader's session", () => {344 it.live(81 "gives a contributor their claims, the asks they may take and their record, and no decisions",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);349350 expect(sectionsOf(markup)).toStrictEqual([87 "Your claims",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"');
7 unmodified lines
363 () =>364 Effect.gen(function* () {365 const markup = yield* pageFrom(yield* readHome);366103 expect(sectionsOf(markup)).toContain("Decisions waiting");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_000
24 unmodified lines
modified:apps/web/test/today.test.tsx+2 added-38 removed
9 unmodified lines
10 * loader over the dev world with its fixtures, signed in as a decider.11 */12import { describe, expect, it } from "@effect/vitest";13import { Brand } from "@repo/brand";14import { Client, Contracts } from "@repo/protocol/contracts";14import { RefNameText } from "@repo/protocol/domain/common";15import { DecisionSubject } from "@repo/protocol/domain/decision";16import type { Choice, Decision, Today } from "@repo/protocol/domain/decision";17import type { LandingView } from "@repo/protocol/domain/landing";
9 unmodified lines
27 RatchetName,28 RepoPath,29} from "@repo/protocol/ids";30import { DecisionClosed, NotDecider } from "@repo/protocol/refusal";32import { Cause, DateTime, Effect, Layer, Schema } from "effect";33import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";31import { Cause, DateTime, Effect, Schema } from "effect";32import { AsyncResult } from "effect/reactivity";35import { RpcClient, RpcSerialization } from "effect/rpc";33import type { ReactElement } from "react";34import { renderToStaticMarkup } from "react-dom/server";3539import { devServer } from "../src/dev/server.ts";40import { devToken } from "../src/dev/sessions.ts";36import {37 allowedChoices,38 consequenceOf,39 describeSubject,
7 unmodified lines
47 TodayRead,48 TodayView,49} from "../src/features/today/today-page.tsx";50import { Route, todayHeaders } from "../src/routes/today.tsx";51import { fixturesClient } from "./dev-client.ts";5253/** The entities React writes for text, and what each reads as. */54const ENTITIES: ReadonlyMap<string, string> = new Map([55 ["&#x27;", "'"],
514 unmodified lines
570});571572const vellum = ProjectName.make("vellum");573578/** A `Client` of a fresh dev world with its fixtures, signed in as `handle` (or as nobody). */579const fixturesClient = (handle?: string) =>580 Layer.unwrap(581 Effect.gen(function* () {582 const { dispose, handler } = devServer({ fixtures: "on" });583584 yield* Effect.addFinalizer(() => Effect.promise(dispose));585586 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 );609574/** The page the route renders from what `readToday` sent, as the browser decodes it. */575const pageFrom = (encoded: typeof TodayPageData.Encoded) => {576 const data = Schema.decodeSync(TodayPageData)(encoded);577
51 unmodified lines