Skip to content

refactor: delete what was not earning its place - #34

Merged
devRMA merged 6 commits into
fix/legal-accuracyfrom
refactor/structural-cleanup
Nov 20, 2026
Merged

devRMA merged 6 commits into
fix/legal-accuracyfrom
refactor/structural-cleanup

Conversation

@devRMA

@devRMA devRMA commented Sep 14, 2026

Copy link
Copy Markdown
Owner

3 of 6 — stacked. Base: fix/legal-accuracy (#33).

A whole-repo over-engineering audit, applied. +669 / −1286 lines.

The ad surface that interrupted the calculation

PRODUCT.md is explicit that ads never sit between the user and an answer and never interrupt a calculation. Three components did exactly that, and none of them worked:

  • the interstitial opened after two minutes idle and simulated a video with a 15s setTimeout over an AdSense <ins> that plays nothing;
  • the side rail rendered only above 1980px and styled itself with bg-card, a class this project never defined — so it had no background at any width;
  • the adblock notice keyed off a no-cors fetch, which almost never rejects, making its catch branch effectively unreachable.

The idle scheduler that drove the interstitial goes with them: ad-manager.tsx drops from 137 lines to 29. Consent and a single slot below the content remain, and the e2e suite now asserts the ad never precedes the calculator.

One day calculation, not three

calculateWorkStats, creditedMinutes and buildDayBreakdown each recomputed morning + afternoon + night bonus from the same calls, and the organism called two of them with nearly the same arguments. Three copies of the arithmetic that decides how much someone is owed is three places for it to drift.

buildDayBreakdown already returned everything the hook rebuilt, so it becomes the source. The 486 tests that passed before pass after, unchanged — the numbers did not move by a minute.

Atomic design that is actually true

AGENTS.md makes atomic design the law of this repo, and 12 of 30 components broke it — which makes the convention useless as a guide, because a developer looking for the pattern finds the violation first. alert-banner, stat-box, collapsible-panel and google-ad compose nothing and become atoms; currency-input and masked-input compose the Input atom and become molecules; hero-panel and cookie-consent are whole sections with their own state and become organisms; theme-provider was sitting loose at the components root.

In the same pass: form-field, currency-field and duration-field were the same wrapper three times — a div, a label, and whichever input goes in the middle. One Field replaces them, and journey-form stops re-implementing DurationField inline next to the real one.

The coverage bar was buying tests of CSS

A flat 100% branch threshold over the whole tree meant every variant and size prop had to be exercised, and the only way to do that on a presentational atom is to assert its Tailwind class string. That produced ~310 lines of tests that mirror the stylesheet: they break on any design change and fail for no real defect.

The bar now follows the risk — 100% in lib/ and hooks/, where the money and the hours live, 90% in app/ and components/. Role, label and interaction cases stay; the class assertions are gone.

Smaller cuts

isRealTime was isRealDuration; isChronological was the ordering half of findJourneyIssue; the digit helpers were defined in two inputs; the clock placeholder in two organisms; minutesToSeconds had no consumer but its own test. Playwright ran the full suite at five viewports while no spec asserted anything width-specific — three projects remain, and one spec checks 2560 and 3840 for overflow once instead of four times.

Verified

biome check · tsc --noEmit · 463 unit tests · production build · Playwright (43 tests, ~15s) — all clean.

🤖 Generated with Claude Code

@vercel

vercel Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
workload Ready Ready Preview Nov 20, 2026 8:27am UTC

@codecov-commenter

codecov-commenter commented Sep 14, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 98.38710% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
components/organisms/ad-manager.tsx 93.33% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

devRMA and others added 4 commits September 14, 2026 17:18
PRODUCT.md is explicit that ads never sit between the user and an answer
and never interrupt a calculation. Three components did exactly that, and
none of them worked.

The interstitial opened after two minutes of idle and simulated a video
with a 15s setTimeout over an AdSense <ins> that plays nothing. The side
rail rendered only above 1980px and styled itself with bg-card, a class
this project never defined, so it had no background at any width. The
adblock notice keyed off a no-cors fetch, which almost never rejects, so
its catch branch was effectively unreachable.

The idle scheduler that drove the interstitial goes with them: ad-manager
drops from 137 lines to 29. Consent and a single ad slot below the content
remain, and the e2e suite now asserts the ad never precedes the calculator.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Morning + afternoon + night bonus was computed three times — twice in the
work-calculator hook and once in buildDayBreakdown — from the same calls,
and the organism called two of them with nearly the same arguments. Three
copies of the arithmetic that decides how much someone is owed is three
places for it to drift.

buildDayBreakdown already returned everything the hook rebuilt, so it
becomes the source and the hook derives from it. The suite that passed
before passes after, unchanged: the numbers did not move by a minute.

Alongside it, the smaller duplicates: isRealTime was isRealDuration,
isChronological was the ordering half of findJourneyIssue, the digit
helpers were defined in two inputs, and the clock placeholder in two
organisms. minutesToSeconds had no consumer but its own test.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
AGENTS.md makes atomic design the law of this repo, and twelve of thirty
components broke it — which makes the convention useless as a guide,
because a developer looking for the pattern finds the violation first.

alert-banner, stat-box, collapsible-panel and google-ad compose no other
component and become atoms. currency-input and masked-input compose the
Input atom and become molecules. hero-panel and cookie-consent are whole
sections with their own state and become organisms. theme-provider was
sitting loose at the components root.

In the same pass, form-field, currency-field and duration-field were the
same wrapper three times — a div, a label and whichever input goes in the
middle. One Field molecule replaces them, and journey-form stops
re-implementing DurationField inline next to the real one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
A flat 100% branch threshold over the whole tree meant every variant and
size prop had to be exercised, and the only way to do that on a presentational
atom is to assert its Tailwind class string. That produced tests that mirror
the stylesheet: they break on any design change and fail for no real defect.

The bar now follows the risk. lib/ and hooks/ hold the money and the hours
and stay at 100%; app/ and components/ sit at 90%. The class-assertion cases
are gone, the role, label and interaction cases stay.

Playwright ran the entire suite at five viewports while no spec asserted
anything width-specific. Three projects remain, and one wide-viewport spec
checks 2560 and 3840 for overflow once instead of four times.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
devRMA and others added 2 commits November 20, 2026 05:21
Co-Authored-By: GPT-6.2-sol <noreply@openai.com>
Co-Authored-By: GPT-6.2-sol <noreply@openai.com>
@devRMA devRMA self-assigned this Nov 20, 2026
@devRMA
devRMA merged commit 00cc57e into main Nov 20, 2026
4 of 6 checks passed
@devRMA
devRMA deleted the refactor/structural-cleanup branch November 20, 2026 20:29
devRMA added a commit that referenced this pull request Nov 20, 2026
Co-Authored-By: GPT-6.2-sol <noreply@openai.com>

This branch was successfully deployed

1 active deployment
Preview — b2d46634 Deployed Nov 20, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants