Skip to content

fix(steam): persist ReleaseDate from SteamReleaseDate on import (#156) - #160

Open
mforce wants to merge 2 commits into
mainfrom
156-steam-release-date
Open

fix(steam): persist ReleaseDate from SteamReleaseDate on import (#156)#160
mforce wants to merge 2 commits into
mainfrom
156-steam-release-date

Conversation

@mforce

@mforce mforce commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Closes #156

What

SteamStoreImportService.NewImportedGame derived only the release Year from Steam's meta.Release.SteamReleaseDate; the full nullable Game.ReleaseDate field (added in #88) stayed null until manual edit or a provider backfill. This lands the UTC calendar date on ReleaseDate.

Fix

ReleaseDate = ToDateOnly(meta?.Release?.SteamReleaseDate ?? 0),

Reuses the existing ToDateOnly(long) helper (already used for LastPlayedOn). Game.ReleaseDate is DateOnly?; ToDateOnly yields DateOnly? and degrades to null when Steam omits the date (unix 0 / invalid).

Note: the issue's suggested line FromUnixTimeSecondsOrNull(...)?.UtcDateTime.Date was not used — it yields DateTime, which has no implicit conversion to DateOnly? and would not compile. ToDateOnly is the correct, existing mirror.

Test

Import_CapturesRichMetadataFromStoreBrowse now asserts ReleaseDate == new DateOnly(2021, 1, 1) from SteamReleaseDate = 1609459200.

  • Red before the fix: Assert.Equal() Failure — Expected 1/1/2021, Actual: null (exact Steam import: persist ReleaseDate from SteamReleaseDate #156 symptom).
  • Green after the fix.
  • Metadata-unavailable path (Import_ProceedsWhenStoreBrowseMetadataUnavailable) stays green → ReleaseDate remains null when no metadata (positive control).

Verification

  • Release build: 0 errors (3 pre-existing warnings — 2× AD0001 analyzer NRE in Api, 1× xUnit2031 at line 725; none introduced here).
  • Collectify.Tests: 623 passed / 0 failed.
  • Mutation M1 (remove the ReleaseDate line, comment-only so it compiles): named test goes red at line 275 (Expected 1/1/2021, Actual: null), restored, rebuild clean.
  • Collectify.PostgresTests (9 failures) = Docker Testcontainers unavailable here (/var/run/docker.sock) — environment-only, pre-existing, unrelated to this server change.

Server-only change; no client/enum-parity impact.

Phase 13: merge is the caller's ⛔ gate.---

Independent review (feature-driver round)

Independent reviewer on the regression test + fix, head 9138ced: no merge-blocking findings. One FOLLOW-UP pinned and applied:

  • Import_ProceedsWhenStoreBrowseMetadataUnavailable now asserts ReleaseDate is null (previously only Year/Developer/Publisher/Description). Mutation M2 (ReleaseDate defaulted to unix-1 in the no-metadata path) goes red at that exact assertion (Actual: 1/1/1970), proving the pin is live.

New head: 349ddc0. Full suite 623/623, Release build 0 errors.

SteamStoreImportService.NewImportedGame derived only the release Year from
Steam's SteamReleaseDate; the full Game.ReleaseDate (added in #88) stayed
null until manual edit or a provider backfill. Mirror the Year line with the
existing ToDateOnly helper so the UTC calendar date lands on ReleaseDate.

The issue's suggested line (FromUnixTimeSecondsOrNull(...)?.UtcDateTime.Date)
was dropped: ReleaseDate is DateOnly?, and .UtcDateTime.Date is DateTime -
no implicit conversion, would not compile. ToDateOnly(long) is the existing
pattern, already used for LastPlayedOn.

Regression test: Import_CapturesRichMetadataFromStoreBrowse now asserts
ReleaseDate == 2021-01-01 from SteamReleaseDate=1609459200. Red before the
fix (Actual: null), green after.

Closes #156
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9138ced129

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +549 to +551
// SteamReleaseDate is a unix timestamp with day granularity; land its UTC
// calendar date on the full ReleaseDate field (#156), not just the
// derived Year above. Null when Steam omits a release date (0 / invalid).

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Remove the redundant assignment commentary

This block merely paraphrases the immediately following SteamReleaseDate-to-ReleaseDate assignment and its null behavior rather than explaining non-inferable intent, violating the repository convention against “what” comments; the analogous comment above the test assertion should be removed as well.

AGENTS.md reference: AGENTS.md:L194-L194

Useful? React with 👍 / 👎.

Review follow-up: Import_ProceedsWhenStoreBrowseMetadataUnavailable asserted
Developer/Publisher/Year/Description were null but not ReleaseDate. Pin it so a
future change that set ReleaseDate in the no-metadata path is caught. Mutation
M2 (ReleaseDate defaults to unix-1 in the no-metadata path) went red exactly at
this new Assert.Null (Actual: 1/1/1970), confirming the pin is live.
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.

Steam import: persist ReleaseDate from SteamReleaseDate

1 participant