Skip to content

Conversation

@greghuels
Copy link
Collaborator

@greghuels greghuels commented Dec 1, 2025

Eppo Internal:

🎟️ Fixes FFESUPPORT-348

See also:

Motivation and Context

When parsing the configuration value "endAt": "9999-12-31T00:00:00.000Z", the SDK was returning {__d_={__rep_=0}} (epoch/zero) instead of a far-future date on windows systems. This causes all allocations with year 9999 end dates to be rejected with AFTER_END_TIME error code.

@greghuels greghuels changed the title Greg.huels/ffesupport 348/fix end date parsing 2 fix: use max-time as fallback when parsing fails for end date Dec 1, 2025
@greghuels greghuels marked this pull request as draft December 1, 2025 14:41
@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch 2 times, most recently from c6bac03 to ce6098d Compare December 1, 2025 15:07
@greghuels greghuels marked this pull request as ready for review December 1, 2025 16:31
@greghuels greghuels requested a review from dd-oleksii December 1, 2025 16:31
@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch 10 times, most recently from 0b4982f to 02765b9 Compare December 1, 2025 22:06
Copy link
Collaborator

@dd-oleksii dd-oleksii left a comment

Choose a reason for hiding this comment

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

It's improving the handling compared to what we currently have so approving but I think we should properly handle true parse errors and the case of underflow.

@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch 3 times, most recently from b76d870 to 639de63 Compare December 2, 2025 12:00
@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch 4 times, most recently from 4aac24a to fb3c196 Compare December 2, 2025 12:57
greghuels and others added 3 commits December 2, 2025 07:54
Replace $(MAKE) with cmake --build to support all CMake generators,
not just Unix Makefiles. This fixes the Windows CI build which uses
Visual Studio generators by default.

cmake --build works with any generator (Makefiles, Ninja, Visual
Studio, Xcode, etc.) and automatically invokes the correct build tool.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
greghuels and others added 6 commits December 2, 2025 07:54
- Use gmtime_s instead of gmtime on Windows (MSVC C4996)
- Fix unreachable code warning in json_utils.hpp by replacing
  the unreachable return with an else clause containing a
  static_assert to catch unsupported types at compile time

These warnings were being treated as errors with /WX, causing
Windows CI builds to fail.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Create a separate OBJECT library for third-party sources (md5_wrapper.c)
with warnings disabled (/W0 on MSVC, -w on GCC/Clang). This prevents
picohash.h warnings from being treated as errors when
EPPOCLIENT_ERR_ON_WARNINGS is enabled.

The third-party code is compiled separately and linked into the main
library using $<TARGET_OBJECTS:>, ensuring our strict warning flags
only apply to our own code.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch from fb3c196 to cbdffd1 Compare December 2, 2025 13:56
Co-authored-by: Oleksii Shmalko <oleksii.shmalko@datadoghq.com>
@greghuels greghuels force-pushed the greg.huels/FFESUPPORT-348/fix-end-date-parsing-2 branch from cbdffd1 to 62a765b Compare December 2, 2025 14:47
@greghuels greghuels requested a review from dd-oleksii December 2, 2025 14:57
br.updatedAt = parseISOTimestamp(j["updatedAt"].get_ref<const std::string&>(), error);
// TODO: log error
// if (!error.empty()) {
// logger.error("BanditResponse: Invalid updatedAt: " + error);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is implemented in #42

Comment on lines +57 to +82
// Validate that we have at least 4 characters and they're all digits
if (timestamp.length() < 4) {
error = "Invalid timestamp: " + timestamp;
return std::chrono::system_clock::time_point();
}

std::string yearStr = timestamp.substr(0, 4);
for (char c : yearStr) {
if (!std::isdigit(static_cast<unsigned char>(c))) {
error = "Invalid timestamp: " + timestamp;
return std::chrono::system_clock::time_point();
}
}

// Validate that the 5th character is a dash (if it exists)
if (timestamp.length() > 4 && timestamp[4] != '-') {
error = "Invalid timestamp: " + timestamp;
return std::chrono::system_clock::time_point();
}

int year = std::stoi(yearStr);
if (year < 1970) {
return std::chrono::system_clock::time_point::min();
} else {
return std::chrono::system_clock::time_point::max();
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: there's a lot of shenanigans in this section, so worth adding a comment explaining the rational — i.e. that timegm may fail with under/overflow and we try to detect that and return "saturated" value instead of 0.

@greghuels greghuels changed the title fix: use max-time as fallback when parsing fails for end date fix: handle time parsing overload gracefully Dec 2, 2025
@greghuels greghuels merged commit 2d21dcb into main Dec 2, 2025
7 checks passed
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.

3 participants