From 4c3e64412e0f66ea83b1cedf2ea4a8bdcfd0c79f Mon Sep 17 00:00:00 2001 From: Pranav Mathad Date: Sun, 29 Nov 2026 06:58:45 +0100 Subject: [PATCH 01/10] Cut the tab row to five and lead the landing page with the reports --- README.md | 14 +- web/src/components/cx/site-header.tsx | 21 +- web/src/routes/Landing.tsx | 352 ++++++++++++-------------- web/src/routes/RepoLayout.tsx | 58 ++--- 4 files changed, 206 insertions(+), 239 deletions(-) diff --git a/README.md b/README.md index 5f33eafd..cfd01e65 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ writes prose on top of those facts, and the app marks every AI sentence as AI. | Stage 3, `model`: the map of modules per snapshot | Works on all three repositories | | Stage 5, `analyze`: decisions, finding types, before and after | Works on all three repositories | | Stage 7, `report`: ranking, `findings.json`, the web bundle | Works on all three repositories | -| Web app: Overview, Decisions, Findings and finding detail, Map, Change, Trust, Size | Works on the three bundles and the two synthetic fixtures in `web/public/bundles/`; see [Web app](#web-app) | +| Web app: the tabs Report, Findings (with finding detail), Map, Before and after, Approach, and the Decisions and Size screens | Works on the three bundles and the two synthetic fixtures in `web/public/bundles/`; see [Web app](#web-app) | | Stage 6, `judge`: AI text for the shown findings | Works with `LLM_API_KEY` set; answers are cached in the run folder, so a re-run makes no call | | `decisions propose`: rules proposed from written decision documents | Works with `LLM_API_KEY` set; writes `proposals.yaml` for review, and the reviewed rules are in `rules/` | | `check ..`: decisions a change breaks | Works; lists each broken decision with file and line, and exits 1 when there is one | @@ -204,15 +204,15 @@ to include it in `web/dist`. | Address (after `#`) | Screen | |---|---| -| `/` | every repository, with its verdict and the finding to fix first | -| `/r/` | Overview: verdict, yardsticks, decisions, the simulated fix batch, the top findings | -| `/r//decisions` | Decisions: each checked decision with its conformance over time, and the written ones that cannot be checked | +| `/` | every repository, with the finding to fix first and its decisions by status; how the pipeline works | +| `/r/` | Report: verdict, yardsticks, decisions, the simulated fix batch, the top findings | +| `/r//decisions` | Decisions, reached from Report: each checked decision with its conformance over time, and the written ones that cannot be checked | | `/r//findings` | Findings: the ranked list and how the ranking is worked out | | `/r//findings/` | one finding: the reading of the code, the cited lines, the simulation, the priority | | `/r//map` | Map: the module grid. `?view=before\|now\|after`, `?cell=,`, `?finding=`, `?fix=` | -| `/r//change` | Change: before and after the compared date, structural events, hotspots | -| `/r//trust` | Trust: coverage, limits, stability of the ranking, AI calls and their cost | -| `/r//size` | Size: lines by module and file, and where the new lines landed | +| `/r//change` | Before and after: before and after the compared date, structural events, hotspots | +| `/r//trust` | Approach: coverage, limits, stability of the ranking, AI calls and their cost | +| `/r//size` | Size, reached from Map: lines by module and file, and where the new lines landed | Some values show "not measured in this run" because the bundle does not carry them yet: diff --git a/web/src/components/cx/site-header.tsx b/web/src/components/cx/site-header.tsx index a3b5acd5..fc8e08fd 100644 --- a/web/src/components/cx/site-header.tsx +++ b/web/src/components/cx/site-header.tsx @@ -1,7 +1,6 @@ import type { ReactNode } from "react"; import { Link } from "react-router"; import { repoPath } from "../../cx/address"; -import { STATUS } from "../../cx/meta"; import type { RepoSummary } from "../../cx/types"; import { loadRepoSummaries } from "../../data/repo"; import { FOCUS, cn } from "./cn"; @@ -12,7 +11,7 @@ const shortName = (name: string) => name.slice(name.lastIndexOf("/") + 1); /** * The top bar: logo and one button per real repository in the order of - * `bundles/index.json`. Synthetic bundles are linked from the landing page only. + * `bundles/index.json`. Synthetic bundles are reached by their address only. */ export function SiteHeader({ current }: { current?: string }) { const summaries = useLoaded(() => loadRepoSummaries(), "summaries"); @@ -53,26 +52,18 @@ export function SiteHeader({ current }: { current?: string }) { ))} -
- - pipeline v1 · offline, deterministic -
); } -/** The bottom line of every page: what the numbers rest on, and the project credit. */ -export function SiteFooter({ children }: { children: ReactNode }) { +/** The bottom line of every page: what the numbers rest on, if given, and the project credit. */ +export function SiteFooter({ children }: { children?: ReactNode }) { return (
-

{children}

-

CodeXray · CHECK24 × hackaTUM

+ {children &&

{children}

} +

CodeXray · CHECK24 × hackaTUM

); @@ -86,7 +77,7 @@ export function SitePage({ children, current }: { children: ReactNode; current?:
{children}
- Deterministic numbers, cited AI. Same commit, same report. + ); } diff --git a/web/src/routes/Landing.tsx b/web/src/routes/Landing.tsx index 7f2b85b9..d328909d 100644 --- a/web/src/routes/Landing.tsx +++ b/web/src/routes/Landing.tsx @@ -1,8 +1,6 @@ import { ArrowUpRight } from "lucide-react"; import { Link } from "react-router"; -import { NotMeasured } from "../components/cx/badges"; import { FOCUS, cn } from "../components/cx/cn"; -import { Eyebrow, StatusDot } from "../components/cx/primitives"; import { SiteFooter, SiteHeader } from "../components/cx/site-header"; import { Sparkline, markIndex } from "../components/cx/sparkline"; import { useLoaded, useTitle } from "../components/cx/use-page"; @@ -11,22 +9,26 @@ import { STATUS, STATUS_ORDER, pct } from "../cx/meta"; import type { FixFirst, RepoCard, RepoSummary } from "../cx/types"; import { loadRepoCard, loadRepoFixFirst, loadRepoSummaries } from "../data/repo"; -const STEPS = [ +/** The pipeline's seven stages, split into the computed ones and those that carry AI text. */ +const COMPUTED = [ + ["Repository", "Reads the full history and records which commit last wrote each line."], + ["Parse", "Reads every file and resolves imports and calls into links between files."], + ["Model", "Groups the files into modules and stores the module map for each snapshot."], + ["Visualize", "Draws the module grid, ordered so that normal dependencies fall on one side."], [ - "Read the rules", - "Pull decisions from build checks, architecture docs and habits the code measurably keeps.", - ], - [ - "Check every link", - "Resolve imports and calls into a module graph and test each rule against it, snapshot by snapshot.", + "Analyze", + "Checks each decision against the links, snapshot by snapshot, and lists the exceptions.", ], +] as const; + +const WITH_AI = [ [ - "Rank the exceptions", - "Score by size, reach, change pressure, the rule’s authority and ease of the fix. AI reads the code only where numbers can’t decide.", + "LLM Judge", + "An AI model reads decision documents, judges the shown findings and describes modules. Its text is checked against the stored facts.", ], [ - "Replay the fix", - "Apply each proposed fix to a copy of the module map and report the loops it changes before anyone touches code.", + "Explain", + "Ranks the findings by arithmetic alone and shows the model's text beside them, marked AI.", ], ] as const; @@ -35,115 +37,108 @@ export function Landing() { const summaries = useLoaded(() => loadRepoSummaries(), "summaries"); const all = summaries.state === "ready" ? summaries.value : []; const real = all.filter((r) => !r.synthetic); - const fixtures = all.filter((r) => r.synthetic); const dates = [...new Set(real.map((r) => r.snapshotDate).filter((d): d is string => !!d))]; return (
-
-
-
- Architecture decisions · checked against the code -

- Your team wrote down how the code should fit together.{" "} - Is it still true? -

-

- CodeXray measures how well a codebase keeps its own architecture decisions over - time, before and after the team adopted AI coding tools, and tells you which - exceptions to fix first. -

+
+
+

+ Which architecture problems to fix first, with the code behind each +

+

+ CodeXray checks a repository against its architecture decisions and ranks the + exceptions it finds. Each finding links to its place on the module map and to the + lines of code. +

+
+ +
+
+

+ Reports +

+ {dates.length === 1 && ( +

snapshot {dates[0]}

+ )}
-
-
    - {STEPS.map(([t, d], i) => ( -
  1. - - step {i + 1} - - {t} - {d} + {summaries.state === "loading" && ( +

    + Loading the list of reports… +

    + )} + {summaries.state === "failed" && ( +

    + The list of reports could not be loaded.{" "} + {summaries.why} +

    + )} + {summaries.state === "ready" && real.length === 0 && ( +

    + No report of a real repository is in bundles/index.json. +

    + )} + {real.length > 0 && ( +
      + {real.map((r) => ( +
    • +
    • ))} -
-

- Finding, counting and ranking are computed, with no AI model. An AI model writes - prose in three places only: reading written decisions, judging the code behind an - exception, and describing a module. Each of its sentences is checked against the - stored facts and marked AI. -

-
-
-
+ + )} + -
-
-

- Reports +
+

+ How it works

- {summaries.state === "ready" && ( -

- {real.length} {real.length === 1 ? "repository" : "repositories"} - {dates.length === 1 && ` · snapshot ${dates[0]}`} -

- )} -

- {summaries.state === "loading" && ( -

- Loading the list of reports… -

- )} - {summaries.state === "failed" && ( -

- The list of reports could not be loaded.{" "} - {summaries.why} -

- )} - {summaries.state === "ready" && real.length === 0 && ( -

- No report of a real repository is in bundles/index.json. -

- )} - {real.length > 0 && ( -
    - {real.map((r, i) => ( -
  • - -
  • - ))} -
- )} - {fixtures.length > 0 && ( -

- Synthetic fixtures, for testing the screens:{" "} - {fixtures.map((r, i) => ( - - {i > 0 && " · "} - - {r.label} - - - ))} -

- )} -
+
+ + +
+ +
- Deterministic numbers, cited AI. Same commit, same report. + + + ); +} + +function StageGroup({ + title, + stages, + from, +}: { + title: string; + stages: readonly (readonly [string, string])[]; + from: number; +}) { + return ( +
+

{title}

+
    2 ? "lg:grid-cols-5" : "lg:grid-cols-2", + )} + > + {stages.map(([name, text], i) => ( +
  1. + {from + i} + {name} + + {text} + +
  2. + ))} +
); } @@ -158,9 +153,10 @@ function RepoCardView({ id, summary }: { id: string; summary: RepoSummary }) { const c = card.state === "ready" ? card.value : null; const counts = summary.statusCounts; const present = STATUS_ORDER.filter((s) => counts[s] > 0); + const checked = present.reduce((n, s) => n + counts[s], 0); const grain = c?.againstGrainShare ?? null; - const rising = grain && grain.now !== null && grain.before !== null && grain.now > grain.before; - const falling = grain && grain.now !== null && grain.before !== null && grain.now < grain.before; + const now = grain?.now ?? null; + const before = grain?.before ?? null; const compareDate = c ? (c.sponsorDate ?? c.beforeDate) : null; const langs = c ? c.languages.length > 3 @@ -172,13 +168,13 @@ function RepoCardView({ id, summary }: { id: string; summary: RepoSummary }) {
-
- {summary.name} +
+ {summary.name} {[langs, summary.snapshotDate && `snapshot ${summary.snapshotDate}`] .filter(Boolean) @@ -191,86 +187,74 @@ function RepoCardView({ id, summary }: { id: string; summary: RepoSummary }) {
-
-
- - links against the grain - - {card.state === "failed" ? ( - could not be loaded - ) : !grain ? ( - … - ) : grain.now === null ? ( - - ) : ( - {pct(grain.now)} - )} - {grain && grain.before !== null && grain.now !== null && ( - - {rising ? "▲ " : falling ? "▼ " : ""} - {rising || falling ? "from" : "unchanged from"} {pct(grain.before)} - {compareDate && ` at ${compareDate.slice(0, 7)}`} - - )} -
- {grain && ( - p.value)} - mark={markIndex( - grain.series.map((p) => p.date), - compareDate, - )} - width={130} - height={44} - area - color="var(--accent)" - label={`${summary.name}: against-the-grain share at each snapshot`} - /> - )} -
- -
    - {present.flatMap((s) => - Array.from({ length: counts[s] }, (_, k) => ( -
  • - -
  • - )), - )} -
  • - {present.length === 0 - ? "no decision checked" - : present.map((s) => `${counts[s]} ${STATUS[s].label.toLowerCase()}`).join(" · ")} -
  • -
- -
- fix first - +
+ Fix first + {top.state === "ready" ? ( (top.value?.title ?? "No finding was ranked in this run.") ) : top.state === "failed" ? ( - could not be loaded + could not be loaded ) : ( - Loading… + Loading… )}
+ +

+ {checked === 0 + ? "No decision checked." + : `${checked} ${checked === 1 ? "decision" : "decisions"} checked: ${present + .map((s) => `${counts[s]} ${STATUS[s].label.toLowerCase()}`) + .join(", ")}`} +

+ + {card.state === "failed" && ( +

+ The rest of this card could not be loaded. +

+ )} + {grain && now !== null && ( +
+
+ + links against the main dependency direction + + + {pct(now)} + {before !== null && ( + + {now === before ? "unchanged from" : "from"} {pct(before)} + {compareDate && ` at ${compareDate.slice(0, 7)}`} + + )} + +
+ {grain.series.length > 1 && ( + p.value)} + mark={markIndex( + grain.series.map((p) => p.date), + compareDate, + )} + width={96} + height={28} + color="var(--muted-foreground)" + label={`${summary.name}: share of links against the main dependency direction at each snapshot`} + /> + )} +
+ )} ); } diff --git a/web/src/routes/RepoLayout.tsx b/web/src/routes/RepoLayout.tsx index f3864af0..101b2e23 100644 --- a/web/src/routes/RepoLayout.tsx +++ b/web/src/routes/RepoLayout.tsx @@ -3,6 +3,7 @@ import { type RepoTab, repoPath } from "../cx/address"; import { fmt } from "../cx/meta"; import type { RepoBundle } from "../cx/types"; import { FOCUS, cn } from "../components/cx/cn"; +import { allFindings } from "../components/cx/finding-fix"; import { SiteFooter, SiteHeader } from "../components/cx/site-header"; import { useLoaded, useTitle } from "../components/cx/use-page"; import { loadRepo, loadRepoList } from "../data/repo"; @@ -20,14 +21,16 @@ export function useRepo(): RepoBundle { return useOutletContext().repo; } -const TABS: { tab?: RepoTab; label: string }[] = [ - { label: "Overview" }, +/** + * The tab row. `also` lists the screens that are reached from a tab's page rather than from + * the row; while one of them is open, that tab is marked as current. + */ +const TABS: { tab?: RepoTab; label: string; also?: RepoTab[] }[] = [ + { label: "Report", also: ["decisions"] }, { tab: "findings", label: "Findings" }, - { tab: "decisions", label: "Decisions" }, - { tab: "map", label: "Map" }, - { tab: "size", label: "Size" }, - { tab: "change", label: "Change" }, - { tab: "trust", label: "Trust" }, + { tab: "map", label: "Map", also: ["size"] }, + { tab: "change", label: "Before and after" }, + { tab: "trust", label: "Approach" }, ]; type Load = { state: "missing" } | { state: "found"; repo: RepoBundle }; @@ -58,7 +61,7 @@ export function RepoLayout() {
- Deterministic numbers, cited AI. Same commit, same report. +
); } @@ -135,20 +138,6 @@ function RepoBody({ repo }: { repo: RepoBundle }) { {repo.endSha.slice(0, 10)}
-
-
params
-
- {repo.paramsHash.slice(0, 8)} -
-
- {repo.rulesHash && ( -
-
rules
-
- {repo.rulesHash.slice(0, 8)} -
-
- )} {repo.synthetic && ( @@ -163,10 +152,7 @@ function RepoBody({ repo }: { repo: RepoBundle }) {

)} - +
@@ -174,22 +160,28 @@ function RepoBody({ repo }: { repo: RepoBundle }) {
Every number on this page comes from a stored result for commit{" "} - {repo.endSha.slice(0, 7)}. AI text is cited and checked. + {repo.endSha.slice(0, 7)}. Text marked AI is checked + against those results. ); } -function RepoNav({ repoId, counts }: { repoId: string; counts: Record }) { +function RepoNav({ repoId, counts }: { repoId: string; counts: Partial> }) { const path = useLocation().pathname; const base = repoPath(repoId); + const under = (tab: RepoTab) => { + const href = repoPath(repoId, tab); + return path === href || path.startsWith(`${href}/`); + }; return ( -
-
- {String(f.rank).padStart(2, "0")} -
-
-
- {TYPE[f.type].label} - - · - - {TYPE[f.type].group} - - rank {f.rank} of {all.length} - - {!inTop && below the top {repo.findings.length}} +
+

+ #{f.rank} + of {fmt(all.length)} + / + {TYPE[f.type].label} + {!inTop && below the top {repo.findings.length}} +

+

+ {f.title} +

+ {f.judgement && ( +
+ +
-

- {f.title} -

- {f.judgement && ( -
- - -
- )} -
+ )} + {seenIn.length > 0 && ( +

+ Seen in{" "} + {seenIn.map((x, i) => ( + + {i > 0 && ", "} + + the journey "{x.journey.name}", stop {x.stop + 1} + + + ))} +

+ )}
@@ -175,10 +184,7 @@ function Related({ repo, related }: { repo: RepoBundle; related: Finding[] }) { > #{r.rank} - - {TYPE[r.type].label} - {" "} - {r.title} + {TYPE[r.type].label}. {r.title} diff --git a/web/src/routes/Journeys.tsx b/web/src/routes/Journeys.tsx new file mode 100644 index 00000000..a222a67a --- /dev/null +++ b/web/src/routes/Journeys.tsx @@ -0,0 +1,37 @@ +import { useSearchParams } from "react-router"; +import { JourneyPlayer } from "../components/cx/journeys"; +import { useTitle } from "../components/cx/use-page"; +import { NotFound } from "./NotFound"; +import { useJourneys, useRepo } from "./RepoLayout"; + +/** Journeys: follow one user action through the code, the quickest way into a new codebase. */ +export function Journeys() { + const repo = useRepo(); + const journeys = useJourneys(); + const [params] = useSearchParams(); + const start = { + journey: params.get("j"), + stop: Math.max(0, Number(params.get("s") ?? 1) - 1 || 0), + }; + useTitle(`Journeys · ${repo.name}`); + if (!journeys) return ; + return ( +
+
+

+ Follow one request through the code +

+

+ Each journey starts with something a person does in the browser and follows it through the + modules that handle it. The height of the line is the layer: a dip goes down into core + code, a rise brings the result back up. Press Play or pick any stop. +

+
+ +

+ These journeys are a hand-traced sample for {repo.name}, not yet produced by the pipeline. + File paths are shortened to the module folder. +

+
+ ); +} diff --git a/web/src/routes/Overview.tsx b/web/src/routes/Overview.tsx index 66ff7cb8..757c1f7c 100644 --- a/web/src/routes/Overview.tsx +++ b/web/src/routes/Overview.tsx @@ -1,24 +1,20 @@ import { ArrowRight } from "lucide-react"; import { Fragment, type ReactNode } from "react"; import { Link } from "react-router"; -import { ComputedMark } from "../components/cx/badges"; +import { JourneyPreview } from "../components/cx/journeys"; import { FOCUS, cn } from "../components/cx/cn"; -import { SectionHead, StatusDot, StatusPill } from "../components/cx/primitives"; -import { Sparkline, markIndex } from "../components/cx/sparkline"; +import { SectionHead, StatusDot } from "../components/cx/primitives"; import { useTitle } from "../components/cx/use-page"; import { repoPath } from "../cx/address"; -import { STATUS, STATUS_ORDER, pct, statusCounts } from "../cx/meta"; +import { STATUS, STATUS_ORDER, statusCounts } from "../cx/meta"; +import type { JourneyBundle } from "../data/journeys"; import type { RepoBundle, Status } from "../cx/types"; import { BeforeAfter } from "./overview/BeforeAfter"; import { FixFirst } from "./overview/FixFirst"; import { Structure } from "./overview/Structure"; import { TrustStrip } from "./overview/TrustStrip"; -import { useRepo } from "./RepoLayout"; +import { useJourneys, useRepo } from "./RepoLayout"; -/** How many "what holds" cards the overview shows before linking to all decisions. */ -const HEALTHY_SHOWN = 3; -/** How many decisions the overview lists before linking to the Decisions tab. */ -const DECISIONS_SHOWN = 5; /** The statuses that count as not holding in the verdict sentence, worst first. */ const NOT_HOLDING: Status[] = ["broken", "slipping", "spreading"]; @@ -29,15 +25,16 @@ const linkCls = cn( export function Overview() { const repo = useRepo(); + const journeys = useJourneys(); useTitle(`Overview · ${repo.name}`); const compareDate = repo.sponsorDate ?? repo.beforeDate; return (
- + {journeys ? : } - +
); @@ -132,18 +129,10 @@ function StatusBar({ counts, total }: { counts: Record; total: n ); } -/** The verdict, the decisions furthest from holding, then what holds. */ -function DecisionList({ repo, compareDate }: { repo: RepoBundle; compareDate: string }) { +/** The verdict and the status bar; the decisions themselves are one click away. */ +function DecisionList({ repo }: { repo: RepoBundle }) { const counts = statusCounts(repo.decisions); const total = repo.decisions.length; - const shown = [...repo.decisions] - .sort( - (a, b) => - STATUS[a.status].order - STATUS[b.status].order || - a.conformance - b.conformance || - (a.id < b.id ? -1 : a.id > b.id ? 1 : 0), - ) - .slice(0, DECISIONS_SHOWN); return (

{total > 0 && } - {shown.length > 0 && ( -
    - {shown.map((d) => { - const values = d.series.map((s) => s.conformance); - const lo = Math.min(0.75, ...values); - return ( -
  • - - - -

    - {d.statement} -

    - - s.date), - compareDate, - )} - width={72} - height={20} - color={STATUS[d.status].color} - domain={[lo, 1]} - label={`Conformance at each snapshot for ${d.id}`} - /> - - - {pct(d.conformance)} - -
  • - ); - })} -
- )} -
); } -function Healthy({ repo }: { repo: RepoBundle }) { - if (repo.healthy.length === 0) return null; - const shown = repo.healthy.slice(0, HEALTHY_SHOWN); +/** The understandability step: one request followed through the code, or the module list. */ +function FollowOne({ repo, journeys }: { repo: RepoBundle; journeys: JourneyBundle }) { + const first = journeys.journeys[0]; return ( -
-
-

What holds

- {repo.healthy.length > shown.length && ( - - All {repo.healthy.length} holding decisions +
+ + Play the {journeys.journeys.length} journeys{" "} + + } + /> +

+ New to {repo.name}? {first.name}: the line dips as the request goes down through the layers + and rises as the result comes back. +

+ -
    - {shown.map((h) => { - const d = repo.decisions.find((x) => x.id === h.decisionId); - return ( -
  • -
    - {d && } - {d && ( - - {pct(d.conformance)} - - )} -
    -

    {d?.statement ?? h.decisionId}

    -

    - {h.evidence} -

    -
  • - ); - })} -
-
+ aria-label={`Open the journey: ${first.name}`} + > + + + ); } diff --git a/web/src/routes/RepoLayout.tsx b/web/src/routes/RepoLayout.tsx index 101b2e23..5aa4bf22 100644 --- a/web/src/routes/RepoLayout.tsx +++ b/web/src/routes/RepoLayout.tsx @@ -6,11 +6,13 @@ import { FOCUS, cn } from "../components/cx/cn"; import { allFindings } from "../components/cx/finding-fix"; import { SiteFooter, SiteHeader } from "../components/cx/site-header"; import { useLoaded, useTitle } from "../components/cx/use-page"; +import { type JourneyBundle, loadJourneys } from "../data/journeys"; import { loadRepo, loadRepoList } from "../data/repo"; import { NotFound } from "./NotFound"; interface RepoContext { repo: RepoBundle; + journeys: JourneyBundle | null; } /** @@ -21,30 +23,38 @@ export function useRepo(): RepoBundle { return useOutletContext().repo; } +/** The repository's journeys, or null when its bundle folder holds none. */ +export function useJourneys(): JourneyBundle | null { + return useOutletContext().journeys; +} + /** * The tab row. `also` lists the screens that are reached from a tab's page rather than from * the row; while one of them is open, that tab is marked as current. */ const TABS: { tab?: RepoTab; label: string; also?: RepoTab[] }[] = [ { label: "Report", also: ["decisions"] }, + { tab: "journeys", label: "Journeys" }, { tab: "findings", label: "Findings" }, { tab: "map", label: "Map", also: ["size"] }, { tab: "change", label: "Before and after" }, { tab: "trust", label: "Approach" }, ]; -type Load = { state: "missing" } | { state: "found"; repo: RepoBundle }; +type Load = + { state: "missing" } | { state: "found"; repo: RepoBundle; journeys: JourneyBundle | null }; export function RepoLayout() { const id = useParams().repo ?? ""; const loaded = useLoaded(async () => { const list = await loadRepoList(); if (!list.some((b) => b.repo_id === id)) return { state: "missing" }; - return { state: "found", repo: await loadRepo(id) }; + const [repo, journeys] = await Promise.all([loadRepo(id), loadJourneys(id)]); + return { state: "found", repo, journeys }; }, id); - const repo = - loaded.state === "ready" && loaded.value.state === "found" ? loaded.value.repo : null; + const found = loaded.state === "ready" && loaded.value.state === "found" ? loaded.value : null; + const repo = found ? found.repo : null; // Once the repository is loaded, each screen sets its own title. useTitle( loaded.state === "ready" && loaded.value.state === "missing" @@ -87,12 +97,12 @@ export function RepoLayout() {
)} - {repo && } + {found && }
); } -function RepoBody({ repo }: { repo: RepoBundle }) { +function RepoBody({ repo, journeys }: { repo: RepoBundle; journeys: JourneyBundle | null }) { const modules = repo.modules.filter((m) => m.presentAtEnd).length; // Two names and a count keep the line short; the full list is the line's tooltip. const langs = @@ -105,7 +115,7 @@ function RepoBody({ repo }: { repo: RepoBundle }) { `${fmt(repo.prodLoc)} production lines`, `${fmt(modules)} ${modules === 1 ? "module" : "modules"}`, ].filter(Boolean); - const context: RepoContext = { repo }; + const context: RepoContext = { repo, journeys }; return ( <>
@@ -152,7 +162,11 @@ function RepoBody({ repo }: { repo: RepoBundle }) {

)} - +
@@ -167,7 +181,15 @@ function RepoBody({ repo }: { repo: RepoBundle }) { ); } -function RepoNav({ repoId, counts }: { repoId: string; counts: Partial> }) { +function RepoNav({ + repoId, + counts, + hide, +}: { + repoId: string; + counts: Partial>; + hide: RepoTab[]; +}) { const path = useLocation().pathname; const base = repoPath(repoId); const under = (tab: RepoTab) => { @@ -176,7 +198,7 @@ function RepoNav({ repoId, counts }: { repoId: string; counts: Partial - {TABS.map((t) => { + {TABS.filter((t) => !t.tab || !hide.includes(t.tab)).map((t) => { const href = repoPath(repoId, t.tab); const active = (t.tab ? under(t.tab) : path === base || path === `${base}/`) || diff --git a/web/src/routes/finding/Reading.tsx b/web/src/routes/finding/Reading.tsx index 61d8e61d..ce99fd36 100644 --- a/web/src/routes/finding/Reading.tsx +++ b/web/src/routes/finding/Reading.tsx @@ -20,7 +20,7 @@ import type { Finding, RepoBundle } from "../../cx/types"; const GOOD = STATUS.holding.color; -const headCls = "font-mono text-[11px] tracking-[0.14em] text-muted-foreground uppercase"; +const headCls = "text-sm font-semibold text-foreground"; /** * The computed summary without the template's fix sentence when the fix is shown on its own diff --git a/web/src/routes/overview/FixFirst.tsx b/web/src/routes/overview/FixFirst.tsx index b3815b07..ec097d05 100644 --- a/web/src/routes/overview/FixFirst.tsx +++ b/web/src/routes/overview/FixFirst.tsx @@ -1,109 +1,23 @@ import { ArrowRight, ArrowUpRight } from "lucide-react"; import { Link } from "react-router"; -import { AiBadge, ComputedMark } from "../../components/cx/badges"; +import { AiBadge } from "../../components/cx/badges"; import { FOCUS, cn } from "../../components/cx/cn"; -import { allFindings, fixOf } from "../../components/cx/finding-fix"; +import { allFindings } from "../../components/cx/finding-fix"; import { TREND } from "../../components/cx/finding-row"; import { SectionHead } from "../../components/cx/primitives"; import { Sparkline, markIndex } from "../../components/cx/sparkline"; -import { findingPath, mapPath, repoPath } from "../../cx/address"; -import { BATCH_LOOPS_NOTE, NO_FIX_TEXT, TYPE, VERDICT, fmt, pct } from "../../cx/meta"; -import type { Batch, Fact, Finding, RepoBundle } from "../../cx/types"; +import { findingPath, repoPath } from "../../cx/address"; +import { TYPE, VERDICT, fmt } from "../../cx/meta"; +import type { Finding, RepoBundle } from "../../cx/types"; /** How many findings the overview lists before linking to all of them. */ const SHOWN = 5; -/** How many stored facts one row shows. */ -const FACTS_SHOWN = 4; -/** Longer text facts (paths, function lists) are left to the finding page. */ -const SHORT_TEXT = 40; const linkCls = cn( "inline-flex items-center gap-1 rounded-sm text-foreground hover:underline", FOCUS, ); -/** Readable names for the stored fact keys; an unknown key falls back to its own words. */ -const FACT_LABEL: Record = { - direct_users: "Direct users", - changes_12m: "Changes in 12 months", - reach: "Reach", - pressure: "Change pressure", - weak_links: "Weak direction", - strong_links: "Strong direction", - symbol: "Symbol", - shared_commits: "Shared commits", - shared_share: "Changed together", - changes_a: "Changes, first file", - changes_b: "Changes, second file", - violating_links: "Links against the decision", - reverse_links: "Links the other way", - files: "Files", - lines: "Lines", - branches: "Branches", - score: "Changes × branches", - dependencies: "Project files used", - longest_functions: "Longest functions", - top_functions: "Most branched", - feature_links: "Links to features", - instability: "Instability", - modules_total: "Modules", - other_modules_in_area: "Other modules in its area", - user_modules: "Modules using it", - user_modules_in_area: "Users in its area", -}; - -/** Hover text for the facts whose short label needs a word more. */ -const FACT_HINT: Record = { - reach: "Files that use the affected code directly or at one remove", - pressure: "Changes to the affected code in the last 12 months", - instability: "Outgoing links divided by all links of the module", - shared_share: "Share of their changes made in the same commits", -}; - -/** Facts stored as a share between 0 and 1. */ -const SHARE_FACTS = new Set(["shared_share"]); - -function factLabel(key: string): string { - const known = FACT_LABEL[key]; - if (known) return known; - const words = key.replace(/_/g, " "); - return words.charAt(0).toUpperCase() + words.slice(1); -} - -function hasValue(x: Fact): boolean { - const v = x.value as unknown; - return v !== null && v !== undefined && !(typeof v === "string" && v.trim() === ""); -} - -/** - * Up to four stored facts for a list row: numbers first, in stored order, then short text. - * Change pressure is left out when it repeats the stored count of changes. - */ -function rowFacts(f: Finding): Fact[] { - const usable = f.facts.filter(hasValue); - const changes = usable.find((x) => x.key === "changes_12m"); - const kept = usable.filter( - (x) => !(x.key === "pressure" && changes !== undefined && changes.value === x.value), - ); - const numbers = kept.filter((x) => typeof x.value !== "string"); - const texts = kept.filter((x) => typeof x.value === "string" && x.value.length <= SHORT_TEXT); - return [...numbers, ...texts].slice(0, FACTS_SHOWN); -} - -/** The value as the row shows it, with the unit when the label does not already name it. */ -function factText(x: Fact): string { - const v = x.value; - if (typeof v === "boolean") return v ? "yes" : "no"; - if (typeof v === "string") return v; - if (SHARE_FACTS.has(x.key)) return pct(v, 0); - const num = Number.isInteger(v) ? fmt(v) : String(v); - const unit = x.unit; - if (!unit) return num; - const root = unit.replace(/s$/, "").toLowerCase(); - if (factLabel(x.key).toLowerCase().includes(root)) return num; - return `${num} ${v === 1 && unit.length > 1 && unit.endsWith("s") ? unit.slice(0, -1) : unit}`; -} - /** Vermilion is kept for code that goes against a decision; other findings use plain ink. */ function trendStyle(f: Finding): { className: string; color?: string; line: string } { const t = TREND[f.trend.status]; @@ -117,76 +31,40 @@ function trendStyle(f: Finding): { className: string; color?: string; line: stri }; } +/** One finding: rank, the stored headline, why it matters, and where it is heading. */ function Row({ repoId, f, compareDate }: { repoId: string; f: Finding; compareDate: string }) { const t = TREND[f.trend.status]; const ts = trendStyle(f); const series = f.trend.series; - const facts = rowFacts(f); - const fix = fixOf(f); return (
  • - + {f.rank} -
    -

    - {TYPE[f.type].label} +

    +

    + {f.title} +

    +

    + {TYPE[f.type].label}. {TYPE[f.type].why} {f.judgement && ( - + {VERDICT[f.judgement.verdict]} )} - -

    -

    {f.title}

    - {facts.length > 0 && ( -
    - {facts.map((x) => ( -
    -
    {factLabel(x.key)}
    -
    - {factText(x)} -
    -
    - ))} -
    - )} -

    - {TYPE[f.type].why} -

    -

    - Fix - {fix ? ( - <> - - {fix.text} - - {fix.source === "ai" ? ( - - ) : ( - - )} - - ) : ( - {NO_FIX_TEXT} - )}

    -
    +
    p.value)} mark={markIndex( @@ -214,32 +92,7 @@ function Row({ repoId, f, compareDate }: { repoId: string; f: Finding; compareDa ); } -/** One line for the simulated fix batch, linking to the Map after the batch. */ -function BatchLine({ repoId, batch }: { repoId: string; batch: Batch }) { - const n = batch.fixesApplied; - const loops = - batch.loopsAfter === batch.loopsBefore - ? `module loops stay at ${fmt(batch.loopsBefore)}` - : `module loops go from ${fmt(batch.loopsBefore)} to ${fmt(batch.loopsAfter)}`; - const created = batch.newExceptions.length; - return ( -

    - - Simulated fix batch: with{" "} - {fmt(n)}{" "} - {n === 1 ? "fix" : "fixes"} applied together on a copy of the module map, {loops} - {created > 0 && - `, and ${fmt(created)} new ${created === 1 ? "exception" : "exceptions"} appear`} - . Nothing is applied to the code. - - - See it on the map - -

    - ); -} - -/** The top findings, each with its facts, why it matters and its proposed fix. */ +/** The top findings, ranked. Facts, evidence and the proposed fix are on each finding's page. */ export function FixFirst({ repo, compareDate }: { repo: RepoBundle; compareDate: string }) { const total = allFindings(repo).length; return ( @@ -265,7 +118,6 @@ export function FixFirst({ repo, compareDate }: { repo: RepoBundle; compareDate: ))} )} - {repo.batch && } ); } From 63150b10ed0dbdfcee2772040f2d86b849aecef9 Mon Sep 17 00:00:00 2001 From: Viraj5503 Date: Sun, 29 Nov 2026 07:49:25 +0100 Subject: [PATCH 07/10] Simplify the map and before and after pages and their wording --- web/src/components/cx/closeup.tsx | 6 +- web/src/components/cx/map-controls.tsx | 14 +-- web/src/components/cx/matrix.tsx | 8 +- web/src/cx/meta.ts | 26 +++-- web/src/routes/Change.tsx | 76 ++++++--------- web/src/routes/MapPage.tsx | 28 ++---- web/src/routes/change/drift.tsx | 50 +++------- web/src/routes/change/events.tsx | 122 ++++++++++++++++++------ web/src/routes/map/CellPanel.tsx | 2 +- web/src/routes/overview/BeforeAfter.tsx | 12 +-- 10 files changed, 184 insertions(+), 160 deletions(-) diff --git a/web/src/components/cx/closeup.tsx b/web/src/components/cx/closeup.tsx index fe85b554..95d7615c 100644 --- a/web/src/components/cx/closeup.tsx +++ b/web/src/components/cx/closeup.tsx @@ -163,7 +163,7 @@ export function Closeup({ repo, finding }: { repo: RepoBundle; finding: Finding const ly = (sy + ey) / 2 + (off ? ny * 1.8 : (dx / len) * 8) + 3; return ( - {`${at.get(e.src)!.label} uses ${at.get(e.dst)!.label}: ${e.count} ${e.count === 1 ? "link" : "links"}, ${e.against ? "against" : "with"} the grain`} + {`${at.get(e.src)!.label} uses ${at.get(e.dst)!.label}: ${e.count} ${e.count === 1 ? "link" : "links"}, ${e.against ? "backward" : "forward"}`}
  • - with the grain + forward link
  • - against the grain + backward link
  • {partners && (
  • diff --git a/web/src/components/cx/map-controls.tsx b/web/src/components/cx/map-controls.tsx index f006d717..474be24b 100644 --- a/web/src/components/cx/map-controls.tsx +++ b/web/src/components/cx/map-controls.tsx @@ -8,7 +8,7 @@ import type { Finding, RepoBundle, Yardstick } from "../../cx/types"; import { FOCUS, cn } from "./cn"; export const GRID_ORDER_NOTE = - "The grid keeps one module order for every view, so its cells below the diagonal can differ from the stored totals above it, which use each date's own order."; + "Every view keeps the same module order so squares line up between dates. The totals above use each date's own order, so they can differ slightly from the squares."; export function viewLabel(repo: RepoBundle, view: MapView): string { if (view === "before") return `Before · ${repo.beforeDate.slice(0, 7)}`; @@ -126,7 +126,7 @@ export function GridNumbers({ return (
    -
    loops in this simulation
    +
    module loops in this simulation
    {fmt(s.loopsBefore)} → {fmt(s.loopsAfter)}
    @@ -140,7 +140,7 @@ export function GridNumbers({ return (
    -
    loops, simulation's count
    +
    module loops, before and after the fixes
    {fmt(b.loopsBefore)} → {fmt(b.loopsAfter)}
    @@ -163,7 +163,7 @@ export function GridNumbers({ > {share !== null && (
    -
    against grain
    +
    backward links
    {pct(share)} {!small && links !== null && ( @@ -174,7 +174,7 @@ export function GridNumbers({ )} {pairs !== null && (
    -
    two-way pairs
    +
    two-way dependencies
    {fmt(pairs)}
    )} @@ -203,10 +203,10 @@ export function MapLegend({ )} >
  • - with the grain + forward link
  • - against the grain + backward link
  • diff --git a/web/src/components/cx/matrix.tsx b/web/src/components/cx/matrix.tsx index c747874f..57effd3c 100644 --- a/web/src/components/cx/matrix.tsx +++ b/web/src/components/cx/matrix.tsx @@ -89,7 +89,7 @@ export function cellName( const v = values[i]![j]!; const head = `${src.path}${only(src)} uses ${dst.path}${only(dst)}`; const body = - v === 0 ? `${head}, no links` : `${head} ${times(v)}, ${i > j ? "against" : "with"} the grain`; + v === 0 ? `${head}, no links` : `${head} ${times(v)}, ${i > j ? "backward" : "forward"}`; return change ? `${body}; ${fmt(change.before)} to ${fmt(change.after)} links ${changeSource}`.trim() : body; @@ -327,7 +327,7 @@ export function Matrix({
    {" · "} j ? "text-accent" : "text-primary"}> - {i > j ? "against the grain" : "with the grain"} + {i > j ? "backward link" : "forward link"} )} @@ -870,7 +870,7 @@ function Tip({ {v > 0 && ( j ? "text-accent" : "text-primary"}> {" · "} - {i > j ? "against the grain" : "with the grain"} + {i > j ? "backward link" : "forward link"} )} diff --git a/web/src/cx/meta.ts b/web/src/cx/meta.ts index 60e22225..bbe4c3a4 100644 --- a/web/src/cx/meta.ts +++ b/web/src/cx/meta.ts @@ -12,26 +12,36 @@ import type { // Okabe-Ito categorical palette (colour-blind safe), spec §10.5 export const STATUS: Record = { - broken: { label: "Broken", color: "#D55E00", order: 0, hint: "Conformance below 90%" }, + broken: { + label: "Broken", + color: "#D55E00", + order: 0, + hint: "Kept in less than 90% of the code it covers", + }, slipping: { - label: "Slipping", + label: "Getting worse", color: "#E69F00", order: 1, - hint: "Fell by more than 1 point over the last two snapshots", + hint: "Kept less often than before: down more than 1 point over the last two snapshots", }, spreading: { - label: "Spreading", + label: "Reaching more modules", color: "#CC79A7", order: 2, - hint: "The number of modules the rule covers is growing", + hint: "The rule now covers more modules than before, so there is more code that has to keep it", }, mostly_holding: { label: "Mostly holding", color: "#56B4E9", order: 3, - hint: "90% to 98%, stable", + hint: "Kept in 90% to 98% of the code it covers, and stable", + }, + holding: { + label: "Holding", + color: "#009E73", + order: 4, + hint: "Kept in at least 98% of the code it covers", }, - holding: { label: "Holding", color: "#009E73", order: 4, hint: "Conformance at least 98%" }, }; export const STATUS_ORDER: Status[] = [ @@ -143,7 +153,7 @@ export const NO_FIX_TEXT = "No improvement proposed."; /** Said next to the simulated batch's loop counts, which are not the yardstick's pairs. */ export const BATCH_LOOPS_NOTE = - "Loop counts here are the simulation's own, on its set of module links, so they differ from the two-way pairs yardstick."; + "Loop counts here are the simulation's own, on its set of module links, so they differ from the two-way dependencies count."; /** * A readable label for each stored fact key. The value is shown after it with the fact's diff --git a/web/src/routes/Change.tsx b/web/src/routes/Change.tsx index 232283f5..953ab9b2 100644 --- a/web/src/routes/Change.tsx +++ b/web/src/routes/Change.tsx @@ -14,7 +14,7 @@ import { ShowMoreButton, useShowMore } from "./decisions/show-more"; import { useRepo } from "./RepoLayout"; /** Hotspots and new links shown before "Show all". */ -const FIRST = 8; +const FIRST = 5; const pathLinkCls = cn("rounded-sm hover:underline decoration-border underline-offset-2", FOCUS); @@ -59,10 +59,13 @@ function Header({ repo }: { repo: RepoBundle }) {

    Before and after {monthYear(compared)}

    +

    + Did the structure get better or worse once the team started using AI coding tools? +

    - This page describes what changed between the dates and attributes no change to AI tools: - changes with an explicit AI marker are a lower bound, and code without one is counted as - no AI signal. + This page shows what changed between the two dates. It does not blame any change on AI: + only commits with an explicit AI marker are counted as AI, so that share is a lower bound, + and everything else is no AI signal.

    @@ -121,22 +124,11 @@ function Hotspots({ repo }: { repo: RepoBundle }) { const maxZ = Math.max(...repo.hotspots.map((h) => h.z), 1); return (
    - -
    -

    - Rule: z = (recent − prior) ÷ √(prior + 1) of at least 3, with at least 2 changes per month - recently; new files and restructuring commits are left out. -

    -

    - recent: changes in the last 3 months.{" "} - prior: expected changes in 3 months, - from the months before. The bar is z. -

    -
    + +

    + Files that changed far more often in the last 3 months than their own history predicts. New + files and restructuring commits are left out. +

    {repo.hotspots.length === 0 ? (

    No file met the rule in this run.

    ) : ( @@ -160,10 +152,10 @@ function Hotspots({ repo }: { repo: RepoBundle }) { )} - prior {h.prior.toFixed(2)}{" "} - {" "} - recent{" "} - {fmt(h.recent)} + {fmt(h.recent)}{" "} + + changes, {h.prior.toFixed(1)} expected +
    {dir && ( @@ -178,15 +170,16 @@ function Hotspots({ repo }: { repo: RepoBundle }) { {h.moduleName ?? "no module"} - + - - z {h.z.toFixed(1)} -
  • ); @@ -226,16 +219,12 @@ function NewLinks({ repo }: { repo: RepoBundle }) { }; return (
    - +

    {fmt(added.length)} new {added.length === 1 ? "link" : "links"} between modules:{" "} - {fmt(c.planned)} planned, {fmt(c.none)} with no stated intent. Each one's evidence is - listed under structural events. + {fmt(c.planned)} planned, {fmt(c.none)} unexplained. Each one's evidence is listed under + "Show every change" above.

    {plan && (

    @@ -301,8 +290,7 @@ function AiRisk({ repo }: { repo: RepoBundle }) { {repo.aiRisk && (

    @@ -336,16 +324,12 @@ function AiRisk({ repo }: { repo: RepoBundle }) { )}
    - } - /> + } />

    - Each evidence line is credited to the last change that touched it, which is not always the - change that first wrote it. The marked share counts explicit AI markers only, so it is a - lower bound.{missing && ` ${missing}`} + For each top finding: how much of the code behind it changed after {sponsor}, and how much + of that carries an explicit AI marker. Each line counts toward the last change that + touched it. Only explicit markers count as AI, so the AI share is a lower bound. + {missing && ` ${missing}`}

    {repo.findings.length === 0 ? (

    No finding was ranked in this run.

    diff --git a/web/src/routes/MapPage.tsx b/web/src/routes/MapPage.tsx index b369367b..62646cf7 100644 --- a/web/src/routes/MapPage.tsx +++ b/web/src/routes/MapPage.tsx @@ -18,15 +18,8 @@ import { topFindingCells, } from "../components/cx/map-model"; import { type Cell, Matrix } from "../components/cx/matrix"; -import { Eyebrow } from "../components/cx/primitives"; import { useTitle } from "../components/cx/use-page"; -import { - type MapState, - type MapView, - readMapState, - repoPath, - withMapState, -} from "../cx/address"; +import { type MapState, type MapView, readMapState, repoPath, withMapState } from "../cx/address"; import { fmt } from "../cx/meta"; import { useRepo } from "./RepoLayout"; import { CellPanel } from "./map/CellPanel"; @@ -112,19 +105,16 @@ export function MapPage() { return (
    - - Map · {fmt(present)} {present === 1 ? "module" : "modules"} - {listsBeforeOnly && - beforeOnly > 0 && - ` · ${fmt(beforeOnly)} more only at the before date`} -

    Which module uses which

    - Each row uses the columns it has links into, and cells below the diagonal point against - the main direction of dependencies (against the grain). Click a cell to list the code - links behind it. + Every square is one of the {fmt(present)} modules using another. Above the diagonal, blue + squares point the normal way, from features down to the shared code they build on. Below + it, orange squares point backwards. Click a square to see the code behind it. + {listsBeforeOnly && + beforeOnly > 0 && + ` ${fmt(beforeOnly)} more ${beforeOnly === 1 ? "module" : "modules"} existed only at the before date.`}

    } /> -

    {GRID_ORDER_NOTE}

    +

    + {GRID_ORDER_NOTE} +

    {picture.changes.length > 0 && ( @@ -143,7 +133,7 @@ function DecisionDrift({ repo }: { repo: RepoBundle }) { return (
    - +
    - @@ -179,7 +164,6 @@ function DecisionDrift({ repo }: { repo: RepoBundle }) { - +
    Each decision's conformance and exceptions per 1,000 lines at {repo.beforeDate} and at the end snapshot @@ -157,17 +147,12 @@ function DecisionDrift({ repo }: { repo: RepoBundle }) { status now
    - conformance -
    - {repo.beforeDate} → now -
    - per 1,000 lines + code that keeps it
    {repo.beforeDate} → now
    - conformance at each snapshot + over time
    {d.statement} - {d.id} @@ -192,14 +176,7 @@ function DecisionDrift({ repo }: { repo: RepoBundle }) { )}{" "} → {pct(d.conformance)} - {before ? ( - before.perKloc.toFixed(3) - ) : ( - no check - )}{" "} - → {d.perKloc.toFixed(3)} - } /> @@ -254,7 +230,7 @@ export function Drift({ repo }: { repo: RepoBundle }) { /> ))} -

    Per decision

    +

    Each decision, then and now

    ); diff --git a/web/src/routes/change/events.tsx b/web/src/routes/change/events.tsx index 12c6fc46..9f8a76b3 100644 --- a/web/src/routes/change/events.tsx +++ b/web/src/routes/change/events.tsx @@ -10,7 +10,7 @@ import { EvidenceList } from "./evidence"; export const LABEL: Record = { planned: "planned", - no_stated_intent: "no stated intent", + no_stated_intent: "unexplained", }; export const BASIS: Record, string> = { @@ -102,7 +102,7 @@ function Group({

    {title} - {fmt(events.length)} · {fmt(c.planned)} planned · {fmt(c.none)} no stated intent + {fmt(events.length)} · {fmt(c.planned)} planned · {fmt(c.none)} unexplained

      @@ -132,45 +132,107 @@ export function StructuralEvents({ repo }: { repo: RepoBundle }) { ? [...list].sort((a, b) => byText(a.fromDate ?? "", b.fromDate ?? "") || byText(a.id, b.id)) : list; }; + const rows = GROUPS.map((g) => ({ ...g, events: byKind(g.kind) })).filter( + (g) => g.events.length > 0, + ); + const th = "px-4 py-2.5 text-right font-normal whitespace-nowrap"; return ( -
      +
      - {fmt(repo.events.length)} {repo.events.length === 1 ? "event" : "events"} ·{" "} - {fmt(c.planned)} planned · {fmt(c.none)} no stated intent + + {fmt(repo.events.length)} {repo.events.length === 1 ? "change" : "changes"} } /> -
        -
      • - planned: a basis was found -
      • -
      • - no stated intent: no basis was found, which does not make - it unintended -
      • -
      • - built from stored facts -
      • -
      • - written by an AI model, citations checked -
      • -
      +

      + Drift is not automatically bad. A change counts as planned when a restructuring commit, a + decision document or a pull request explains it. A change without one is not called a + mistake, only unexplained. +

      {repo.events.length === 0 ? (

      - No structural event was found between the two dates in this run. + No structural change was found between the two dates in this run.

      ) : ( - GROUPS.map((g) => { - const events = byKind(g.kind); - return events.length === 0 ? null : ( - - ); - }) + <> +
      + + + + + + + + + + + + {rows.map((g) => { + const k = labelCounts(g.events); + return ( + + + + + + + ); + })} + + + + + + + + + +
      Structural changes by kind and by stated intent
      + Kind of change + + Total + + + Planned + + + + Unexplained + +
      + {g.title} + + {fmt(g.events.length)} + {fmt(k.planned)} + {fmt(k.none)} +
      + All changes + + {fmt(repo.events.length)} + {fmt(c.planned)}{fmt(c.none)}
      +
      +
      + + Show every change with its evidence + +
      +
        +
      • + built from stored facts +
      • +
      • + written by an AI model, citations checked +
      • +
      + {rows.map((g) => ( + + ))} +
      +
      + )}
      ); diff --git a/web/src/routes/map/CellPanel.tsx b/web/src/routes/map/CellPanel.tsx index 6383dfd5..0c08b47d 100644 --- a/web/src/routes/map/CellPanel.tsx +++ b/web/src/routes/map/CellPanel.tsx @@ -72,7 +72,7 @@ export function CellPanel({ <> {" · "} - {against ? "against the grain" : "with the grain"} + {against ? "backward link" : "forward link"} )} diff --git a/web/src/routes/overview/BeforeAfter.tsx b/web/src/routes/overview/BeforeAfter.tsx index 6b133655..a9272673 100644 --- a/web/src/routes/overview/BeforeAfter.tsx +++ b/web/src/routes/overview/BeforeAfter.tsx @@ -97,18 +97,18 @@ export function BeforeAfter({ repo, compareDate }: { repo: RepoBundle; compareDa const y = repo.yardsticks; const rows = [ { - label: "Links against the grain", - hint: "Share of links between modules that point against the main direction of dependencies.", + label: "Backward links", + hint: "Share of links between modules that point backwards, from shared code up to the features that use it.", y: y.againstGrainShare, }, { - label: "Module pairs using each other", - hint: "Two modules that depend on each other cannot be changed or tested alone.", + label: "Two-way dependencies", + hint: "Pairs of modules that use each other, so neither can be changed or tested alone.", y: y.twoWayPairs, }, { - label: "Exceptions per 1,000 lines", - hint: "Decision exceptions per 1,000 lines of code, for the decisions that apply.", + label: "Rule breaks per 1,000 lines", + hint: "Code that goes against a recorded decision, per 1,000 lines of code.", y: y.perKloc, }, ].flatMap((r) => (r.y.now === null ? [] : [{ ...r, now: r.y.now }])); From 041b3ec22a4c6e4217f89e6281bea444ebfbe9ab Mon Sep 17 00:00:00 2001 From: Viraj5503 Date: Sun, 29 Nov 2026 07:49:45 +0100 Subject: [PATCH 08/10] Use a full border on the proposed fix box --- web/src/routes/finding/Reading.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/routes/finding/Reading.tsx b/web/src/routes/finding/Reading.tsx index ce99fd36..452f763d 100644 --- a/web/src/routes/finding/Reading.tsx +++ b/web/src/routes/finding/Reading.tsx @@ -133,7 +133,7 @@ function FixBlock({ to?: string | null; }) { return ( -
      +
      Proposed fix · {ACTION[fix.action]} {symbol && {symbol}} @@ -152,7 +152,7 @@ function FixBlock({ function NoFix({ note }: { note: string | null }) { return ( -
      +

      {NO_FIX_TEXT}

      {note && (
      From 7b87533aa93a2e1de7d3b5ef849d41e7a15e7ca6 Mon Sep 17 00:00:00 2001 From: Viraj5503 Date: Sun, 29 Nov 2026 07:57:19 +0100 Subject: [PATCH 09/10] Show the impact since the comparison date at a glance --- web/src/routes/Change.tsx | 5 + web/src/routes/change/impact.tsx | 369 ++++++++++++++++++++++++ web/src/routes/overview/BeforeAfter.tsx | 134 +-------- 3 files changed, 388 insertions(+), 120 deletions(-) create mode 100644 web/src/routes/change/impact.tsx diff --git a/web/src/routes/Change.tsx b/web/src/routes/Change.tsx index 953ab9b2..09a19b7e 100644 --- a/web/src/routes/Change.tsx +++ b/web/src/routes/Change.tsx @@ -9,6 +9,7 @@ import { findingPath } from "../cx/address"; import { fmt, hostLink, pct } from "../cx/meta"; import type { RepoBundle, StructuralEvent } from "../cx/types"; import { Drift } from "./change/drift"; +import { Impact } from "./change/impact"; import { LabelChip, StructuralEvents, labelCounts } from "./change/events"; import { ShowMoreButton, useShowMore } from "./decisions/show-more"; import { useRepo } from "./RepoLayout"; @@ -34,6 +35,10 @@ export function Change() { return (
      +
      + + +
      diff --git a/web/src/routes/change/impact.tsx b/web/src/routes/change/impact.tsx new file mode 100644 index 00000000..133fff87 --- /dev/null +++ b/web/src/routes/change/impact.tsx @@ -0,0 +1,369 @@ +// The impact at a glance: each stored measure at the comparison date against now, drawn as two +// dots on one line, with whether that is better or worse and how fast it moved before and after. +// Every value is a stored series point; this file only compares two of them. +import { ComputedMark } from "../../components/cx/badges"; +import { cn } from "../../components/cx/cn"; +import { allFindings } from "../../components/cx/finding-fix"; +import { STATUS, fmt, pct } from "../../cx/meta"; +import type { Finding, RepoBundle, SeriesPoint } from "../../cx/types"; + +const WORSE = STATUS.slipping.color; +const BETTER = STATUS.holding.color; +/** A move smaller than this share of the old value reads as "about the same". */ +const SAME = 0.03; + +type Verdict = "worse" | "better" | "same"; + +interface Measure { + /** Stored yardstick name. */ + series: string; + label: string; + question: string; + lowerIsBetter: boolean; + format: (v: number) => string; + /** Formats a change per month. */ + pace: (v: number) => string; +} + +const sign = (v: number) => (v > 0 ? "+" : v < 0 ? "−" : "±"); + +const MEASURES: Measure[] = [ + { + series: "against_grain_share", + label: "Backward links", + question: "Does shared code reach back up into features?", + lowerIsBetter: true, + format: (v) => pct(v), + pace: (v) => `${sign(v)}${Math.abs(v * 100).toFixed(2)} pts`, + }, + { + series: "two_way_module_pairs", + label: "Two-way dependencies", + question: "Are modules more tangled with each other?", + lowerIsBetter: true, + format: (v) => fmt(Math.round(v)), + pace: (v) => `${sign(v)}${Math.abs(v).toFixed(1)}`, + }, + { + series: "exceptions_per_kloc", + label: "Rule breaks per 1,000 lines", + question: "Does new code break the recorded decisions more often?", + lowerIsBetter: true, + format: (v) => v.toFixed(2), + pace: (v) => `${sign(v)}${Math.abs(v).toFixed(3)}`, + }, + { + series: "decisions_holding", + label: "Decisions still holding", + question: "How many architecture decisions are still kept?", + lowerIsBetter: false, + format: (v) => fmt(Math.round(v)), + pace: (v) => `${sign(v)}${Math.abs(v).toFixed(2)}`, + }, +]; + +/** The stored point on the date, or the last one before it. */ +function pointAt(series: SeriesPoint[], date: string): SeriesPoint | null { + let hit: SeriesPoint | null = null; + for (const p of series) if (p.date <= date) hit = p; + return hit; +} + +/** Months between two ISO dates, at least a tenth of a month. */ +function months(a: string, b: string): number { + const d = (Date.parse(b) - Date.parse(a)) / (1000 * 60 * 60 * 24 * 30.44); + return Math.max(0.1, d); +} + +function verdictOf(m: Measure, before: number, now: number): Verdict { + const base = Math.max(Math.abs(before), 1e-9); + if (Math.abs(now - before) / base < SAME) return "same"; + const rose = now > before; + return rose === m.lowerIsBetter ? "worse" : "better"; +} + +interface Row { + m: Measure; + before: SeriesPoint; + now: SeriesPoint; + verdict: Verdict; + /** Change per month before the comparison date and after it; null without enough points. */ + paceBefore: number | null; + paceAfter: number; +} + +function rowsOf(repo: RepoBundle, compareDate: string): Row[] { + return MEASURES.flatMap((m) => { + const s = repo.yardstickSeries[m.series] ?? []; + const before = pointAt(s, compareDate); + const now = s.at(-1); + if (!before || !now || now === before) return []; + const first = s[0]; + const paceBefore = + first && first !== before + ? (before.value - first.value) / months(first.date, before.date) + : null; + const paceAfter = (now.value - before.value) / months(before.date, now.date); + return [ + { m, before, now, verdict: verdictOf(m, before.value, now.value), paceBefore, paceAfter }, + ]; + }); +} + +const VERDICT_TEXT: Record = { + worse: "Worse", + better: "Better", + same: "About the same", +}; + +function VerdictTag({ v }: { v: Verdict }) { + return ( + + + {VERDICT_TEXT[v]} + + ); +} + +/** Two dots on one line: hollow is then, filled is now. The line between them carries the verdict. */ +function Dumbbell({ row }: { row: Row }) { + const { before, now, verdict } = row; + const hi = Math.max(before.value, now.value) * 1.12 || 1; + const x = (v: number) => 8 + (v / hi) * 284; + const color = + verdict === "worse" ? WORSE : verdict === "better" ? BETTER : "var(--muted-foreground)"; + const a = x(before.value); + const b = x(now.value); + const dir = b >= a ? 1 : -1; + return ( + + + + + + + ); +} + +function paceText(row: Row): string | null { + const { paceBefore: pb, paceAfter: pa, m } = row; + if (pb === null) return null; + const word = (v: number) => (Math.abs(v) < 1e-9 ? "flat" : `${m.pace(v)} a month`); + return `Before: ${word(pb)}. After: ${word(pa)}.`; +} + +/** How the pace after the comparison date compares with the pace before it. */ +function momentum(row: Row): string | null { + const { paceBefore: pb, paceAfter: pa } = row; + if (pb === null || Math.abs(pa) < 1e-9) return null; + if (Math.abs(pb) < 1e-9) return pa > 0 ? "started rising" : "started falling"; + if (Math.sign(pb) !== Math.sign(pa)) return pa > 0 ? "turned upward" : "turned downward"; + const r = Math.abs(pa) / Math.abs(pb); + if (r >= 1.25) return "moving faster than before"; + if (r <= 0.8) return "moving slower than before"; + return "same pace as before"; +} + +function MeasureRow({ row, compact }: { row: Row; compact: boolean }) { + const { m, before, now, verdict } = row; + const pace = compact ? null : paceText(row); + return ( +
    1. +
      +

      {m.label}

      +

      + {m.question}{" "} + + ({m.lowerIsBetter ? "lower" : "higher"} is better) + +

      + {pace &&

      {pace}

      } +
      + + {m.format(before.value)} + +
      + + {m.format(before.value)} + + + + {m.format(now.value)} + +
      + + {m.format(now.value)} + + + + {!compact && momentum(row) && ( + {momentum(row)} + )} + +
    2. + ); +} + +const TREND_PARTS: { key: Finding["trend"]["status"]; label: string; color: string }[] = [ + { key: "new_since_2025_03", label: "new since March 2025", color: "var(--foreground)" }, + { key: "worse", label: "getting worse", color: WORSE }, + { key: "unchanged", label: "unchanged", color: "var(--border)" }, + { key: "better", label: "improving", color: BETTER }, +]; + +/** Every ranked problem, split by how it moved over the snapshots. */ +function ProblemTrend({ repo }: { repo: RepoBundle }) { + const all = allFindings(repo); + if (all.length === 0) return null; + const counts = TREND_PARTS.map((p) => ({ + ...p, + n: all.filter((f) => f.trend.status === p.key).length, + })); + return ( +
      +

      The {fmt(all.length)} problems found, by how they moved

      +
      `${c.n} ${c.label}`).join(", ")} + > + {counts.map( + (c) => + c.n > 0 && ( + + ), + )} +
      +
        + {counts.map((c) => ( +
      • + + {fmt(c.n)}{" "} + {c.label} +
      • + ))} +
      +
      + ); +} + +/** "3 measures got worse and 1 got better." */ +function Headline({ rows }: { rows: Row[] }) { + const n = (v: Verdict) => rows.filter((r) => r.verdict === v).length; + const parts: { v: Verdict; text: string }[] = []; + if (n("worse")) parts.push({ v: "worse", text: `${n("worse")} got worse` }); + if (n("better")) parts.push({ v: "better", text: `${n("better")} got better` }); + if (n("same")) parts.push({ v: "same", text: `${n("same")} stayed about the same` }); + return ( +

      + Of {rows.length} measures,{" "} + {parts.map((p, i) => ( + + {i > 0 && (i === parts.length - 1 ? " and " : ", ")} + + {p.text} + + + ))} + . +

      + ); +} + +export function Impact({ + repo, + compareDate, + compact = false, +}: { + repo: RepoBundle; + compareDate: string; + compact?: boolean; +}) { + const rows = rowsOf(repo, compareDate); + if (rows.length === 0) return null; + const nowDate = rows[0].now.date; + const size = repo.yardstickSeries.cross_module_links ?? []; + const sizeBefore = pointAt(size, compareDate); + const sizeNow = size.at(-1); + const grew = + sizeBefore && sizeNow && sizeBefore.value > 0 + ? (sizeNow.value - sizeBefore.value) / sizeBefore.value + : null; + return ( +
      + +
      +
      + measure + {compareDate} + + + + + then + + + + now + + {nowDate} + since then +
      +
        + {rows.map((r) => ( + + ))} +
      + {!compact && } +
      +

      + {grew !== null && grew > 0.05 && ( + <> + The code itself grew: links between modules went from {fmt(sizeBefore!.value)} to{" "} + {fmt(sizeNow!.value)} ({sign(grew)} + {Math.round(Math.abs(grew) * 100)}%). Backward links and rule breaks per 1,000 lines are + rates, so they already allow for that.{" "} + + )} + These are stored measurements at two dates. They show what changed, not that AI caused it.{" "} + +

      +
      + ); +} diff --git a/web/src/routes/overview/BeforeAfter.tsx b/web/src/routes/overview/BeforeAfter.tsx index a9272673..f09b80e7 100644 --- a/web/src/routes/overview/BeforeAfter.tsx +++ b/web/src/routes/overview/BeforeAfter.tsx @@ -1,12 +1,10 @@ import { ArrowRight } from "lucide-react"; import { Link } from "react-router"; -import { ComputedMark } from "../../components/cx/badges"; import { FOCUS, cn } from "../../components/cx/cn"; import { SectionHead } from "../../components/cx/primitives"; -import { Sparkline, markIndex } from "../../components/cx/sparkline"; import { repoPath } from "../../cx/address"; -import { STATUS, fmt, pct } from "../../cx/meta"; -import type { RepoBundle, Yardstick } from "../../cx/types"; +import type { RepoBundle } from "../../cx/types"; +import { Impact } from "../change/impact"; const MONTHS = [ "January", @@ -30,89 +28,8 @@ export function monthYear(date: string): string { return m && name ? `${name} ${m[1]}` : date; } -/** Formats a yardstick value; both values of one yardstick share the number of decimals. */ -function formatter(y: Yardstick): (v: number) => string { - if (y.unit === "share") return (v) => pct(v); - if (y.unit === "pairs" || y.unit === "links" || y.unit === "decisions") return (v) => fmt(v); - const values = [y.now, y.before].filter((v): v is number => v !== null); - const decimals = values.some((v) => v !== 0 && Math.abs(v) < 0.1) ? 3 : 2; - return (v) => v.toFixed(decimals); -} - -function YardstickCell({ - label, - hint, - y, - now, - compareDate, -}: { - label: string; - hint: string; - y: Yardstick; - now: number; - compareDate: string; -}) { - const f = formatter(y); - const change = - y.before === null ? null : now > y.before ? "up" : now < y.before ? "down" : "same"; - return ( -
      -
      {label}
      -
      - - {f(now)} - {y.before !== null && ( - - {change === "up" ? "▲ " : change === "down" ? "▼ " : ""} - {change === "same" ? "unchanged from" : "from"} {f(y.before)} - - )} - - p.value)} - mark={markIndex( - y.series.map((p) => p.date), - compareDate, - )} - width={84} - height={22} - color={change === "up" ? "var(--accent)" : "var(--primary)"} - label={`${label} at each snapshot, ${y.series[0]?.date ?? ""} to ${y.series.at(-1)?.date ?? ""}`} - /> -
      -

      {hint}

      -
      - ); -} - -/** The three yardsticks at the end snapshot against the comparison date. */ +/** The report's view of the bonus question: the impact panel, short form. */ export function BeforeAfter({ repo, compareDate }: { repo: RepoBundle; compareDate: string }) { - const y = repo.yardsticks; - const rows = [ - { - label: "Backward links", - hint: "Share of links between modules that point backwards, from shared code up to the features that use it.", - y: y.againstGrainShare, - }, - { - label: "Two-way dependencies", - hint: "Pairs of modules that use each other, so neither can be changed or tested alone.", - y: y.twoWayPairs, - }, - { - label: "Rule breaks per 1,000 lines", - hint: "Code that goes against a recorded decision, per 1,000 lines of code.", - y: y.perKloc, - }, - ].flatMap((r) => (r.y.now === null ? [] : [{ ...r, now: r.y.now }])); - return (
      } /> -

      - - {repo.adoptionDate ? ( - <> - The team adopted AI coding tools around{" "} - {repo.adoptionDate.slice(0, 7)} - .{" "} - - ) : ( - <>No adoption date of AI coding tools was detected in this run. - )} - Each value is at the end snapshot, with its value at{" "} - {compareDate.slice(0, 7)} below it. - - +

      + {repo.adoptionDate ? ( + <> + The team adopted AI coding tools around{" "} + {repo.adoptionDate.slice(0, 7)}. Here + is how the structure moved from {monthYear(compareDate)} to now. + + ) : ( + <>How the structure moved from {monthYear(compareDate)} to now. + )}

      - {rows.length > 0 && ( -
      - {rows.map((r) => ( - - ))} -
      - )} +
      ); } From 0a6b8aa41306ec7dc59b16604f03a842ae04841b Mon Sep 17 00:00:00 2001 From: Viraj5503 Date: Sun, 29 Nov 2026 08:03:43 +0100 Subject: [PATCH 10/10] Order the report by the judging points and show robustness and AI use plainly --- web/src/components/cx/journeys.tsx | 2 +- web/src/routes/Overview.tsx | 57 +++++---- web/src/routes/overview/Structure.tsx | 35 +++++ web/src/routes/overview/TrustStrip.tsx | 169 +++++++++++++++++-------- 4 files changed, 181 insertions(+), 82 deletions(-) diff --git a/web/src/components/cx/journeys.tsx b/web/src/components/cx/journeys.tsx index 4b1f4e65..ec07f89f 100644 --- a/web/src/components/cx/journeys.tsx +++ b/web/src/components/cx/journeys.tsx @@ -87,7 +87,7 @@ function Wave({ const n = stops.length; // The still preview packs the lanes closer so the drawing stays short on the report page. const laneH = compact ? 50 : LANE_H; - const laneY = (i: number) => (compact ? 40 : 46) + i * laneH; + const laneY = (i: number) => (compact ? 54 : 46) + i * laneH; const pts = stops.map((s, i) => ({ x: X0 + (i * (X1 - X0)) / Math.max(1, n - 1), y: laneY(s.lane), diff --git a/web/src/routes/Overview.tsx b/web/src/routes/Overview.tsx index 757c1f7c..4b394927 100644 --- a/web/src/routes/Overview.tsx +++ b/web/src/routes/Overview.tsx @@ -11,7 +11,7 @@ import type { JourneyBundle } from "../data/journeys"; import type { RepoBundle, Status } from "../cx/types"; import { BeforeAfter } from "./overview/BeforeAfter"; import { FixFirst } from "./overview/FixFirst"; -import { Structure } from "./overview/Structure"; +import { MainModules } from "./overview/Structure"; import { TrustStrip } from "./overview/TrustStrip"; import { useJourneys, useRepo } from "./RepoLayout"; @@ -32,7 +32,7 @@ export function Overview() { return (
      - {journeys ? : } + @@ -155,35 +155,42 @@ function DecisionList({ repo }: { repo: RepoBundle }) { ); } -/** The understandability step: one request followed through the code, or the module list. */ -function FollowOne({ repo, journeys }: { repo: RepoBundle; journeys: JourneyBundle }) { - const first = journeys.journeys[0]; +/** Understandability: the main modules, then one request followed through them. */ +function HowItFits({ repo, journeys }: { repo: RepoBundle; journeys: JourneyBundle | null }) { + const first = journeys?.journeys[0]; return ( -
      +
      - Play the {journeys.journeys.length} journeys{" "} - + + Open the full map } /> -

      - New to {repo.name}? {first.name}: the line dips as the request goes down through the layers - and rises as the result comes back. -

      - - - + + {journeys && first && ( +
      +
      +

      How they work together: {first.name.toLowerCase()}

      + + Play the {journeys.journeys.length} journeys{" "} + + +
      + + + +
      + )}
      ); } diff --git a/web/src/routes/overview/Structure.tsx b/web/src/routes/overview/Structure.tsx index 38a28477..f1cd2386 100644 --- a/web/src/routes/overview/Structure.tsx +++ b/web/src/routes/overview/Structure.tsx @@ -6,6 +6,8 @@ import type { ModuleInfo, RepoBundle } from "../../cx/types"; /** How many modules the structure list shows. */ const MODULES_SHOWN = 8; +/** How many the report's short list shows. */ +const MODULES_SHORT = 6; /** The module's number as the Map's axes show it. */ const pad = (i: number, n: number) => String(i + 1).padStart(n >= 100 ? 3 : 2, "0"); @@ -102,3 +104,36 @@ export function Structure({ repo }: { repo: RepoBundle }) {
      ); } + +/** The report's short list: the six largest modules, what each does, and how linked it is. */ +export function MainModules({ repo }: { repo: RepoBundle }) { + const all = mainModules(repo); + const shown = all.slice(0, MODULES_SHORT); + if (shown.length === 0) return null; + return ( +
        + {shown.map((m) => ( +
      1. +
        + + {m.name} + + + {m.loc !== null ? `${fmt(Math.round(m.loc / 1000))}k lines` : ""} + +
        + {m.description && ( +

        + {m.description.source === "ai" && } + {m.description.text} +

        + )} +

        + + +

        +
      2. + ))} +
      + ); +} diff --git a/web/src/routes/overview/TrustStrip.tsx b/web/src/routes/overview/TrustStrip.tsx index 99289ecd..1a57debe 100644 --- a/web/src/routes/overview/TrustStrip.tsx +++ b/web/src/routes/overview/TrustStrip.tsx @@ -3,81 +3,138 @@ import type { ReactNode } from "react"; import { Link } from "react-router"; import { ComputedMark } from "../../components/cx/badges"; import { FOCUS, cn } from "../../components/cx/cn"; +import { SectionHead } from "../../components/cx/primitives"; import { repoPath } from "../../cx/address"; import { fmt } from "../../cx/meta"; import type { RepoBundle } from "../../cx/types"; -/** Cost in US dollars, written as the Trust screen writes it. */ -const usd = (n: number) => `$${n.toFixed(3)}`; +/** The stored re-run tests, in the order a reader can follow them. */ +const TESTS: { test: string; label: string }[] = [ + { test: "identical_rerun", label: "Run again, same input" }, + { test: "fresh_ai_run", label: "Run again with fresh AI text" }, + { test: "commits_removed_5pct", label: "5% of commits left out" }, + { test: "weights_changed_20pct", label: "Ranking weights moved by 20%" }, + { test: "end_date_minus_1_month", label: "Snapshot one month earlier" }, +]; -function Fact({ label, children }: { label: string; children: ReactNode }) { +function Block({ + title, + lead, + children, +}: { + title: string; + lead: ReactNode; + children?: ReactNode; +}) { return ( -
      -
      {label}
      -
      - {children} -
      +
      +

      {title}

      +

      {lead}

      + {children}
      ); } -/** A slim row of stored facts the report rests on, with a link to the Approach tab. */ +/** Robustness and efficiency, the two judging points a reader cannot see in the findings. */ export function TrustStrip({ repo }: { repo: RepoBundle }) { - const rerun = repo.stability.find((s) => s.test === "identical_rerun") ?? null; + const byTest = new Map(repo.stability.map((s) => [s.test, s])); + const tests = TESTS.flatMap((t) => { + const s = byTest.get(t.test); + return s ? [{ ...t, kept: Math.round(s.top10 * 10) }] : []; + }); + const rerun = byTest.get("identical_rerun"); const files = repo.coverage.reduce((s, c) => s + c.files, 0); const unread = repo.coverage.reduce((s, c) => s + c.unread, 0); const calls = repo.usage.reduce((s, u) => s + u.calls, 0); const cost = repo.usage.reduce((s, u) => s + u.cost, 0); const limits = repo.blindSpots.length; - const muted = "text-muted-foreground"; return ( -
      -

      - What this report rests on -

      -
      - {rerun !== null && ( - - top 10: {Math.round(rerun.top10 * 10)} of 10{" "} - unchanged on an identical re-run - - )} - {repo.coverage.length > 0 && ( - - {fmt(files)}{" "} - · {fmt(unread)} with unread parts - - )} - - {repo.usage.length === 0 ? ( - no AI call logged · ranking uses no AI model - ) : ( - <> - - {fmt(calls)} {calls === 1 ? "call" : "calls"} · {usd(cost)} - {" "} - · ranking uses no AI model - +
      + + How it works + + } + /> +
      + + Run twice, the top 10 stays the same:{" "} + {Math.round(rerun.top10 * 10)} of 10. + + ) : ( + "No re-run was stored for this report." + ) + } + > + {tests.length > 1 && ( +
        + {tests.map((t) => ( +
      • + {t.label} + + {Array.from({ length: 10 }, (_, i) => ( + + ))} + + {t.kept} of 10 +
      • + ))} +
      )} - - - {fmt(limits)}{" "} - {limits === 1 ? "limit" : "limits"} stated - -
      - - Approach - +

      + How many of the top 10 findings stay in the top 10 under each change.{" "} + +

      + + Finding, counting and ranking use no AI model. AI only reads and writes text.} + > +
      +
      +
      AI calls for this report
      +
      + {repo.usage.length === 0 ? "none" : fmt(calls)} +
      +
      +
      +
      Total AI cost
      +
      ${cost.toFixed(2)}
      +
      + {repo.coverage.length > 0 && ( +
      +
      Files read
      +
      {fmt(files)}
      +
      {fmt(unread)} with unread parts
      +
      + )} +
      +
      Limits stated openly
      +
      {fmt(limits)}
      +
      +
      +
      +
      ); }