Skip to content

No cross-codec (Zinc⇄JSON) round-trip tests for DateTime #7

Description

@jscott3201

Problem

All existing DateTime round-trip tests are single-codec (encode and decode with the same codec):

  • haystack-core/src/codecs/json/v3.rs: datetime_roundtrip, datetime_utc_roundtrip (JSON v3 -> JSON v3)
  • haystack-core/src/codecs/json/v4.rs: datetime_roundtrip, datetime_utc_roundtrip (JSON v4 -> JSON v4)
  • haystack-core/src/codecs/zinc/parser.rs: roundtrip_datetime, roundtrip_datetime_utc (Zinc -> Zinc)

The integration tests that do exercise cross-codec chains (haystack-core/tests/e2e.rs::codec_round_trip_all_formats and ::multi_codec_grid_fidelity, which encode via Zinc then decode and re-encode via JSON) only cover Ref, Str, Number, Bool, and Marker columns — no test entity in either function sets a Kind::DateTime tag. No test anywhere decodes a DateTime from Zinc and re-encodes/decodes it via JSON (or vice versa) and asserts the offset and tz_name are preserved.

Impact

DateTime is exactly the kind most prone to cross-codec interop drift (Niagara/SkySpark have historically disagreed on offset formatting, Z vs +00:00 for UTC, and tz-name suffix handling), and it's also the kind covered by the DST-resolution gap (see the separate tz issue). Without a cross-codec conformance test, a regression in v3/v4 JSON or Zinc DateTime formatting that breaks Niagara/SkySpark interop could land without any test catching it, since the same-codec round-trip tests exercise the encoder and its own decoder against each other rather than against a second implementation.

Proposed direction

Add a datetime_cross_codec_roundtrip-style test to haystack-core/tests/e2e.rs that builds an HDict with a Kind::DateTime (non-UTC, e.g. New_York with a nonzero offset), round-trips it through each ordered pair of supported codecs (Zinc -> JSON v3, JSON v3 -> Zinc, Zinc -> JSON v4, JSON v4 -> Zinc), and asserts both the dt and tz_name fields survive unchanged.

References

Project Haystack DateTime encoding (Zinc and JSON v3/v4 grid formats).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions