Skip to content

Make Member.ExpiresAt tolerant of unparseable expiry dates#48

Merged
dylan-apiiro merged 1 commit into
masterfrom
dylan/LIM-42613-tolerant-member-expiresat
Jul 20, 2026
Merged

Make Member.ExpiresAt tolerant of unparseable expiry dates#48
dylan-apiiro merged 1 commit into
masterfrom
dylan/LIM-42613-tolerant-member-expiresat

Conversation

@dylan-apiiro

@dylan-apiiro dylan-apiiro commented Jul 20, 2026

Copy link
Copy Markdown

Problem

GitLab returns a project member's expires_at as a user-entered date that can be malformed. A customer (gitlab.somedomain.net) has a member with expires_at = "20235-12-04" — a 5-digit year beyond DateTime's max (9999). Member.ExpiresAt was a non-nullable DateTime, so Newtonsoft threw JsonReaderException: Could not convert string to DateTime while deserializing, which failed the entire member list. In lim, that means the repository's access sync silently produces stale data for the affected customer.

Fix

  • Add TolerantNullableDateTimeConverter (Internal/Http/Serialization/) — yields null for unparseable or empty date strings instead of throwing; parses valid dates normally.
  • Make Member.ExpiresAt a nullable DateTime? decorated with the converter. expires_at is genuinely optional in the GitLab API (members without an expiry return null), so DateTime? is also the correct type — the old non-nullable DateTime mapped a null/missing expiry to 0001-01-01.
  • One bad member no longer poisons the whole list.

Tests

MemberExpiresAtTest covers: unparseable date → null while the rest of the list still deserializes; explicit null; missing; and a valid date parsed correctly. All pass (Release build clean).

Release

Bumps <Version> to 0.1.46 (0.1.45 was published then reverted). After merge, publish 0.1.46 to GitHub Packages (nuget.pkg.github.com/apiiro) so lim can bump its pin — the CI release: published step targets nuget.org and does not feed the GitHub Packages feed lim restores from.

Part of LIM-42613

GitLab returns a project member's expires_at as a user-entered date that
can be malformed (e.g. Fiserv's "20235-12-04", a 5-digit year beyond
DateTime's max). Deserializing it into a non-nullable DateTime threw
"Could not convert string to DateTime" and failed the whole member list,
so the repository's access never synced.

Add TolerantNullableDateTimeConverter, which yields null for
unparseable/empty values, and make Member.ExpiresAt a nullable DateTime?
using it. The rest of the member list now deserializes even when one
member has a bad expiry date. expires_at is also genuinely optional in
GitLab, so DateTime? is the correct type.

Bump package version to 0.1.46 (0.1.45 was published then reverted).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dylan-apiiro
dylan-apiiro marked this pull request as ready for review July 20, 2026 12:14
@dylan-apiiro
dylan-apiiro merged commit 6699e4d into master Jul 20, 2026
2 checks passed
@dylan-apiiro
dylan-apiiro deleted the dylan/LIM-42613-tolerant-member-expiresat branch July 20, 2026 12:26
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.

2 participants