feat: add /process page with tested delivery report model and sample
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import * as React from "react";
|
||||
import { TerminalCard } from "@/src/components/site";
|
||||
import type { ProcessStep } from "./processSteps";
|
||||
|
||||
type ProcessStepCardProps = {
|
||||
readonly step: ProcessStep;
|
||||
readonly index: number;
|
||||
};
|
||||
|
||||
export const ProcessStepCard: React.FC<ProcessStepCardProps> = ({
|
||||
step,
|
||||
index,
|
||||
}) => (
|
||||
<li className="grid gap-6 border-t border-border py-8 md:grid-cols-2 md:gap-10">
|
||||
<div>
|
||||
<p className="!mb-2 font-mono text-xs uppercase tracking-widest text-accent">
|
||||
Step {index + 1}
|
||||
</p>
|
||||
<h3 className="!mb-3 !mt-0 text-xl font-semibold">{step.title}</h3>
|
||||
<p className="!mb-0 text-base leading-relaxed text-muted">{step.rule}</p>
|
||||
</div>
|
||||
<TerminalCard title={step.exampleLabel}>
|
||||
{step.example.map((line) => (
|
||||
<p key={line} className="!mb-0 whitespace-pre">
|
||||
{line}
|
||||
</p>
|
||||
))}
|
||||
</TerminalCard>
|
||||
</li>
|
||||
);
|
||||
@@ -0,0 +1,68 @@
|
||||
export type ProcessStep = {
|
||||
readonly id: string;
|
||||
readonly title: string;
|
||||
readonly rule: string;
|
||||
readonly exampleLabel: string;
|
||||
readonly example: readonly string[];
|
||||
};
|
||||
|
||||
export const PROCESS_STEPS: readonly ProcessStep[] = [
|
||||
{
|
||||
id: "spec",
|
||||
title: "Spec first",
|
||||
rule: "Behavior is written as concrete cases before any code: inputs, outputs, edge cases, error paths. Unclear business rules get one precise question to you, not a guess.",
|
||||
exampleLabel: "Availability parsing: the cases",
|
||||
example: [
|
||||
'"2026-02-30" -> rejected, not a real date',
|
||||
'"2028-02-29" -> accepted, leap day',
|
||||
"168 h per week -> accepted, the boundary",
|
||||
"169 h per week -> rejected",
|
||||
"-1 h per week -> rejected",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "red",
|
||||
title: "Red",
|
||||
rule: "The cases run and fail for the right reason: the behavior is missing, not an import error or a typo. A bug fix starts with a failing test that reproduces the bug.",
|
||||
exampleLabel: "Availability parsing: first run",
|
||||
example: [
|
||||
"FAIL parses a leap day",
|
||||
" expected { ok: true }, received undefined",
|
||||
"9 failing, all because parseAvailability does not exist yet",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "green",
|
||||
title: "Green",
|
||||
rule: "The simplest clean solution that makes the cases pass. Pure functions for the logic, side effects pushed to thin edges. Then refactor while the tests stay green.",
|
||||
exampleLabel: "Availability parsing: second run",
|
||||
example: [
|
||||
"9/9 pass",
|
||||
"date check: month length plus leap-year rule",
|
||||
"hours check: whole number from 0 to 168",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "mutation",
|
||||
title: "Mutation check",
|
||||
rule: "A tool changes the code on purpose and reruns the tests. Every change must make a test fail. A surviving mutant means a weak assertion or dead code, and I fix one or the other.",
|
||||
exampleLabel: "Availability parsing: mutants",
|
||||
example: [
|
||||
"hours <= 168 -> hours < 168",
|
||||
" caught by the 168 h case",
|
||||
"day <= daysInMonth -> day < daysInMonth",
|
||||
" caught by the 2028-02-29 case",
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "report",
|
||||
title: "Delivery report",
|
||||
rule: "Every pull request carries the exact commands and their results: case counts, mutation result, coverage on changed lines, typecheck and lint. You can rerun every line.",
|
||||
exampleLabel: "Availability parsing: the report",
|
||||
example: [
|
||||
"spec 9 -> red 9 -> green 9/9",
|
||||
"mutation 14 caught, 0 survived",
|
||||
"see the full sample below",
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,16 @@
|
||||
import type { DeliveryReport } from "@/src/domain/deliveryReport";
|
||||
|
||||
// Illustrative numbers for the availability parsing example. Not a real project.
|
||||
export const SAMPLE_DELIVERY_REPORT: DeliveryReport = {
|
||||
specCases: 9,
|
||||
redFailing: 9,
|
||||
greenPassing: 9,
|
||||
greenTotal: 9,
|
||||
mutantsTotal: 14,
|
||||
mutantsCaught: 14,
|
||||
mutantsSurvived: 0,
|
||||
changedLinesCovered: 23,
|
||||
changedLinesTotal: 23,
|
||||
typecheckErrors: 0,
|
||||
lintErrors: 0,
|
||||
};
|
||||
Reference in New Issue
Block a user