Skip to content

Fix goal sync dates and deadline reminder counts - #747

Merged
thomasluizon merged 3 commits into
mainfrom
thomasluizon/ticket-1515-streak-real-dates
Oct 18, 2026
Merged

thomasluizon merged 3 commits into
mainfrom
thomasluizon/ticket-1515-streak-real-dates

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

Fixes thomasluizon/orbit-tickets#1515

A streak synced at 23:30 in UTC-3 can now sync and complete on the next local day. A first catch-up reminder for a goal due tomorrow now says "due tomorrow" instead of "due in 7 days".

Approach

  • GoalStreakSyncService.cs converts StreakSyncedAtUtc into the owner's timezone before comparing calendar dates. GoalCompletionService.cs resolves that timezone once per passive batch through IUserDateService.GetUserTimeZoneAsync, implemented in UserDateService.cs using the existing cached preferences and timezone fallback.
  • GoalDeadlineNotificationService.cs formats push and in-app bodies with the actual days remaining. Milestone values still identify dedupe keys, and the existing return after one notification preserves the per-goal, per-tick limit.
  • GoalStreakSyncServiceTests.cs covers both sides of local midnight in UTC-3 and UTC+14. GoalCompletionServiceTests.cs exercises persisted completion and its reward call through the real date service. GoalDeadlineNotificationServiceTests.cs checks one, two and five days remaining, the persisted body and the milestone key. StreakGoalSyncServiceTests.cs supplies the new timezone method in its existing UTC fixture.

The build regenerated the OpenAPI documents without changing their contents.

Assumptions

  • Expose the resolved timezone through the existing IUserDateService dependency rather than add a user repository dependency to goal completion; this reuses the current preference cache and timezone fallback.

Test evidence

Existing tests were run unchanged with both defects present:

dotnet test tests/Orbit.Application.Tests --filter 'FullyQualifiedName~GoalStreakSyncServiceTests'
dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~GoalDeadlineNotificationServiceTests|FullyQualifiedName~GoalCompletionServiceTests'

Both exited 0: 18 and 48 tests passed respectively. This included NeedsPassiveSync_SyncedBeforeUserToday_ReturnsTrue and the unchanged CheckAndSendDeadlineNotifications_MissedSevenDayTick_StillSendsHighestCrossedMilestone; their existing assertions did not catch these defects.

Before fixing each implementation:

dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~SyncDerivedGoals_PassiveSyncAfterLateSaoPauloSync'
dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~CheckAndSendDeadlineNotifications_MissedSevenDayTick'

The new SyncDerivedGoals_PassiveSyncAfterLateSaoPauloSync_CompletesNextLocalDay exited 1: the expected completion update was absent after a sync at 02:30 UTC, which was 23:30 on the previous local day. The strengthened existing deadline test exited 1 with all three cases failing: each captured "due in 7 days", including the goal due tomorrow.

After the fixes:

dotnet test tests/Orbit.Application.Tests --no-build --filter 'FullyQualifiedName~GoalStreakSyncServiceTests'
dotnet test tests/Orbit.Infrastructure.Tests --no-build --filter 'FullyQualifiedName~GoalCompletionServiceTests|FullyQualifiedName~UserDateServiceTests'
dotnet test tests/Orbit.Infrastructure.Tests --no-build --filter 'FullyQualifiedName~GoalDeadlineNotificationServiceTests'

All exited 0: 22, 22 and 38 tests passed. These runs include both previously failing regressions.

The first broader infrastructure run exposed an unconfigured timezone method in the existing scheduler test double. After supplying UTC for its users without timezone settings, this focused run exited 0 with 10 tests passed:

dotnet test tests/Orbit.Infrastructure.Tests --filter 'FullyQualifiedName~StreakGoalSyncServiceTests'

Final validation:

dotnet build Orbit.slnx
dotnet test tests/Orbit.Domain.Tests --no-build
dotnet test tests/Orbit.Application.Tests --no-build
dotnet test tests/Orbit.Infrastructure.Tests --no-build
dotnet test tests/Orbit.Analyzers.Tests --no-build

Build exited 0 with zero errors and existing warnings. All test projects exited 0: Domain 671, Application 5,489, Infrastructure 3,360 and Analyzers 32; 9,552 passed, none failed or skipped. Commit hooks passed, and changed files contain no bare narration comments.

@sonarqubecloud

Copy link
Copy Markdown

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes Across all nine changed files, reviewed local-date streak synchronization, deadline reminder wording, and the affected callers and tests.

  • Local sync dates: Passive reconciliation converts the saved UTC sync timestamp into the owner's timezone, resolved once per batch through the existing date preferences cache and fallback.
  • Deadline reminders: Push and persisted notification bodies show actual days remaining while retaining milestone dedupe keys and the existing per-tick limit.
  • Regression coverage: Tests cover UTC-3 and UTC+14 day boundaries, persisted completion and its reward call, catch-up reminder bodies, and the scheduler fixture update. All 92 focused tests passed; the full solution suite was not rerun during this review.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@thomasluizon
thomasluizon merged commit 0e63842 into main Oct 18, 2026
25 checks passed
@thomasluizon
thomasluizon deleted the thomasluizon/ticket-1515-streak-real-dates branch October 18, 2026 10:25
thomasluizon added a commit that referenced this pull request Oct 18, 2026
* fix: pin analyzer test Pkcs dependency to patched version (#728)

(cherry picked from commit 61b0090)

* fix: shard pull request domain mutation testing (#729)

(cherry picked from commit bcfd81e)

* Promote the API redesign with production compatibility checks (#723)

* Bring the API redesign tree onto main for #1413

* Preserve calendar connection detection for shipped clients

* Prove API and migrated schema compatibility with shipped clients

* Trim whitespace in the archived main schema proof

* Require the production health response to report the released commit

* Bind initial approval previews to stored pending operations

* fix: return the bulk skip refresh outcome and split the undo skip query

SonarCloud failed the quality gate on two reliability findings in code this pull request brings to main:
the bulk skip conflict check read a flag only a lambda wrote (S2583), and the undo skip check loaded
Tags and Goals in one query (S8733). The transaction now returns whether every habit refreshed, and the
undo skip check splits its query. A new case covers the concurrent change conflict; it failed with the
refresh outcome forced to true and passes with the fix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 5526c9b)

* Add per-account feature flag targeting and admin controls (#724)

* feat: resolve feature flags per account

* feat: administer account feature flags through MCP and REST

* test: exclude feature flag targets from rate limit fixture

* fix: reconcile account flag tests and migration metadata with redesign

(cherry picked from commit 1b886bd)

* Add header API versioning for v1 and v2 (#733)

* Add header API versioning with v1 compatibility

* Verify versioned OpenAPI and browser header compatibility

* Preserve skip undo path contract with optional version header

(cherry picked from commit ac8b34a)

* fix: expose the config response in OpenAPI (#734)

(cherry picked from commit a9d8dd5)

* Route production redesign accounts through Cloudflare (#735)

* Add cookie-based routing for the production redesign web service

* Document web routing rollout, permissions, and rollback checks

* Fix web routing coverage and disable infra install scripts

* chore: regenerate the v2 OpenAPI document on main

orbit-api#733 added openapi_v2.json and orbit-api#734 typed the /api/config
response in parallel, so main carries a v2 document without the typed config
schema and the Build check's stale-document step fails on every merge with
main. dotnet build src/Orbit.Api regenerates it; openapi.json is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9c64770)

* Fix habit edit gating, end dates, and reminder updates (#736)

* fix: validate habit updates with the resulting time range

* fix: preserve end dates when creating root habits

* fix: gate slip alert activation and preserve unchanged reminders

* fix: compare effective reminder rules across stored formats

(cherry picked from commit 7472203)

* Reduce mutation and guard CI jobs (#737)

* Select mutation shards from changed projects

* Consolidate guards and filter artifact generation

* Skip project documentation in mutation selection

* Validate mutation base refs and restrict Git PATH

* Read mutation shard changes from standard input

(cherry picked from commit b802f9e)

* test: strengthen habit and goal ownership coverage (#739)

(cherry picked from commit 0e32628)

* test: verify checkout session user metadata (#740)

(cherry picked from commit da2f53a)

* fix: protect OAuth code delivery with Turnstile (#741)

(cherry picked from commit 1149606)

* fix: enforce chat interaction scope before loading context (#743)

(cherry picked from commit 98faf4e)

* fix: erase accountability pairs during account deletion and reset (#745)

* fix: erase accountability pairs during account deletion and reset

* test: preserve migration compatibility checks after accountability cleanup

(cherry picked from commit a9e5fb9)

* Fix goal sync dates and deadline reminder counts (#747)

* fix: compare streak sync dates in the user timezone

* fix: show actual days remaining in goal deadline reminders

* test: configure timezone for streak scheduler fixtures

(cherry picked from commit 0e63842)

* Manage staging landing routing in Terraform (#742)

(cherry picked from commit abdd738)

* Restrict Web Push endpoints to supported push services (#1503) (#751)

Web Push subscriptions accept only HTTPS endpoints on the FCM, Mozilla, Apple and WNS push hosts, and the push HTTP client follows no redirects. Replaces orbit-api#748 as one commit so no commit carries the high-entropy sample fixture.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit d9f847a)

* Erase account uploads before permanent deletion (#1507) (#750)

* fix: erase uploaded objects before completing account deletion

* fix: refuse upload reads after permanent account deletion

* fix: grant uploads bucket deletion permissions and verify provider wiring

* test: align storage startup checks with erasure requirements

* fix: retire deleted Supabase upload storage

* test: configure upload erasure providers in deletion fixtures

Share the existing object-store fake across account deletion and scheduler fixtures after merging main. Preserve accountability assertions and production provider requirements for thomasluizon/orbit-tickets#1507.

(cherry picked from commit fa33a94)

* fix: limit anonymous auth and waitlist by email and source IP (ORB-108) (#749)

* fix: enforce source IP ceilings alongside anonymous email limits

* test: cover both rate limit dimensions before bot verification

* fix: isolate BFF email rate limits by verified client IP

* fix: generate and persist BFF forwarding secrets

(cherry picked from commit de0f42f)

* Limit access tokens to fifteen minutes (#738)

* fix(auth): limit access tokens to fifteen minutes

* fix(auth): align managed JWT lifetime and prove logout rejection

(cherry picked from commit ade7016)

* fix(auth): equalize account provisioning work (ORB-96) (#744)

* test(auth): expose registration dependent sign-in work

* fix(auth): perform uniform registration work before sign-in responses

* test(auth): cover expired codes and tracked upsert conflicts

* fix(auth): isolate signup retries and restore provisioning guards

* fix(auth): recover signup work after dispatch failures

* fix(auth): roll back failed signup referrals before retry

(cherry picked from commit 1bd0d26)

* fix: expose redesign controllers in both API versions

Apply the carried version declarations to the Notion and proactive controllers and regenerate the v2 contract. Refs thomasluizon/orbit-tickets#746.

* fix: honor account flags in proactive engine

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant