CogniPrep's landing page has four interactive demos instead of a video. One of them walks you through a feedback report: pick a practice session, watch a progress bar, read the report. It is 616 lines of client component with hand-written mock data, and no part of it talks to the real product.
That is a reasonable thing to build. A demo backed by live code means signing in, and the whole point is to show somebody what they get before they do. But a mock has no type checking against reality and nothing that reads it twice, and this one has been quietly drifting.
The data: two objects that look like one
Three fictional sessions:
const mockSessions = [
{ gameName: 'Balloon', score: 72, percentile: 80, category: 'above-average', date: 'Dec 15, 2024' },
{ gameName: 'Arrows', score: 85, percentile: 95, category: 'excellent', date: 'Dec 14, 2024' },
{ gameName: 'Memory', score: 52, percentile: 61, category: 'average', date: 'Dec 13, 2024' },
];
And three reports, keyed on the display name:
const mockReports: Record<string, any> = {
Balloon: { overallScore: 80, strengths: [...], weaknesses: [...], insights: [...] },
...
};
Two things are already visible. The key is a human-readable game name, so renaming the label in the picker silently breaks the lookup. And the value is any, so nothing checks that a report has the fields the renderer reads. In a repository with zero @ts-ignore and zero @ts-expect-error, this is one of the places the types were simply opted out of.
Four fields, one claim
Now follow a single card. The reader picks Balloon, and the report screen renders a percentile.
The big number comes from the report object:
{mockReports[selectedSession.gameName].overallScore}
That is 80.
The colour of the big number comes from the same 80, through a four-step scale where 80 is the first emerald step:
const getScoreColor = (score: number) => {
if (score >= 80) return 'text-emerald-600 dark:text-emerald-400';
if (score >= 60) return 'text-blue-600 dark:text-blue-400';
...
};
The bar underneath takes its width from the report's 80 and its colour from the session's score, which is 72:
animate={{ width: `${mockReports[selectedSession.gameName].overallScore}%` }}
selectedSession.score >= 80
? 'bg-gradient-to-r from-emerald-500 to-teal-500'
: selectedSession.score >= 60
? 'bg-gradient-to-r from-blue-500 to-cyan-500'
: 'bg-gradient-to-r from-amber-500 to-orange-500'
So the number is green and the bar below it is blue, in the same card, because two different fields were passed to two thresholds that happen to share their boundaries.
The word beside it comes from a third field entirely:
{selectedSession.category === 'excellent' ? 'Excellent'
: selectedSession.category === 'above-average' ? 'Good' : 'Average'}
And the sentence below it names a fourth number, in prose:
Your performance places you in the 72nd percentile - better than 72% of test-takers
The card's headline says 80th percentile. Its own first insight says 72nd. All three cards do this:
| Session | Headline percentile | Prose percentile | score |
|---|---|---|---|
| Balloon | 80 | 72 | 72 |
| Arrows | 95 | 85 | 85 |
| Memory | 61 | 58 | 52 |
Two of the prose numbers are the score field wearing the word "percentile". The third, 58, matches nothing in the data at all.
Nothing crashes. Nobody files a bug, because a visitor reading a demo has no reason to cross-check two numbers in the same box. But the one thing this component exists to do is make a reader believe the report is coherent, and the first bullet contradicts the headline above it.
The ordinal suffix that cannot fire
The headline needs an ordinal, so it has one:
{overallScore === 1 ? 'st'
: overallScore === 2 ? 'nd'
: overallScore === 3 ? 'rd'
: 'th'}{' '}
percentile
Four branches. The data is 80, 95 and 61, so three of them are unreachable, and the only reachable one is the default. The logic is right and it is dead.
Meanwhile the picker screen, 200 lines earlier in the same file, renders the same kind of number with no branch at all:
{session.percentile}
<span className="...">th</span>
Hardcoded th. Both renderings of the same concept are in one file: one has handled the edge case and will never meet it, the other will meet it and has not handled it. For a percentile, 1th is not hypothetical, it is just unlikely in mock data somebody chose.
The picker has a smaller sibling problem. Its badge prints the category enum verbatim, so it reads above-average, hyphen and all, while the report screen maps the same value to Good. One field, two presentations, and the raw one is the one on screen first.
Dec 2024
The three dates are Dec 15, 2024, Dec 14, 2024 and Dec 13, 2024. The site is well into 2026. A demo whose sample data is two years old is not a bug and nobody will complain, but it is the clearest possible signal of how long nothing has read this file, and it is right next to the thing the page is selling.
The 72 KB nobody asked for
All four demos are loaded through dynamic():
const FeedbackReportDemo = dynamic(() =>
import('@/components/landing/FeedbackReportDemo').then((mod) => ({ default: mod.FeedbackReportDemo }))
);
I wanted to know whether that kept them out of the first load. It does not. The home page's HTML references nine chunks, and one of them is 72,427 bytes carrying the mock data verbatim, pulled in as a plain <script async> on arrival. Code splitting moved the demo into its own file; it did not stop the file being fetched. If the goal were a lighter first load, the split would need to be gated on something, such as the useInView hook this component already uses to decide when to start animating.
What this is really about
None of the above is hard to fix, and that is the point. Record<string, any> keyed on a display string, four fields describing one claim, and a mock nobody has read since 2024 are not failures of care at the time. They are what happens when a file is deliberately outside every mechanism that would otherwise read it: no types, no tests, no server, no data.
The cheapest fix is not a refactor, it is a type. One MockReport interface with a percentile field, one object per session instead of two, and the prose built from the same number rather than typed beside it. Everything above collapses into "there is one number".
See it
This is all on the public home page, and you need no account.
Open cogniprep.app and scroll to the feedback report demo. On the picker, the first card shows a Score of 72 out of 100 and a Percentile of 80th, with a badge reading above-average in raw enum form and a date in December 2024.
Click through to generate the report. The headline reads 80th percentile in green. The bar directly beneath it is blue. The label beside it says "Good". And the first bullet under the heading says you are in the 72nd percentile, better than 72% of test-takers.
Then try the third session. Headline 61st, prose 58th, picker score 52, bar amber.
If you want the data without the UI, open DevTools, find the largest script chunk the home page loads, and search it for Dec 15, 2024. Every number quoted above is in there, minified but intact.
Top comments (0)