Skip to content

fix: align POST day keys with user timezone - #4277

Merged
atomantic merged 3 commits into
mainfrom
claim/issue-4211
Aug 15, 2026
Merged

fix: align POST day keys with user timezone#4277
atomantic merged 3 commits into
mainfrom
claim/issue-4211

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

  • Normalize legacy full-ISO POST dates with the user’s configured timezone while preserving bare YYYY-MM-DD labels.
  • Thread timezone-aware day keys through POST streaks, stats, progress, recommendations, ladder windows, training stats, activity streaks, and Character metrics.
  • Anchor reader day calculations to the request-start instant so a settings read cannot cross midnight and split one response across two local days.
  • Add LA/Tokyo legacy-date and midnight-boundary regressions.

Test plan

  • npx vitest run --configLoader runner --bail=1 --silent=passed-only lib/postStreak.test.js services/characterMetrics.test.js services/meatspacePost.test.js services/meatspacePostTraining.test.js services/meatspacePostProgress.test.js services/meatspacePostRecommendations.test.js — 265 passed.
  • npx vitest run --configLoader runner --bail=1 --silent=passed-only services/meatspacePostRecommendations.test.js services/meatspacePostMemory.test.js services/meatspacePostMorse.test.js services/characterSignals.test.js services/characterSkills.test.js services/meatspaceLoggingStats.test.js lib/activeDays.test.js — 232 passed.
  • The broader server suite remains environment-blocked by unavailable PostgreSQL in unrelated Writers Room/pipeline suites.

Closes #4211

postStreak.js now imports activeDays.js (for toUserDayKey), which imports
timezone.js, which imports services/settings.js. settings.js reads
PATHS.data at module scope, so any test mocking lib/fileUtils.js without
PATHS.data throws on load. Both suites reach this chain transitively via
lib/validation.js -> subscriptionSavings.js -> postStreak.js.
@atomantic
atomantic merged commit bfa4f02 into main Aug 15, 2026
7 checks passed
@atomantic
atomantic deleted the claim/issue-4211 branch August 15, 2026 14:41
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.

Align postStreak.js day keys to the user-local boundary so POST Streak and Days Active can't contradict each other

1 participant