Skip to content

fix(core): date deserialisation fix#873

Merged
xav-db merged 1 commit intodevfrom
date-fix
Feb 24, 2026
Merged

fix(core): date deserialisation fix#873
xav-db merged 1 commit intodevfrom
date-fix

Conversation

@xav-db
Copy link
Member

@xav-db xav-db commented Feb 24, 2026

Fixes #872

Greptile Summary

Fixed date deserialization bug where bincode (non-human-readable format) was incorrectly using the generic visitor path instead of properly deserializing RFC3339 strings.

Key Changes:

  • Modified Date::deserialize() to check is_human_readable() and route bincode through string deserialization path
  • Re-enabled previously ignored test test_date_bincode_serialization now that the bug is resolved
  • Added comprehensive test coverage across nodes, edges, vectors, and traversal operations with date properties
  • Updated test comments to reflect RFC3339 serialization format

The fix ensures that when bincode serializes dates as RFC3339 strings (via the Serialize impl), the Deserialize impl properly handles this by parsing the string back to a DateTime<Utc> for non-human-readable deserializers.

Important Files Changed

Filename Overview
helix-db/src/protocol/date.rs Fixed bincode deserialization by checking is_human_readable() to route non-human-readable formats (like bincode) to string deserialization path, added test coverage
helix-db/src/protocol/value.rs Added Value::Date case to bincode roundtrip test for completeness
helix-db/src/helix_engine/storage_core/storage_migration_tests.rs Removed #[ignore] from date bincode test now that the issue is fixed, updated comment to reflect RFC3339 serialization format
helix-db/src/protocol/custom_serde/integration_tests.rs Added comprehensive bincode roundtrip tests for nodes, edges, and vectors with date properties

Last reviewed commit: f40cc7b

…ny branch. should have been gated by human readibility
@xav-db xav-db merged commit 2c5d580 into dev Feb 24, 2026
26 checks passed
@xav-db xav-db deleted the date-fix branch February 24, 2026 15:10
xav-db added a commit that referenced this pull request Mar 3, 2026
<!-- greptile_comment -->

<h3>Greptile Summary</h3>

Fixes `Date` deserialization for binary (bincode) formats by adding an
`is_human_readable()` check in the `Deserialize` impl. Previously,
`Date` unconditionally used `deserialize_any(DateVisitor)` which was
ambiguous for binary formats — bincode didn't know the serialized data
was a string, causing deserialization failures. The fix routes binary
formats through explicit `String::deserialize` +
`Date::parse_from_string`, while keeping the visitor-based approach for
JSON.

- **Core fix** in `helix-db/src/protocol/date.rs`: Binary deserializers
now explicitly decode a `String` and parse it, matching the
`serialize_str()` used by the `Serialize` impl
- **Test coverage** is thorough: new unit test for `Date` bincode
roundtrip, integration tests for Node/Edge/Vector with Date properties,
and end-to-end traversal tests for nodes and vectors with Date
properties
- **Un-ignores** the previously-failing
`test_date_bincode_serialization` migration test
- **`.gitignore`**: adds `**/dist` and `**/node_modules` patterns
(unrelated housekeeping)

<details><summary><h3>Important Files Changed</h3></summary>




| Filename | Overview |
|----------|----------|
| helix-db/src/protocol/date.rs | Core fix: adds `is_human_readable()`
check to Date Deserialize impl, routing binary formats (bincode) through
explicit `String::deserialize` + `parse_from_string` instead of
`deserialize_any(DateVisitor)`. Adds `test_bincode_roundtrip` unit test.
Fix is correct and necessary. |
| helix-db/src/protocol/value.rs | Adds `Value::Date` to the bincode
roundtrip test coverage. No logic changes, only test enhancement. |
| helix-db/src/protocol/custom_serde/integration_tests.rs | Adds three
new integration tests for Date property round-trips: node, edge, and
vector bincode serialization with Date properties. Well-structured tests
following existing patterns. |
|
helix-db/src/helix_engine/tests/traversal_tests/node_traversal_tests.rs
| Adds `test_n_from_id_with_date_property` end-to-end test: creates a
node with a Date property, writes/reads from storage, and verifies the
property round-trips correctly. |
|
helix-db/src/helix_engine/tests/traversal_tests/vector_traversal_tests.rs
| Adds two new tests: `test_search_v_with_non_date_properties`
(baseline) and `test_search_v_with_date_property` (validates Date
properties survive vector storage round-trips). |
| helix-db/src/helix_engine/storage_core/storage_migration_tests.rs |
Removes `#[ignore]` from `test_date_bincode_serialization` (now that the
fix enables it to pass), updates print format message, and reorders
imports alphabetically. |
| .gitignore | Adds `**/dist` and `**/node_modules` ignore patterns.
Missing trailing newline at end of file. |

</details>


</details>


<details><summary><h3>Flowchart</h3></summary>

```mermaid
%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A["Value::Date(d) Serialize"] --> B{is_human_readable?}
    B -->|Yes - JSON| C["serialize_str(rfc3339)"]
    B -->|No - bincode| D["serialize_newtype_variant(12, 'Date', d)"]
    D --> E["Date::serialize → serialize_str(rfc3339)"]
    
    F["Deserialize Value"] --> G{is_human_readable?}
    G -->|Yes - JSON| H["deserialize_any(ValueVisitor)"]
    G -->|No - bincode| I["deserialize_enum → variant 12"]
    I --> J["variant_data.newtype_variant()"]
    J --> K["Date::deserialize"]
    K --> L{is_human_readable?}
    L -->|Yes| M["deserialize_any(DateVisitor)"]
    L -->|No - NEW FIX| N["String::deserialize"]
    N --> O["Date::parse_from_string"]
    O --> P["Value::Date(date) ✅"]
    H --> Q["visit_str / visit_i64 etc."]
    M --> R["DateVisitor::visit_str"]
```
</details>


<sub>Last reviewed commit: 2c5d580</sub>

<!-- greptile_other_comments_section -->

<!-- /greptile_comment -->
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.

1 participant