Elastic's investigation into a rare test failure in Elasticsearch led to the discovery of a subtle bug in Java's date-time formatting, highlighting the complexities of handling date and time data. The issue arose when composite aggregations in Elasticsearch, which rely on human-readable keys for pagination, encountered problems with date formats that did not "round trip" correctly, meaning the formatted string failed to parse back to its original value. This bug was traced to Java's handling of week-based and month-based years, which caused incorrect date parsing under certain circumstances. Elastic's approach involved testing for round-trip capability and using randomized testing to expose edge cases, such as Daylight Savings Time transitions, which further complicated the issue. After identifying the problem, it was traced back to the Java Development Kit, leading to a bug report and subsequent fix. This experience underscored the importance of edge case testing, contract testing, and the value of randomized testing in identifying unexpected issues.