Repository navigation
refactor(core): derive the average life variation from the shared lifespan - #5389
Merged
Merged
Conversation
…espan `DEFAULT_LIFESPAN` is the owning constant for the 79-year default, but `LIFE_VARIATIONS.average` re-stated it as a literal while its sibling `random` referenced `RANDOM_LIFESPAN_MAX`. The two defaults in `life-preferences.storage.ts` read from opposite sides of that split: the Zod schema default from the constant, `DEFAULT_LIFE_PREFERENCES` from the variation table. Raising the constant would have moved the schema default, the reflection email's "N-year average" caption and the life grid's rows while leaving the stored default and the sidebar's "Average" button on 79. Point the entry at the constant and pin the invariant so re-hardcoding either side fails. Behavior is identical: the constant is 79 today. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HmwVQJ4Kv3sdBWkEtkbkBG
tyler-dane
enabled auto-merge
November 29, 2026 11:21
Contributor
|
Boot bundle: 605.4 KB gzip (+0.0 KB vs main) |
This was referenced Nov 29, 2026
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.
No issue: scheduled tech-debt sweep. This is the finding the 2026-11-28 sweep
recorded as "deferred by budget, still a real finding" and handed to this one.
What and why
DEFAULT_LIFESPAN = 79inpackages/core/src/life/life-math.tsis the owningdefinition of the default lifespan, but
LIFE_VARIATIONS.averagere-stated itas the literal
79while its siblingrandomentry correctly referencedRANDOM_LIFESPAN_MAX. The two defaults inapps/calendar-web/src/views/Life/life-preferences.storage.tsthen read fromopposite sides of that split: line 22 defaults the Zod schema from
DEFAULT_LIFESPAN, line 34 defaultsDEFAULT_LIFE_PREFERENCES.lifespanfromLIFE_VARIATIONS.average.defaultLifespan. Raising the shared constant wouldhave moved the schema default, the reflection email's "N-year average" caption
(
reflection-life-progress.ts:14) and the life grid's row count(
reflection-life-image.ts:46) while leaving the stored default and thesidebar's "Average" button (
LifeView.tsx:236,life-search.ts:60) on 79, sothe grid would desync from its own caption silently. That is the same shape as
the
WEEKS_PER_ROWfinding in #5187. Nothing guarded the pair.This points the entry at the constant and pins the invariant in
life.utils.test.ts, includingclampLifespan's ownDEFAULT_LIFESPANfallback, so re-hardcoding either side now fails a test. Behavior is
identical: the constant is 79 today, so every call site resolves to the same
number it did before.
long: { defaultLifespan: 100 }is deliberately left as a literal even thoughit equals
RANDOM_LIFESPAN_MAX: the longest lifespan a user may pick and theceiling the random roll draws from are two product decisions that happen to
share a number today, and binding them would couple them.
The sweep's ledger entry in
.agents/skills/tech-debt-sweep/judged-fine.mdrecords what else was examined and deliberately left alone (the
PAYINGset in#5383's new billing-confirmation module, the five-PR life week sidebar cluster,
and
formatLifeWeekRange.ts), so the next sweep does not redo it.Verify
VERDICT: FAILChecks run: test:web, type-check, lint, knip, test:e2e, test:a11y (baseline: no
new failures).
bun knip,bun lintandbun type-checkall pass.The verdict is
FAILon one failure that verify's baseline block did notclassify, and it is pre-existing and environmental, not caused by this diff:
PRE-EXISTING (1):
configureHttpServer > does not reject a request that exceeds maxHeadersCount(packages/core/src/server/http-server.test.ts:199), expectedHTTP/1.1 200 OK, receivedHTTP/1.1 431 Request Header Fields Too LargeReproduced on unmodified
origin/main(1a7ab75) in a clean detachedworktree: same test, same assertion, same 431. This runner has bun 1.4.4 while
the repo pins
bun@1.3.14(bun testprints the mismatch warning), and 1.4.xenforces header limits differently. The rest of
test:coreis green: 1093 pass,1 fail across 1094 tests. Nothing in this diff touches
packages/core/src/server.FLAKY, passed on rerun (2):
The changed test file passes on its own:
bun test apps/calendar-web/src/views/Life/life.utils.test.ts, 10 pass, 0 fail.Generated by Claude Code