Conversation
Contributor
✅ Test Results
✅ Coverage
🔄 CI run #150 · Tue, 04 Aug 2026 13:01:11 GMT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
AvroUtils.deepEquals()compares an "expected" map (schema-blind, hand-written/JSON via Gson — every value is a plainString) against an "actual" map (schema-aware, deserialized byAvroDeserializer— genuine logical-type fields are alreadyInstant/LocalDateTime/LocalDate).To reconcile the two, the code tried to guess whether a string "looked like" a date using a broken set of
SimpleDateFormatpatterns (SUPPORTED_DATE_PATTERNS/isDateString())::typo instead of.before fractional seconds meant even standard millisecond ISO dates (...T16:19:14.123Z) never matched.As a result, valid Avro
stringfields whose content merely looked like a date (e.g. a business fieldMyDatedeclared as["null","string"]) could be silently mismatched/converted, or genuine timestamp fields pasted from tools like AKHQ would fail to compare correctly.More fundamentally, content-sniffing can never reliably distinguish "a string field that happens to contain date-like text" from "a real logical-type date/timestamp field represented as a string on the expected side only."
Fix
Replaced content-sniffing with type-driven comparison:
compareValues()now checks the actual value's real Java type. If it's anInstant,LocalDateTime, orLocalDate(meaningAvroDeserializerhas already resolved a genuine logical-type field) and the expected value is aString, the expected string is parsed into that exact target type (trying millisecond/microsecond/no-fraction precision as needed) and compared as real date/time values.Strings (no logical type was ever resolved), no date detection/conversion is attempted — they're compared literally, so genuinestringschema fields are never misinterpreted.SUPPORTED_DATE_PATTERNSandisDateString()entirely.convertDatesToTimestamps()no longer does any string-to-timestamp guessing; its previously dead/commented-out recursion into nestedMap/Liststructures is now implemented properly (still no value conversion — just consistent, type-aware, structural recursion).Files changed
ktestify-core/src/main/java/io/github/ktestify/utils/serdes/AvroUtils.javaSUPPORTED_DATE_PATTERNS,isDateString(), unusedSimpleDateFormatimport.parseExpectedInstant(),parseExpectedLocalDateTime(),parseExpectedLocalDate()helpers.compareValues()with type-drivenInstant/LocalDateTime/LocalDatevsStringcomparison branches.Map/Listrecursion inconvertDatesToTimestamps().ktestify-core/src/test/java/io/github/ktestify/utils/serdes/AvroUtilsTest.javaisDateString()/ content-sniffing behavior.convertDatesToTimestamps*tests to assert values are left unconverted (no schema info available) while confirming nested recursion produces a correct structural copy.TypeDrivenDateComparisonTestsnested test class covering:stringfields with date-like content on both sides → compared literally, never converted (regression coverage for [Bug]: Date parsing issue #49).Instant(timestamp-micros) vs. expected microsecond-precision string → match.Instantvs. expected millisecond-precision / no-fraction string → match.LocalDatevs. expectedyyyy-MM-ddstring → match (and mismatch case).LocalDateTimevs. expected local-timestamp string → match.Behavior preserved
excludedKeyshandling indeepEquals(...)/performDeepEqualsComparison(...)is untouched.convertDatesToTimestamps()remains public with the same signature, now doing a structural (deep-copy) recursion instead of unreliable content-based conversion.Resolves #49
🔄 Type of Change
✅ Pre-Merge Checklist
Code Quality
mvn spotless:check)Tests
mvn verify)Licensing