Skip to content

test: make achievement count fixture independent of the clock - #695

Merged
thomasluizon merged 1 commit into
mainfrom
fix/ticket-1156-clock-free-achievement-test
Oct 3, 2026
Merged

thomasluizon merged 1 commit into
mainfrom
fix/ticket-1156-clock-free-achievement-test

Conversation

@thomasluizon

Copy link
Copy Markdown
Owner

The achievement count test used a wall-clock creation timestamp for its old log, so its zero early-log assertion failed when the suite ran before 7 AM UTC. Set that timestamp to noon UTC on the fixed log date in tests/Orbit.Application.Tests/Gamification/AchievementProgressServiceTests.cs.

This carries commit a74c1aa52e2cc0fc151dd0c1d30fb5a38e4f2fd9 from orbit-api#694 with git cherry-pick -x, committed here as cb3250714bc0d4237d05319bb70e875d3e111875. It uses the same timestamp fixture pattern as the adjacent streak helper. Product code and assertions are unchanged. The #746 sync can skip this commit once redesign/main carries the same change; #1156 needs no ordering gate.

Test evidence

  • Regression: AchievementProgressServiceTests.LoadAsync_WithHabits_MapsEveryCountToItsMetric. The continuation work order records that the previous worker ran the unchanged test before the fix, observed it fail before 7 AM UTC with "Expected metrics.EarlyLogs to be 0, but found 1", then observed 42 focused tests pass after the fix. The exact historical command and red log were not retained for this continuation, so this is the prior worker's reported evidence. The retained green log confirms 42 passed, zero failed. No strengthened assertion was needed: the existing assertion already catches the clock-dependent fixture defect.
  • env -u LANG dotnet build Orbit.slnx: exit 0, zero errors.
  • env -u LANG dotnet test: exit 0, 7,116 passed, zero failed or skipped.
  • env LC_ALL=en_US.UTF-8 dotnet build Orbit.slnx: exit 0, zero errors.
  • env LC_ALL=en_US.UTF-8 dotnet test: exit 0, 7,116 passed, zero failed or skipped.
  • Each full run covered 645 domain, 3,810 application, 2,629 infrastructure, and 32 analyzer tests. Builds report existing dependency and obsolete API warnings.
  • git diff HEAD^ HEAD --check passes; the two added lines contain no comments. No DTO, minimum-version, user-date, background-job, or external-interface changes.

Closes thomasluizon/orbit-tickets#1156

@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 Reviewed the complete fixture change and traced the achievement timestamp scan and existing assertions.

  • Deterministic timestamp: Sets the old log's CreatedAtUtc to noon UTC on its fixed date, matching the adjacent helper and removing execution-hour dependence without weakening assertions or changing production code.
  • Validation: All 42 AchievementProgressServiceTests passed with dotnet test tests/Orbit.Application.Tests --filter "FullyQualifiedName~AchievementProgressServiceTests" -m:1. The full solution suite was not rerun during this review.

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

@sonarqubecloud

sonarqubecloud Bot commented Oct 3, 2026

Copy link
Copy Markdown

@thomasluizon
thomasluizon merged commit b8abb76 into main Oct 3, 2026
26 checks passed
@thomasluizon
thomasluizon deleted the fix/ticket-1156-clock-free-achievement-test branch October 3, 2026 07:08
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