Repository navigation
Description
Owner: Viraj · Priority: P1 · Blocked by: #1, #27
Parallel work: Needs MatrixCanvas from #27 (imports it, does not edit it). Parallel with #28-#31 and #33.
1. Goal
The sponsor's bonus question, "better or worse after AI?", answered on one stable picture (spec §10.2 screen 5, §12): the same grid at two dates with a switch, every structural change labelled with its evidence, and each decision's conformance over time.
2. Scope & File Boundaries
Create or edit
web/src/screens/BeforeAfter.tsx(replace the stub)- New folder
web/src/screens/beforeafter/:Switch.tsx,Changes.tsx,DecisionSeries.tsx,compare.ts,beforeafter.css,beforeafter.test.ts
Do not touch
- Anything not listed above. In particular:
web/src/App.tsx,web/src/screens.ts,web/src/data/**,web/src/contracts/**,web/public/bundles/**,web/package.json,web/package-lock.json, and every other screen's files. - No new npm packages: everything needed is already installed (
d3-hierarchy,d3-scale,d3-scale-chromatic,cytoscape,elkjs,shiki). - Nothing outside
web/. - If something outside your files has to change, comment on this issue instead of editing it.
3. Contracts / Inputs & Outputs
Read first: AGENTS.md, spec.md §12.3 and §12.4, web/src/screens/BeforeAfter.tsx, web/src/screens/grid/MatrixCanvas.tsx (props only), web/public/bundles/fixture-wide/before_after.json.
bundle.beforeAfter: BeforeAfterFile
interface BeforeAfterFile {
before: { date: string; sha: string; role: string };
after: { date: string; sha: string; role: string };
adoption_date: string | null; // the repo's own detected adoption date
module_order: string[]; // ONE order for both dates: switching must not move anything
cells: { src: string; dst: string; before: number; after: number }[];
changes: { id: string; title: string;
kind: "restructuring" | "link_added" | "link_removed" | "module_added" | "module_removed";
label: "planned" | "no_stated_intent";
basis: "same_code_old_layout" | "restructuring_commit" | "decision_document" | "pr_goal" | null;
source: "ai" | "computed"; evidence: Evidence[] }[];
yardsticks: { name: string; series: { snapshot_date: string; value: number }[] }[];
}
bundle.decisions.checks // DecisionCheck[] per decision per snapshot: the conformance series// compare.ts: pure, unit-tested
export function cellsAt(file: BeforeAfterFile, which: "before" | "after"): MatrixCell[]; // zero-count cells dropped
export function changedCells(file: BeforeAfterFile): Map<string, { before: number; after: number }>;The side shown is useView().snapshot (the before or the after date; default after).
Rules for every screen (from AGENTS.md and .impeccable/surfaces/prototype-codexray-demo.md):
- Colours and fonts come from
web/src/styles/tokens.css. Vermilion (--against-decision) marks code that goes against a decision and is used for nothing else: not buttons, not links, not selection. - Every AI-written sentence carries the "AI" badge; everything else is "Computed". The app never calls a model and loads static files only.
- Cross-screen state lives in the address bar through
useView/useSetView/viewLinkfromweb/src/data/view.ts, so every view has a permanent link. - Scores use cividis (
interpolateCividisfromd3-scale-chromatic); categories use the Okabe-Ito tokens. It must read on a projector.
4. Implementation Steps
compare.tswith tests.Switch: two buttons with the two dates; it callssetView({ snapshot }). Only colours change; the layout stays (spec §10.4).- Draw
MatrixCanvaswithorder = module_order,cells = cellsAt(...),changed = changedCells(...). Changes: the list of changes. Labels in words: "Planned" with its basis ("same code under the old layout", "restructuring commit", "decision document", "stated goal of the pull request") or "No stated intent". The word "unplanned" never appears. A change withsource: "ai"carries the AI badge. Evidence rows link to the code pane.DecisionSeries: per decision, conformance at each snapshot date as a small line, with two vertical markers: 2025-03-01 andadoption_datewhen present. Then the yardstick series the same way.- One sentence under the heading: the panel describes what changed and does not show cause. Do not write "AI caused" or "x% AI-written" anywhere (spec §12.4).
5. Acceptance Criteria & Verification
#/fixture-wide/before-after: switching between the two dates changes cell colours and the change markers while every module label stays where it was; the address bar holdssnapshot=<date>and survives a reload.- Each change shows "Planned" with a basis or "No stated intent";
grep -ri "unplanned\|AI caused\|AI-written" web/src/screens/beforeafter web/src/screens/BeforeAfter.tsxfinds nothing. - Both the 2025-03-01 marker and the adoption-date marker are drawn when
adoption_dateis set. beforeafter.test.tscoverscellsAtandchangedCells.cd web && npm run typecheck && npm test && npm run buildpasses.
Branch: viraj/32-web-before-and-after-the. Open a pull request whose description says Closes #32. The specification is spec.md; the working rules are in AGENTS.md and CONTRIBUTING.md.
Activity
Pranav-Mathad commentedon Nov 28, 2026
PR #68 (closes #10) fills
before_after.jsonwith real data, so the screen now gets:changes: 134 entries on Artemis (87 Shopware, 65 Graylog), each with a label, a basis and evidence. Evidence is commits, or lines that open in the code pane.module_orderandcellsfor every module at either date (89 on Artemis: 73 at END plus 16 that exist only at 2025-03-01). Modules that exist only at the earlier date are not nodes inmap.json.Three things noticed in the web app while checking the screen, left for you since they are in
web/:web/src/screens/BeforeAfter.tsxline 32 labels a module that is not inmap.jsonwith its full id minusM:, so the 16 earlier-only modules show their whole path on the axis instead of a short name.Finding.origin.noteis never shown. Inweb/src/screens/decisions/FixFirst.tsxa 0 AI share reads "no AI signal" and a 0 share reads "0% of lines"; for a run without line origin, or a finding with no line evidence, the note is what says it was not measured.FixFirst.tsx) and "After 1 Mar 2025" (StatsTable.tsx) are literal text; the date is in the bundle (before_after.before.date).To try it:
codexray report --repo artemis, thenmake bundle REPO=artemis.