Repository navigation
refactor(web): own the earliest birth date in the life date parser - #5395
Merged
Merged
Conversation
`parseLifeBirthDateInput` took a `minDate` parameter but compared bare years against a hardcoded 1900 and named 1900 as a literal in both rejection messages, while each call site built the bound itself. #5391 added a second call site, so the rule sat in four parallel copies. With a raised bound the parser accepted years below it and told the user the wrong year, so moving the bound at either entry point would have desynced the year path and the copy from the full-date path silently. Export `LIFE_BIRTH_DATE_MIN` from the parse util, derive the year check and both messages from `options.minDate`, and import the constant at both call sites. Behavior is unchanged: every caller passes 1900 today. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQEPu2wGNzcsXb5TXTd
Biome's organizeImports wants the named import sorted ahead of the new constant. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQEPu2wGNzcsXb5TXTd
tyler-dane
enabled auto-merge
November 30, 2026 11:47
Contributor
|
Boot bundle: 606.1 KB gzip (+0.0 KB vs main) |
Contributor
Author
|
Promotion: deferred, to batch with the next release. Per the release policy in
Generated by Claude Code |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tech-debt sweep for 2026-11-24 to 2026-11-30. No issue; the sweep is scheduled.
What and why
The earliest birth date Life accepts existed as four parallel
1900literals,and
parseLifeBirthDateInputignored its ownminDateparameter.The function takes
minDate, but its year-only branch compared against ahardcoded
1900and both rejection messages named1900as a literal, whileeach call site built the bound itself:
LifeSidebarContent.tsxasnew Date(1900, 0, 1)and, new in #5391,LifeBirthDatePrompt.tsxas a secondcopy of the same expression. The test file held a fifth copy and only ever
passed 1900, so nothing guarded the parameter.
The divergence this prevents. Reproduced before fixing: with
minDate = new Date(1950, 0, 1), the parser accepted a bare"1900"and"1949"as valid year jumps, and rejected"1945-01-01"with"Enter a date in 1900 or later", naming a bound that was not in force. So
raising the bound at either entry point would have left the year path on the
old rule while the full-date path moved, and the copy would have explained the
wrong year to the user: a validator desynced from the message beside it, with
no test failing. #5391 is what made this worth a PR. Before it there was one
caller and the hardcoding read as an unused parameter; with a second entry
point the rule had to be kept in step by hand across four sites.
The fix.
parseLifeBirthDateInput.util.tsbecomes the owning module. Itexports
LIFE_BIRTH_DATE_MIN, the year branch and both messages derive fromoptions.minDate.getFullYear(), and both call sites plus the test import theconstant.
Behavior is identical: every caller passes 1900 today, so every accepted value
and every message is character-for-character what it was. The three new
assertions in the
honours the caller's minDateblock fail against theprevious implementation, so re-hardcoding either side now breaks the build.
Churn guard.
parseLifeBirthDateInput.util.tscarries only #5093 (a fix)in the last 30 days and
LifeBirthDatePrompt.tsxis new in #5391.LifeSidebarContent.tsxcarries #5041, a prior sweep refactor inside 30 days,so it is off limits for a rework; the change there is one line swapping a
literal for the imported constant.
Examined and deliberately left alone (recorded in full in
.agents/skills/tech-debt-sweep/judged-fine.mdso the next sweep does notredo it): the
RANDOM_BIRTH_MIN_AGE/MAX_AGEpair and its* 365span inlife-math.ts(off limits, #5389 was last sweep's own output, and the age-59ceiling is pinned deliberately); the intro prompt's documented year-to-January
convention and its dropped
usesMonthDayOrderdisclosure (a product decision,escalates rather than sweeps);
renderWelcomeEmail's inline-link substitutionin #5394 (the HTML and text branches cannot disagree, since
escapeHtmlis acharacter-wise map; two latent residuals noted); the
headingremoval in #5394(complete, no reader left);
LIFE_PREFERENCES_REQUEST_TIMEOUT_MSin #5392 (twoindependent budgets that coincide at 30s); the
lifeThisWeekEligiblepropchain in #5392 (complete, and it removed a duplicate preferences load); the
Alt+Arrow binding in #5391 (declared once, every consumer derives from it);
the
confirmationSentplumbing in #5394 (insertManyisordered: falseandswallows duplicate keys, so the new read-before-insert opens no race); the
hardcoded sender address in
ReflectionEmailPreview.tsx(the real value isdeploy config, so closing it needs a new endpoint: a fix larger than the
problem); the three paraphrases of the weekly-review description (per-surface
copy, not a shared definition); and #5390 (lock and manifest only).
Verify
VERDICT: PASSChecks run: test:web, type-check, lint, knip, test:a11y, test:e2e (baseline:
no new failures). Selected packages: web.
Neither spec is reachable from this diff (no Life birth-date path, no sidebar
layout change). An earlier run of the same suite classified
narrow-sidebar-layout.spec.tsas PRE-EXISTING, failing onorigin/maintoo.Generated by Claude Code