Skip to content
Myr

Call the Code tab's second view History, not Commits, and the page History of main, of a fork or at a tag: git's first-parent log with the platform's landing record where one exists, filtered to Landings (the default on main), Answers, Ask openings or Every commit, with one marker row at the first commit no landing records, Adopted here, in place of before adoption on every row, the Landings filter paging no further than that commit, and a day's rows counted as landings when every one is; make the ref switcher a revision picker reading At main, At v1.2.0 or At handle/ask, with no branch mark or heading, Answers in claim forks, and a field that finds a tag or answer; point the Landings tab at /commits/main?show=landings and put the history and a commit under it, so the tab bar and the crumb agree, the code bar drawn on every code page whichever tab it sits under; fade the tab strip's right edge on a phone as the cue that more tabs lie off screen; and let a person's area links follow the tab

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

authored by oscabriel · committed by oscabriel · parent f37c629 · Browse files · 19 files+467 added−126 removed
This commit

State

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

Diff stats

19 files+467 added−126 removed

  • tests:+282 added−28 removed
  • other:+185 added−98 removed

19 files+467 added−126 removed

modified:apps/web/src/features/code/code-address.ts+2 added-2 removed
modified:apps/web/src/features/code/code-bar.tsx+3 added-3 removed
1/**2 * The Code tab's own bar, under the project's header (ADR 0041): Files or3 * Commits, the ref switcher, the revision's head commit, Go to file and3 * History, the ref switcher, the revision's head commit, Go to file and4 * Clone. Below `columns` it also opens the file tree as a sheet. It reads5 * where it is from the path, and the head commit from the page's own read.6 */7import { CommitView } from "@repo/protocol/domain/code";
87 unmodified lines
95 const view = codeViewOf(address.page);9697 return (98 <nav99 aria-label="Files or commits"99 aria-label="Files or history"100 className="border-input flex shrink-0 border"101 >102 <AppLink103 aria-current={view === "files" ? "page" : undefined}
6 unmodified lines
110 aria-current={view === "commits" ? "page" : undefined}111 className={SEGMENT}112 to={commitsHref(project, address.rev)}113 >114 Commits114 History115 </AppLink>116 </nav>117 );118};
149 unmodified lines
modified:apps/web/src/features/code/log-page.ts+18 added
modified:apps/web/src/features/code/log-view.tsx+83 added-25 removed
1/**2 * The history of a revision: git's first-parent log, newest first, with the3 * platform's landing record on each commit that has one. On main the landings4 * run unbroken from the top down to the adoption, so the commits below the5 * first one without a record came with the import, and one marker row says so6 * in their place.7 */8import type { CommitView } from "@repo/protocol/domain/code";9import type { ProjectName, RepoPath } from "@repo/protocol/ids";10import { DateTime, Option } from "effect";11import { LockKeyhole } from "lucide-react";12import { Fragment } from "react";13import type { ReactNode } from "react";1415import { CompactCredit } from "../shared/credits.tsx";16import { EmptyState } from "../shared/empty.tsx";
2 unmodified lines
19import { MetaCode, MetaLine, Row, RowGroup } from "../shared/row.tsx";20import { Workspace } from "../shared/shell/workspace.tsx";21import { When } from "../shared/time.tsx";22import { askOf } from "../why/rows.ts";15import { LOG_PAGE } from "./log-page.ts";23import { defaultShowOf, LOG_PAGE } from "./log-page.ts";24import type { LogShow } from "./log-page.ts";25import { Pager } from "./pager.tsx";26import { blobHref, commitHref, commitsHref, shortSha } from "./paths.ts";18import { pinnedRev, revLabel } from "./rev.ts";27import { isForkRev, pinnedRev, revLabel } from "./rev.ts";2820export type LogShow = "all" | "answers" | "openings";29export type { LogShow } from "./log-page.ts";3031const dayWords = new Intl.DateTimeFormat("en", {32 dateStyle: "long",33 timeZone: "UTC",
20 unmodified lines
54 commit.landing === undefined55 ? undefined56 : Option.getOrUndefined(askOf(commit.landing));5758const isLanding = (commit: CommitView) => commit.landing !== undefined;5960export const shows = (show: LogShow, commit: CommitView) => {61 if (show === "all") {62 return true;63 }6465 if (show === "landings") {66 return isLanding(commit);67 }6869 const linked = linkedOf(commit);7071 return show === "openings"72 ? linked?.kind === "opened"73 : linked?.kind === "answers";74};7576/**77 * The commit the adoption's marker stands over: the first on the page with no78 * landing record that follows one with. Landings run unbroken from main's top79 * down to the adoption, and a fork's own commits sit above them, so the first80 * break after a landing is where the import's history begins.81 */82export const adoptedAt = (83 commits: readonly CommitView[]84): CommitView | undefined =>85 commits.find(86 (commit, at) =>87 !isLanding(commit) && at > 0 && isLanding(commits[at - 1] ?? commit)88 );8990const LINK = "decoration-rule underline hover:decoration-current";9192const Raised = ({ children }: { readonly children: ReactNode }) => (93 <span className="relative z-[1]">{children}</span>94);9596const AdoptedHere = ({ sha }: { readonly sha: string }) => (97 <li98 className="border-rule text-ui text-muted-foreground -mx-2 border-b px-2 py-2"99 data-adopted={sha}100 >101 Adopted here. The commits below came with the import; no landing records102 them.103 </li>104);105106const CommitRow = ({107 commit,108 now,109 project,
21 unmodified lines
131 href={commitHref(project, pinnedRev(rev, commit.sha))}132 id={commit.sha}133 meta={134 landing === undefined ? (96 <MetaLine parts={[commit.author.name, "before adoption"]} />135 <MetaLine parts={[commit.author.name]} />136 ) : (137 <MetaLine138 parts={[139 linked === undefined ? undefined : (
40 unmodified lines
180const newerPage = (from: number, path: RepoPath | undefined) =>181 path === undefined ? { from: Math.max(0, from - LOG_PAGE) } : { path };182183const FILTERS = [145 { label: "All", show: "all" },184 { label: "Landings", show: "landings" },185 { label: "Answers", show: "answers" },186 { label: "Ask openings", show: "openings" },187 { label: "Every commit", show: "all" },188] as const satisfies readonly {189 readonly label: string;190 readonly show: LogShow;191}[];192193const FILTER =194 "text-ui text-muted-foreground hover:text-foreground aria-[current]:text-foreground flex h-10 items-center border-b-2 border-transparent px-1 no-underline aria-[current]:border-current aria-[current]:font-semibold";195196/** "History of" a path, main or a fork, whose history moves; "History at" a tag or a commit, which stands still. */156const titleOf = (path: RepoPath | undefined, rev: string) => {197export const titleOf = (path: RepoPath | undefined, rev: string) => {198 if (path !== undefined) {199 return `History of ${path}`;200 }201161 return rev === "main" ? "Landings" : `Landings on ${revLabel(rev)}`;202 return rev === "main" || isForkRev(rev)203 ? `History of ${revLabel(rev)}`204 : `History at ${revLabel(rev)}`;205};206164const searchFor = (query: string, show: LogShow) => {207const searchFor = (query: string, show: LogShow, fallback: LogShow) => {208 const search: Record<string, string> = Object.fromEntries(209 new URLSearchParams(query)210 );211169 if (show !== "all") {212 if (show !== fallback) {213 search.show = show;214 }215216 return search;217};218219const countsOf = (ofDay: readonly CommitView[]) => {220 const noun = ofDay.every(isLanding) ? "landing" : "commit";221222 return `${ofDay.length} ${ofDay.length === 1 ? noun : `${noun}s`}`;223};224225export interface LogViewProps {226 readonly commits: readonly CommitView[];227 readonly from: number;228 readonly next?: number | undefined;
11 unmodified lines
240 now,241 path,242 project,243 rev,195 show = "all",244 show = defaultShowOf(rev, path),245}: LogViewProps) => {246 const fallback = defaultShowOf(rev, path);247 const filter = path === undefined ? {} : { path };198 const kind = show === "all" ? {} : { show };248 const kind = show === fallback ? {} : { show };249 const shown = commits.filter((commit) => shows(show, commit));250 const adopted = show === "all" ? adoptedAt(commits) : undefined;251 const base = commitsHref(project, rev, filter);252 const [to, query = ""] = base.split("?");253254 // The landings end at the adoption: once a page holds a commit no landing255 // records, no older page holds one either.256 const older =257 next === undefined || (show === "landings" && !commits.every(isLanding))258 ? undefined259 : commitsHref(project, rev, { ...filter, ...kind, from: next });260261 return (262 <Workspace263 title={titleOf(path, rev)}264 toolbar={
2 unmodified lines
267 <AppLink268 aria-current={show === each ? "page" : undefined}269 className={FILTER}270 key={each}213 search={searchFor(query, each)}271 search={searchFor(query, each, fallback)}272 to={to ?? base}273 >274 {label}275 </AppLink>
21 unmodified lines
297 <div className="flex flex-col">298 {byDay(shown).map(({ commits: ofDay, day }) => (299 <div data-day={day} key={day}>300 <RowGroup243 counts={`${ofDay.length} ${ofDay.length === 1 ? "commit" : "commits"}`}301 counts={countsOf(ofDay)}302 label={day}303 name={dayWords.format(304 DateTime.toDateUtc(ofDay[0]?.committer.at ?? now)305 )}306 >307 {ofDay.map((commit) => (308 <Fragment key={commit.sha}>309 {adopted?.sha === commit.sha ? (310 <AdoptedHere sha={commit.sha} />250 <CommitRow251 commit={commit}252 key={commit.sha}253 now={now}254 project={project}255 rev={rev}256 />311 ) : null}312 <CommitRow313 commit={commit}314 now={now}315 project={project}316 rev={rev}317 />318 </Fragment>319 ))}320 </RowGroup>321 </div>322 ))}
4 unmodified lines
327 from > 0328 ? commitsHref(project, rev, { ...newerPage(from, path), ...kind })329 : undefined330 }269 older={270 next === undefined271 ? undefined272 : commitsHref(project, rev, { ...filter, ...kind, from: next })273 }331 older={older}332 />333 </Workspace>334 );335};
modified:apps/web/src/features/code/paths.ts+2 added-1 removed
modified:apps/web/src/features/code/ref-switcher.tsx+15 added-20 removed
1/**2 * The code bar's ref switcher (ADR 0043): `main`, the project's tags, and the3 * answers in forks, each with its claimant, ask and claim state. A fork's4 * entry opens the same page in that fork, at its address5 * (`@<handle>/<ask>`), never its repo's name.2 * The code bar's revision picker (ADR 0043): `main`, the project's tags, and3 * the answers in claim forks, each with its claimant, ask and claim state. A4 * fork's entry opens the same page in that fork, at its address5 * (`@<handle>/<ask>`), never its repo's name. Its trigger reads "At main",6 * "At v1.2.0" or "At <handle>/<ask>": a tag and a fork are revisions, not7 * branches, so no branch is named and main carries no branch mark.8 */9import { forkRev } from "@repo/protocol/domain/code";10import type { ForkRef, RefsView } from "@repo/protocol/domain/code";11import type { AskId, ProjectName } from "@repo/protocol/ids";10import {11 ChevronDown,12 GitBranch,13 GitCommitHorizontal,14 GitFork,15 Tag,16} from "lucide-react";12import { ChevronDown, GitCommitHorizontal, GitFork, Tag } from "lucide-react";13import { useState } from "react";14import type { ComponentType } from "react";1516import {
11 unmodified lines
28const SHOWN = 100;2930const ICON = "size-4 shrink-0";3132/** A tag's, a commit's or a fork's mark; main has none, since it is the project itself, not a ref among refs. */33const RefMark = ({ rev }: { readonly rev: string }) => {34 if (rev === "main") {38 return <GitBranch aria-hidden="true" className={ICON} strokeWidth={1.75} />;35 return null;36 }3738 if (isForkRev(rev)) {39 return <GitFork aria-hidden="true" className={ICON} strokeWidth={1.75} />;
93 unmodified lines
133 );134135 return (136 <div className="flex max-h-80 flex-col overflow-y-auto overscroll-contain">140 <p className={GROUP}>Branch</p>137 <ul>138 <li data-ref-choice="main">139 <AppLink140 aria-current={rev === "main" ? "true" : undefined}141 className={ROW}142 onClick={onPick}143 to={hrefAt("main")}144 >149 <RefMark rev="main" />145 main146 <span className="text-label text-muted-foreground ml-auto">147 moves only by a landing148 </span>
33 unmodified lines
182 </>183 )}184 {forks.length === 0 ? null : (185 <>191 <p className={GROUP}>Answers in forks</p>186 <p className={GROUP}>Answers in claim forks</p>187 <ul>188 {forks.map((fork) => (189 <ForkEntry190 fork={fork}
40 unmodified lines
231232 return (233 <Popover onOpenChange={setOpen} open={open}>234 <PopoverTrigger240 aria-label={`Revision: ${revLabel(rev)}. Switch revision`}241 className="text-ui hover:bg-surface border-input flex h-8 max-w-[16rem] min-w-0 shrink-0 cursor-pointer items-center gap-2 border px-2"235 aria-label={`At ${revLabel(rev)}. Switch revision`}236 className="text-ui hover:bg-surface border-input flex h-8 max-w-[16rem] min-w-0 shrink-0 cursor-pointer items-center gap-1.5 border px-2"237 data-ref={rev}238 >244 <RefMark rev={rev} />239 <span className="shrink-0">At</span>240 <span241 className={`min-w-0 truncate ${rev === "main" ? "" : "text-mono font-mono"}`}242 >243 {revLabel(rev)}
5 unmodified lines
249 />250 </PopoverTrigger>251 <PopoverContent align="start" className="w-80 gap-1 p-1.5">252 <input258 aria-label="Find a tag or fork"253 aria-label="Find a tag or answer"254 className="border-input bg-background sm:text-ui h-9 w-full border px-2 text-base sm:h-8"255 onChange={(event) => {256 setFilter(event.currentTarget.value);257 }}263 placeholder="Find a tag or fork"258 placeholder="Find a tag or answer"259 value={filter}260 />261 {open ? (262 <Choices
18 unmodified lines
modified:apps/web/src/features/people/person-page.tsx+6 added-4 removed
6 unmodified lines
7import type { Handle, ProjectName } from "@repo/protocol/ids";8import { Array, Order } from "effect";910import { EmptyState } from "../shared/empty.tsx";11import { PageShell } from "../shared/layout.tsx";11import { AppLink } from "../shared/link.tsx";12import { ASKS_PATH, projectPath } from "../shared/paths.ts";13import { MetaCode, MetaLine, Row, RowGroup } from "../shared/row.tsx";14import { projectSections } from "../shared/shell/sections.ts";
73 unmodified lines
88 })),89 project: Array.headNonEmpty(inProject).project,90 }));9193/** The Landings tab's own address, its region of Overview included. */92/** The Landings tab's own address, with the filter or region it opens. */93const landingsOf = (project: ProjectName) =>94 projectSections(project).find(({ tab }) => tab === "landings") ?? {95 hash: undefined,96 search: undefined,97 to: projectPath(project),98 };99100const Project = ({ credit }: { readonly credit: ProjectCredit }) => (
6 unmodified lines
107 <Row108 data={{ "data-area": area, "data-project": credit.project }}109 hash={landingsOf(credit.project).hash}110 href={landingsOf(credit.project).to}111 search={landingsOf(credit.project).search}112 id={`${credit.project}/${area}`}113 key={area}114 meta={115 <MetaLine
44 unmodified lines
160 </Workspace>161 );162};163164/** The 404 for an address under `/people` that names no handle, drawn as a project's is. */165export const NoSuchPersonView = () => (164 <PageShell title="No such person">166 <Workspace crumbs={[{ label: "No such person" }]} title="No such person">167 <EmptyState168 onward={<AppLink to={ASKS_PATH}>Open asks</AppLink>}169 title="A handle is letters, digits and dashes, starting with a letter or digit, and this address names none."170 />169 </PageShell>171 </Workspace>172);
modified:apps/web/src/features/project/project-frame.tsx+6 added-4 removed
1/**2 * Every page of a project inside one frame: the project's header across the3 * top, the Code tab's bar under it on that tab's pages, then a page's side3 * top, the code bar under it on the code's pages (the history and a commit4 * sit under the Landings tab, yet are the code's), then a page's side5 * column (the file tree beside code, a finish's files) and the page itself.6 */7import { useLocation } from "@tanstack/react-router";8import { Option } from "effect";9import type { ReactNode } from "react";109import { projectTabOf } from "../shared/shell/sections.ts";11import { codeAddressOf } from "../code/code-address.ts";12import {13 SideColumnOutlet,14 useSideColumn,15} from "../shared/shell/side-column.tsx";
49 unmodified lines
65 codeBar,66 header,67}: {68 readonly header?: ReactNode;67 /** The Code tab's bar, drawn under the header on that tab's pages only. */69 /** The code bar, drawn under the header on every page of the code (files, history, a commit, the refs), whichever tab the page sits under. */70 readonly codeBar?: ReactNode;71 readonly children: ReactNode;72}) => {73 const column = useSideColumn() !== undefined;
1 unmodified line
7576 const code =77 header !== undefined &&78 codeBar !== undefined &&77 projectTabOf(pathname) === "code";79 Option.isSome(codeAddressOf(pathname));8081 return (82 <div83 className={`flex w-full min-w-0 flex-1 flex-col ${header === undefined ? UNDER_BAR : UNDER_HEAD}`}
23 unmodified lines
modified:apps/web/src/features/project/project-header.tsx+26 added-19 removed
271 unmodified lines
272 aria-label={`${project} tabs`}273 className={`border-rule bg-background border-b ${GUTTER}`}274 data-project-tabs=""275 >276 {/* Below `tablet` the strip scrolls with its scrollbar hidden, so a fade at its right edge is the cue that more tabs lie off screen. */}277 <div278 className="tablet:after:hidden after:from-background relative after:pointer-events-none after:absolute after:inset-y-0 after:right-0 after:w-10 after:bg-linear-to-l after:to-transparent after:content-['']"279 data-tabs-fade=""280 >276 <div className="flex [scrollbar-width:none] overflow-x-auto overscroll-x-contain">277 {projectSections(project).map(({ hash, label, tab, to }) => (278 <AppLink279 activeOptions={activeFor(hash)}280 aria-current={tab === current ? "page" : undefined}281 className={TAB}282 data-current={tab === current ? "" : undefined}283 key={tab}284 to={to}285 {...(hash === undefined ? {} : { hash })}286 >287 {label}288 {tab === "asks" && open !== undefined ? (289 <span className="text-label text-muted-foreground tabular-nums">290 {open.asks}291 </span>292 ) : null}293 </AppLink>294 ))}281 <div className="flex [scrollbar-width:none] overflow-x-auto overscroll-x-contain">282 {projectSections(project).map(({ hash, label, search, tab, to }) => (283 <AppLink284 activeOptions={activeFor(hash)}285 aria-current={tab === current ? "page" : undefined}286 className={TAB}287 data-current={tab === current ? "" : undefined}288 key={tab}289 to={to}290 {...(hash === undefined ? {} : { hash })}291 {...(search === undefined ? {} : { search })}292 >293 {label}294 {tab === "asks" && open !== undefined ? (295 <span className="text-label text-muted-foreground tabular-nums">296 {open.asks}297 </span>298 ) : null}299 </AppLink>300 ))}301 </div>302 </div>303 </nav>304);305
49 unmodified lines
modified:apps/web/src/features/shared/shell/sections.ts+12 added-9 removed
18 unmodified lines
19 readonly tab: ProjectTab;20 readonly to: string;21 /** A tab whose own page has not been built yet opens the region of Overview that holds it. */22 readonly hash?: string;23 /** A tab that opens a page's filtered view carries the filter in the query. */24 readonly search?: Readonly<Record<string, string>>;25}2627/**28 * Each tab opens a page inside the project's frame that exists today: Asks,27 * Landings, Proposals and People open their regions of Overview (the history28 * of commits is the Code tab's), Policy the policy at the address it has29 * always had, and Visibility its own page. Starting a30 * proposal is a focused page of its own, so it is Contribute's, not a tab's.29 * Proposals and People open their regions of Overview, Landings the history30 * of main shown as its landings (the Code tab's History, filtered), Policy31 * the policy at the address it has always had, and Visibility its own page.32 * Starting a proposal is a focused page of its own, so it is Contribute's,33 * not a tab's.34 */35export const projectSections = (project: string): readonly Section[] => [36 { label: "Overview", tab: "overview", to: `/${project}` },37 { label: "Code", tab: "code", to: `/${project}/tree/main` },38 { hash: "open-asks", label: "Asks", tab: "asks", to: `/${project}` },39 {37 hash: "recent-landings",40 label: "Landings",41 search: { show: "landings" },42 tab: "landings",40 to: `/${project}`,43 to: `/${project}/commits/main`,44 },45 {46 hash: "proposals",47 label: "Proposals",
4 unmodified lines
52 { label: "Policy", tab: "policy", to: `/${project}/people` },53 { label: "Visibility", tab: "visibility", to: `/${project}/visibility` },54];5553/** The tab each page of a project sits under, by its first segment. */56/** The tab each page of a project sits under, by its first segment: the history and a commit are the Landings tab's, as its crumb says. */57const TAB_OF = {58 answers: "landings",59 asks: "asks",60 blob: "code",58 commit: "code",59 commits: "code",61 commit: "landings",62 commits: "landings",63 decisions: "asks",64 people: "policy",65 proposals: "proposals",66 raw: "code",
226 unmodified lines
modified:apps/web/src/routes/$owner/$project/commits/$rev.tsx+8 added-7 removed
10 unmodified lines
11 projectOf,12 repoPathOf,13 revisionOf,14} from "../../../../features/code/address.ts";15import {16 defaultShowOf,17 LOG_PAGE,18 LOG_SHOWS,15import { LOG_PAGE } from "../../../../features/code/log-page.ts";19} from "../../../../features/code/log-page.ts";20import { LogView } from "../../../../features/code/log-view.tsx";17import type { LogShow } from "../../../../features/code/log-view.tsx";21import { CodeNotFound } from "../../../../features/code/not-found.tsx";22import { pageHead } from "../../../../features/shared/head.ts";23import { notFoundFor } from "../../../../features/shared/refusals.ts";24import { branchPage } from "../../../../server/cache-headers.ts";
11 unmodified lines
36 project: ProjectName,37 rev: Schema.String,38});3937const SHOWS: readonly LogShow[] = ["answers", "openings"];3840interface LogParams {41 readonly from?: number | undefined;42 readonly path?: string | undefined;43 readonly project: string;
58 unmodified lines
102 now={read.now}103 path={read.path}104 project={read.project}105 rev={read.rev}105 show={show ?? "all"}106 show={show ?? defaultShowOf(read.rev, read.path)}107 />108 );109};110
5 unmodified lines
116 readonly show?: unknown;117 }) => ({118 from: Option.getOrUndefined(offsetOf(search.from)),119 path: Predicate.isString(search.path) ? search.path : undefined,119 show: SHOWS.find((each) => each === search.show),120 show: LOG_SHOWS.find((each) => each === search.show),121 }),122 loaderDeps: ({ search }) => ({ from: search.from, path: search.path }),123 loader: ({ deps, params }) => logPage({ data: { ...params, ...deps } }),124 headers: () => branchPage,125 head: ({ params: { project, rev } }) =>125 pageHead({ title: `${project}: landings on ${rev}` }),126 pageHead({ title: `${project}: history of ${rev}` }),127 component: LogPage,128 notFoundComponent: CodeNotFound,129});
modified:apps/web/src/routes/$owner/$project/tree/-code-column.tsx+1 added-1 removed
26 unmodified lines
27 </Suspense>28 </ClientOnly>29 );3031/** The repository's tree beside a page of Files or Commits. */31/** The repository's tree beside a page of Files or History. */32export const CodeColumn = () => (33 <SideColumn label="Files">34 <Later commit={false} />35 </SideColumn>
8 unmodified lines
modified:apps/web/src/routes/$owner/$project/tree/-files-button.tsx+1 added-1 removed
23 unmodified lines
24 size="sm"25 variant="outline"26 >27 <FolderTree aria-hidden="true" strokeWidth={1.75} />28 {/* Not "Files": the bar's toggle beside it is Files | Commits. */}28 {/* Not "Files": the bar's toggle beside it is Files | History. */}29 {commit ? "Changed files" : "Tree"}30 </Button>31 {FilesSheet === undefined || !open ? null : (32 <Suspense fallback={null}>
6 unmodified lines
modified:apps/web/test/code.test.tsx+145 added-17 removed
36 unmodified lines
37import { CommitView } from "../src/features/code/commit-view.tsx";38import { FileFacts } from "../src/features/code/file-facts.tsx";39import { filesMatching } from "../src/features/code/file-match.ts";40import { LOG_PAGE } from "../src/features/code/log-page.ts";41import { LogView } from "../src/features/code/log-view.tsx";41import { LogView, titleOf } from "../src/features/code/log-view.tsx";42import { CodeNotFound } from "../src/features/code/not-found.tsx";43import { SoftLanding } from "../src/features/code/soft-landing.ts";44import { TreeView } from "../src/features/code/tree-view.tsx";45import { ProjectFrame } from "../src/features/project/project-frame.tsx";
9 unmodified lines
55import {56 CodeColumn,57 CommitColumn,58} from "../src/routes/$owner/$project/tree/-code-column.tsx";59import { plainText } from "./ask-fixtures.ts";60import { elementWith, elementsWith } from "./records.ts";61import { renderAt } from "./render.tsx";62import { reachingTransport } from "./transport.ts";63
682 unmodified lines
746 })747 );748749 it.effect(749 "has the Files/Commits toggle, Files current, and the ref switcher on main",750 "has the Files/History toggle, Files current, and the revision picker reading At main",751 () =>752 Effect.gen(function* () {753 const bars = (yield* treeAndBlob).map(codeBarOf);754755 expect(756 bars.map((bar) =>756 linksIn(navOf(bar, 'aria-label="Files or commits"'))757 linksIn(navOf(bar, 'aria-label="Files or history"'))758 )759 ).toStrictEqual(760 bars.map(() => [761 {
3 unmodified lines
765 },766 {767 current: false,768 href: "/oscabriel/datekit/commits/main",768 text: "Commits",769 text: "History",770 },771 ])772 );773 expect(774 bars.map((bar) => /<button\b[^>]*data-ref="main"[^>]*>/u.test(bar))775 ).toStrictEqual([true, true]);776 expect(777 bars.map((bar) =>778 plainText(elementWith(bar, 'data-ref="main"'))779 .replaceAll(/\s+/gu, " ")780 .trim()781 )782 ).toStrictEqual(["At main", "At main"]);783 expect(784 bars.map((bar) => elementWith(bar, 'data-ref="main"'))785 ).not.toContain("lucide-git-branch");786 })787 );788789 it.effect(
37 unmodified lines
827 })828 );829830 it.effect(820 "marks Commits on the history and on a commit, at the same revision, and nothing on the refs list",831 "marks History on the history and on a commit, at the same revision, and nothing on the refs list",832 () =>833 Effect.gen(function* () {834 const pages = yield* Effect.forEach(835 [
4 unmodified lines
840 (url) => inCodeTab(url, <main id="main" />)841 );842843 const toggles = pages.map((markup) =>833 linksIn(navOf(codeBarOf(markup), 'aria-label="Files or commits"'))844 linksIn(navOf(codeBarOf(markup), 'aria-label="Files or history"'))845 );846847 expect(848 toggles.map((links) =>849 links.flatMap(({ current, text }) => (current ? [text] : []))850 )840 ).toStrictEqual([["Commits"], ["Commits"], []]);851 ).toStrictEqual([["History"], ["History"], []]);852 expect(toggles[0]?.map(({ href }) => href)).toStrictEqual([853 `/oscabriel/datekit/tree/${TAG_SEGMENT}`,854 `/oscabriel/datekit/commits/${TAG_SEGMENT}`,855 ]);
119 unmodified lines
975 next={30}976 now={now}977 project={datekit}978 rev="main"979 show="all"980 />981 );982983 /** The same page as main's history opens: no filter named, so the landings alone. */984 const landings = (985 <LogView986 commits={commits}987 from={0}988 next={30}989 now={now}990 project={datekit}991 rev="main"992 />993 );994995 it("groups the commits of one day under one sticky header", () => {996 const markup = markupOf(page);997998 const days = [...markup.matchAll(/data-day="(?<day>[^"]+)"/gu)].map(
134 unmodified lines
1133 expect(hrefsOf(filters)).toStrictEqual([1134 "/oscabriel/datekit/commits/main",1135 "/oscabriel/datekit/commits/main?show=answers",1136 "/oscabriel/datekit/commits/main?show=openings",1137 "/oscabriel/datekit/commits/main?show=all",1138 ]);1114 expect(filters).toMatch(/aria-current="page"[^>]*>All</u);1139 expect(filters).toMatch(/aria-current="page"[^>]*>Every commit</u);1140 expect(1141 [...filters.matchAll(/<a\b[^>]*>(?<label>[^<]*)</gu)].map(1142 ({ groups }) => groups?.label1143 )1144 ).toStrictEqual(["Landings", "Answers", "Ask openings", "Every commit"]);1145 });11461117 it("says an imported commit came before adoption", () => {1118 const row = slice(markupOf(page), "data-commit", IMPORTED);1147 it("is titled History of main, of a fork, or at a tag", () => {1148 expect(1149 ["main", "@bram/parse-iso", TAG].map((rev) => titleOf(undefined, rev))1150 ).toStrictEqual([1151 "History of main",1152 "History of bram/parse-iso",1153 `History at ${TAG}`,1154 ]);1155 expect(titleOf(RepoPath.make("src/index.ts"), "main")).toBe(1156 "History of src/index.ts"1157 );1158 expect(markupOf(landings)).toMatch(/<h1\b[^>]*>History of main<\/h1>/u);1159 });11601120 expect(row).toContain("before adoption");1121 expect(hrefsOf(row)).toContain(`/oscabriel/datekit/commit/${IMPORTED}`);1122 expect(slice(markupOf(page), "data-commit", LANDED)).not.toContain(1123 "before adoption"1161 it("shows main's landings alone by default, and counts them as landings", () => {1162 const markup = markupOf(landings);11631164 expect(markup).toContain(`data-commit="${LANDED}"`);1165 expect(markup).not.toContain(`data-commit="${IMPORTED}"`);1166 expect(navOf(markup, 'aria-label="Show"')).toMatch(1167 /aria-current="page"[^>]*>Landings</u1168 );1169 expect(plainText(markup)).toContain("1 landing");1170 expect(plainText(markup)).not.toContain("commits");1171 });11721173 it("pages the landings no further than the adoption, and a full page of them on", () => {1174 // The page holds a commit no landing records, so no older page holds one.1175 expect(markupOf(landings)).not.toContain('data-slot="pagination"');1176 // A full page of landings pages on, keeping the default out of the address.1177 const [landed] = commits;11781179 expect(1180 hrefsOf(1181 markupOf(1182 <LogView1183 commits={landed === undefined ? [] : [landed]}1184 from={0}1185 next={30}1186 now={now}1187 project={datekit}1188 rev="main"1189 />1190 )1191 )1192 ).toContain("/oscabriel/datekit/commits/main?from=30");1193 });11941195 it("marks the adoption once, over the first commit no landing records, in place of a word on every row", () => {1196 const markup = markupOf(page);11971198 expect(markup.match(/data-adopted="/gu)).toHaveLength(1);1199 expect(markup.indexOf(`data-adopted="${IMPORTED}"`)).toBeGreaterThan(1200 markup.indexOf(`data-commit="${LANDED}"`)1201 );1202 expect(markup.indexOf(`data-adopted="${IMPORTED}"`)).toBeLessThan(1203 markup.indexOf(`data-commit="${IMPORTED}"`)1204 );1205 expect(plainText(markup)).toContain(1206 "Adopted here. The commits below came with the import; no landing records them."1207 );1208 });12091210 it("says nothing on an imported commit's own row, which still opens the commit, and counts a mixed day as commits", () => {1211 const markup = markupOf(page);12121213 expect(plainText(markup)).not.toContain("before adoption");1214 expect(plainText(markup)).toContain("2 commits");1215 expect(hrefsOf(slice(markup, "data-commit", IMPORTED))).toContain(1216 `/oscabriel/datekit/commit/${IMPORTED}`1217 );1218 });12191220 it("marks no fork's own commit as the adoption: the first break after a landing is", () => {1221 const [own] = decodeCommits([1222 {1223 author: signature("Bob", "2026-10-07T09:00:00.000Z"),1224 body: "",1225 committer: signature("Bob", "2026-10-07T09:00:00.000Z"),1226 parents: [LANDED],1227 sha: "9".repeat(40),1228 subject: "Parse ISO weeks",1229 trailers: [],1230 tree: "a".repeat(40),1231 },1232 ]);12331234 const markup = markupOf(1235 <LogView1236 commits={own === undefined ? commits : [own, ...commits]}1237 from={0}1238 now={now}1239 project={datekit}1240 rev="@bob/parse-iso"1241 />1242 );12431244 expect(1245 [...markup.matchAll(/data-adopted="(?<sha>[^"]*)"/gu)].map(1246 ({ groups }) => groups?.sha1247 )1248 ).toStrictEqual([IMPORTED]);1249 expect(markup).toMatch(/<h1\b[^>]*>History of bob\/parse-iso<\/h1>/u);1250 expect(navOf(markup, 'aria-label="Show"')).toMatch(1251 /aria-current="page"[^>]*>Every commit</u1252 );1253 });12541255 it("links the older page from where this one ends, and no newer page from the first", () => {1256 const pager = navOf(markupOf(page), 'data-slot="pagination"');12571258 expect(hrefsOf(pager)).toStrictEqual([1131 "/oscabriel/datekit/commits/main?from=30",1259 "/oscabriel/datekit/commits/main?from=30&show=all",1260 ]);1261 });12621263 it("keeps the path on both pages of a path's history", () => {
834 unmodified lines
2098 ]);2099 });21002101 it.effect(1974 "names the fork in the ref switcher, with Files and Commits kept at the fork",2102 "names the fork in the revision picker, with Files and History kept at the fork",2103 () =>2104 Effect.gen(function* () {2105 const bar = codeBarOf(2106 yield* inCodeTab(
5 unmodified lines
2112 expect(elementWith(bar, `data-ref="${FORK}"`)).toContain(2113 "bob/parse-iso"2114 );2115 expect(1988 linksIn(navOf(bar, 'aria-label="Files or commits"')).map(2116 linksIn(navOf(bar, 'aria-label="Files or history"')).map(2117 ({ href }) => href2118 )2119 ).toStrictEqual([2120 `/oscabriel/datekit/tree/${FORK_SEGMENT}`,
52 unmodified lines
modified:apps/web/test/nav.test.tsx+26 added-3 removed
22 unmodified lines
23 [24 { href: "/oscabriel/datekit", text: "Overview" },25 { href: "/oscabriel/datekit/tree/main", text: "Code" },26 { href: "/oscabriel/datekit#open-asks", text: "Asks" },27 { href: "/oscabriel/datekit#recent-landings", text: "Landings" },27 { href: "/oscabriel/datekit/commits/main?show=landings", text: "Landings" },28 { href: "/oscabriel/datekit#proposals", text: "Proposals" },29 { href: "/oscabriel/datekit#who-decides", text: "People" },30 { href: "/oscabriel/datekit/people", text: "Policy" },31 { href: "/oscabriel/datekit/visibility", text: "Visibility" },
99 unmodified lines
131132 expect(markup).toContain("overflow-x-auto");133 expect(markup).not.toContain("flex-wrap");134 });135136 it("fades its right edge below tablet, the cue that tabs lie off screen where the scrollbar is hidden", () => {137 const markup = renderToStaticMarkup(138 <ProjectTabs current="code" project={datekit} />139 );140141 const fade =142 /<div\b[^>]*class="(?<classes>[^"]*)"[^>]*data-tabs-fade=""/u.exec(markup)143 ?.groups?.classes ?? "";144145 expect(fade.split(" ")).toStrictEqual(146 expect.arrayContaining([147 "after:bg-linear-to-l",148 "after:from-background",149 "after:pointer-events-none",150 "tablet:after:hidden",151 ])152 );153 expect(markup.indexOf('data-tabs-fade=""')).toBeLessThan(154 markup.indexOf("overflow-x-auto")155 );156 });157});158159describe(projectTabOf, () => {160 it.each([
4 unmodified lines
165 ["/oscabriel/datekit/refs", "code"],166 ["/oscabriel/datekit/asks/fix-week-start", "asks"],167 ["/oscabriel/datekit/decisions/dec-000001", "asks"],168 ["/oscabriel/datekit/answers/fix-week-start", "landings"],147 ["/oscabriel/datekit/commits/main", "code"],169 ["/oscabriel/datekit/commits/main", "landings"],170 ["/oscabriel/datekit/commits/%40bram%2Fparse-iso", "landings"],171 [172 "/oscabriel/datekit/commit/1111111111111111111111111111111111111111",150 "code",173 "landings",174 ],175 ["/oscabriel/datekit/proposals/prop-000001", "proposals"],176 ["/oscabriel/datekit/people", "policy"],177 ["/oscabriel/datekit/visibility", "visibility"],
8 unmodified lines
modified:apps/web/test/people.test.tsx+60 added-1 removed
1import { describe, expect, it } from "@effect/vitest";2import { Contracts } from "@repo/protocol/contracts";3import { CreditSummary } from "@repo/protocol/domain/record";4import { Handle } from "@repo/protocol/ids";5import { isNotFound } from "@tanstack/react-router";6import { Effect, Schema } from "effect";7import type { ReactElement } from "react";89import {10 areaSentence,11 NoSuchPersonView,12 PersonView,13} from "../src/features/people/person-page.tsx";14import { readPersonPage } from "../src/routes/people/$handle.tsx";15import { platformWith, unreachablePlatform } from "./platform.ts";16import { renderAt } from "./render.tsx";17import { reachingTransport } from "./transport.ts";1819const handle = Schema.decodeSync(Handle)("ines-v");
72 unmodified lines
92 const html = creditsOf(yield* page);9394 for (const project of ["oscabriel/datekit", "oscabriel/burrow"]) {95 expect(html).toContain(`href="/${project}"`);91 expect(html).toContain(`href="/${project}#recent-landings"`);96 expect(html).toContain(`href="/${project}/commits/main?show=landings"`);97 }98 })99 );100
35 unmodified lines
136 })137 );138});139140describe("the person's route", () => {141 const encodedCredits = Schema.encodeSync(Schema.Array(CreditSummary))(142 credits143 );144145 const platform = platformWith(146 Contracts.toLayerHandler("credits", (payload) =>147 Effect.succeed({ credits: payload.handle === handle ? credits : [] })148 )149 );150151 it.effect(152 "reads the credits in its loader, so the page arrives with them",153 () =>154 Effect.gen(function* () {155 const read = yield* readPersonPage("ines-v").pipe(156 Effect.provide(platform)157 );158159 expect(read.handle).toBe("ines-v");160 expect(read.credits).toStrictEqual(encodedCredits);161 })162 );163164 it.effect(165 "is not found for an address that names no handle, before any read",166 () =>167 Effect.gen(function* () {168 const refused = yield* Effect.flip(169 readPersonPage("-not-a-handle").pipe(170 Effect.provide(unreachablePlatform)171 )172 );173174 expect(isNotFound(refused)).toBeTruthy();175 })176 );177178 it.effect(179 "draws the not-found page as a project's: titled, with a crumb and a way onward",180 () =>181 Effect.gen(function* () {182 const html = yield* renderAt(183 "/people/-not-a-handle",184 <NoSuchPersonView />185 );186187 expect(html).toMatch(/<h1\b[^>]*>No such person<\/h1>/u);188 expect(html).toContain("this address names none");189 expect(html).toContain('href="/asks"');190 })191 );192});193194describe("an area's sentence", () => {195 it("names the roles in words, the answer first, then in trailer order", () => {196 expect(197 areaSentence("datekit", "src", [
25 unmodified lines
modified:apps/web/test/project.test.tsx+39 added-6 removed
414 unmodified lines
415 })416 );417418 it.effect(419 "reads a decider's territory of every path in words, never as the glob",420 () =>421 Effect.gen(function* () {422 const about = aboutOf(423 yield* page({424 deciders: [425 { handles: [Handle.make("ines-v")], paths: Glob.make("**") },426 ],427 })428 );429430 const text = textIn(about);431432 expect(text).toMatch(/every path\s*·\s*ines-v/u);433 expect(text).not.toMatch(/\*\*\s*·/u);434 })435 );436437 it.effect(438 "offers a signed-out reader a sign-in that returns to proposing, and a signed-in one the propose link",439 () =>440 Effect.gen(function* () {441 const signedOut = mainColumnOf(yield* page({ signedIn: false }));442443 expect(textIn(signedOut)).toContain("Sign in to propose one.");444 expect(signedOut).toContain(445 `href="/auth/signin?return=${encodeURIComponent("/oscabriel/datekit/proposals/new")}"`446 );447 expect(signedOut).not.toContain('data-propose=""');448449 const signedIn = mainColumnOf(yield* page({ signedIn: true }));450451 expect(signedIn).toContain('data-propose=""');452 expect(textIn(signedIn)).not.toContain("Sign in to propose one.");453 })454 );455456 it.effect(457 "names where an imported project came from, with its branch, as a copy read-only here; and nothing for one that started empty",458 () =>459 Effect.gen(function* () {460 const facts = aboutOf(
614 unmodified lines
1075 const hashes = projectSections("oscabriel/datekit").flatMap(1076 ({ hash }) => (hash === undefined ? [] : [hash])1077 );10781041 expect(hashes).toStrictEqual([1042 "open-asks",1043 "recent-landings",1044 "proposals",1045 "who-decides",1046 ]);1079 expect(hashes).toStrictEqual(["open-asks", "proposals", "who-decides"]);1080 expect(1081 hashes.filter((hash) => !markup.includes(`id="${hash}"`))1082 ).toStrictEqual([]);1083 })
444 unmodified lines
modified:apps/web/test/refs.test.tsx+12 added-1 removed
370 unmodified lines
371 ),372 'data-fork="ines-v/parse-iso"'373 );374375 it("lists main as current, then the tags, then the answers in forks", () => {375 it("lists main as current, then the tags, then the answers in claim forks", () => {376 const markup = choices();377378 expect(379 [
2 unmodified lines
382 ).toStrictEqual(["main", "v1.1.0", "v1.0.0", "ines-v/parse-iso"]);383 expect(elementWith(markup, 'data-ref-choice="main"')).toContain(384 'aria-current="true"'385 );386 expect(plainText(markup)).toContain("Answers in claim forks");387 });388389 it("names no branch: main carries no branch mark and sits under no heading, since a tag and a fork are revisions", () => {390 const markup = choices();391392 expect(markup).not.toContain("lucide-git-branch");393 expect(plainText(markup)).not.toMatch(/\bBranch\b/u);394 expect(markup.indexOf('data-ref-choice="main"')).toBeLessThan(395 markup.indexOf("<p")396 );397 });398399 it("names each answer's ask, claimant and claim state, and opens the fork at its address", () => {400 const fork = elementWith(choices(), 'data-fork="ines-v/parse-iso"');401402 expect(hrefsOf(fork)).toStrictEqual([
33 unmodified lines
modified:DESIGN.md+2 added-2 removed
452 unmodified lines
453454- **Header:** the name (`owner / project`, the owner muted, both in the UI sans at Headline size), the posture (`PostureBadge`), the description (the README's first sentence), a facts row in UI type, muted (open asks, last landing, latest tag, licence if known, deciders), and three actions at the right: **Watch** (a popover: what already follows the project, this page and its events, plus `myr status --project` for your own claims and answers; the CLI has no watch command), **Clone** (a popover: the `git clone` URL, `myr claim <ask> --project`, and that forks come with a claim), **Contribute** (a popover: take an ask, propose an ask, read the policy). It never changes between tabs.455- **Tabs:** Overview · Code · Asks · Landings · Proposals · People · Policy · Visibility, each a text tab with its count in label type; the current one ink at 500 with a 2 px ink underline (the one current-tab style of the whole web), the rest muted. The header and tabs stick under the top bar together; on a phone the tabs scroll sideways inside their own strip.456- **Overview** (the default tab): open asks, recent landings and the README in the main column (its headings a level down, so the project's name stays the page's one h1); the about column (`--column-about`) with clone, how a change lands (the seven stages), who decides, a visibility summary and languages.457- **Code:** under the header, the code bar: a Files/Commits toggle, the ref switcher (`main`, tags, and answers in forks, ADR 0043), the HEAD commit, Go to file and Clone; then the file tree in `--column-tree` beside every page of the tab. The history of commits is the Code tab's; the Landings tab opens Overview's recent landings until it has a page of its own.457- **Code:** under the header, the code bar: a Files/History toggle, the revision picker (`main`, tags, and answers in claim forks, ADR 0043), the HEAD commit, Go to file and Clone; then the file tree in `--column-tree` beside every page of the tab. The history is git's first-parent log with the platform's landing record on each commit that has one, filtered to Landings, Answers, Ask openings or Every commit (Landings by default on main); the Landings tab opens that history of main filtered to its landings, and a commit's page sits under it.458- **Visibility:** posture, layers, held-back checks, the environment (once "Env shape") and the ledger, one tab.459460### Cards461
61 unmodified lines
523- **Finish:** the changed files in the tree column with status letters, `+n −m` and a local read mark; the diff with sticky file headers and "Mark read"; the want, verdict, choices and the finish commands in a strip.524525### Code browser (the Code tab)526527- **Code bar:** one row under the project's header, not sticky, wrapping on a narrow screen: Files | Commits (a segmented control marking the view, nothing on the refs list), the ref switcher (a field-bordered button with the revision's mark and name; its list reads the refs only when it opens: main, the tags, then "Answers in forks", each fork as its ask in mono over its claimant and the claim's state in a word; a fork's entry opens the same page in that fork at its address, `@<handle>/<ask>`, shown as `handle/ask` with the fork mark; no repo is named), the revision's head commit (short SHA and subject linking the commit, then author and age; from 640 px), Go to file (`t`, a dialog over the paths at the revision, a match in the file's own name first) and Clone (a popover: the clone command, and the checkout of a tag or a commit, quoted when it is not one plain word; none for a fork, whose commits come with a claim). Below `columns`, a Files button at its start opens the tree, or a commit's changed files, as a sheet. Its reads are the route's (`routes/$owner/$project/-code-bar.tsx`); the bar itself, in `features/code/`, reads nothing. Inside a fork every link that pins a commit (raw, the permalink, a log row, a commit's parent and files, why one step back) pins it inside the fork, `@<handle>/<ask>:<sha>`, so a fork's page is a permalink.527- **Code bar:** one row under the project's header, not sticky, wrapping on a narrow screen: Files | History (a segmented control marking the view, nothing on the refs list), the revision picker (a field-bordered button reading "At main", "At v1.2.0" or "At handle/ask", with no branch mark or heading, since a tag and a fork are revisions, not branches; its list reads the refs only when it opens: main, the tags, then "Answers in claim forks", each fork as its ask in mono over its claimant and the claim's state in a word; its field finds a tag or an answer; a fork's entry opens the same page in that fork at its address, `@<handle>/<ask>`, shown as `handle/ask` with the fork mark; no repo is named), the revision's head commit (short SHA and subject linking the commit, then author and age; from 640 px), Go to file (`t`, a dialog over the paths at the revision, a match in the file's own name first) and Clone (a popover: the clone command, and the checkout of a tag or a commit, quoted when it is not one plain word; none for a fork, whose commits come with a claim). Below `columns`, a Files button at its start opens the tree, or a commit's changed files, as a sheet. Its reads are the route's (`routes/$owner/$project/-code-bar.tsx`); the bar itself, in `features/code/`, reads nothing. Inside a fork every link that pins a commit (raw, the permalink, a log row, a commit's parent and files, why one step back) pins it inside the fork, `@<handle>/<ask>:<sha>`, so a fork's page is a permalink.528- **Tree:** `@pierre/trees` in `--column-tree`: Plex Sans 14 px, monochrome icons, single-child folders flattened, the current path expanded and in view; on a commit, every changed file with its status letter and `+n −m`.529- **File:** a sticky file header (the path as a trail, folders muted and the file name in ink; "N lines · size · language"; Code | Why; Raw, Permalink, Copy), then the code at Pierre's metrics in its own box. The server sends plain numbered text at the same metrics, so the highlighting lands in place.530- **Why:** a mode of the file view: consecutive lines from one landing under a band that reads ask and answer first, SHA second.531- **Commits and a commit:** rows under sticky day headers; a commit's subject as Title, its status line, the body as prose, then the diff (Unified | Split from 48 rem).
109 unmodified lines