feat(scalars): add eql_v3.timestamptz encrypted-domain type (equality-only)#257
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
37dc457 to
cea046f
Compare
3fa7497 to
b8b8726
Compare
cea046f to
ef32e5d
Compare
b8b8726 to
fd0bffc
Compare
7f489e8 to
55c19b8
Compare
4a595ea to
d21954f
Compare
d21954f to
16ad2bb
Compare
16ad2bb to
badaedf
Compare
There was a problem hiding this comment.
Claude identified two gaps, which are posted inline.
There are two other gaps not posted inline:
to_sql_literalRFC3339 rendering is not unit-pinned.tests/sqlx/src/scalar_domains.rs:230usesformat!("'{}'", v.to_rfc3339())— a new, timestamptz-specific path distinct fromdate'sDisplay-basedsql_lit. It's exercised transitively by the matrix (viafetch_fixture_payload), but no focused test pins the literal form. A one-liner —assert_eq!(<chrono::DateTime<chrono::Utc> as ScalarType>::to_sql_literal(Default::default()), "'1970-01-01T00:00:00+00:00'")— would lock it and catch a stray format change.to_plaintextroundtrip only covers the epoch.datetime_utc_to_plaintext_wraps_in_timestamp_variant(eql_plaintext.rs) usesDateTime::<Utc>::default(); a value carrying a time-of-day (e.g. one of the…T23:20:50Zfixtures) would be a marginally stronger roundtrip, though the existingassert_eq!(value, ts)is already value-generic. Low priority.
auxesis
left a comment
There was a problem hiding this comment.
Missing tests need addressing.
…ctness Address PR #257 review feedback. The temporal_values! auto-generated tests re-run the exact parse closure over all-UTC (`…Z`) catalog fixtures, so they cannot catch a regression that drops the offset→UTC conversion, and fixture distinctness is keyed by string upstream in eql-scalars (which is zero-dep, no chrono) so two RFC3339 strings denoting the same UTC instant pass as distinct. Add two harness-side guards alongside the timestamptz temporal_values! call: - rfc3339_offset_is_normalized_to_utc: feeds an offset-bearing RFC3339 string and asserts it resolves to the same instant as the Z form (fails on a switch to .naive_utc()). - fixtures_are_distinct_by_instant: dedups timestamptz_values() by parsed DateTime<Utc>, guarding the property the fixture table keys on.
…-only) Add the timestamptz scalar encrypted-domain type to the eql_v3 family as EQUALITY-ONLY: storage + eql_v3.timestamptz_eq (= / <> via HMAC), no ord domains, no MIN/MAX aggregates. Ordering is deferred: cipherstash encrypts Plaintext::Timestamp at native 12-block ORE width, but EQL's only ORE comparator (eql_v2.compare_ore_block_u64_8_256_term) is hardcoded to 8 blocks, so an ordered timestamptz domain would silently mis-order. Ordering follows once a wide-ORE (12-block) term lands. - catalog: add EQ_ONLY_DOMAINS (storage + _eq); point TIMESTAMPTZ at it. Replace all_types_share_the_same_domain_shape with a shape-aware test (every type matches one of two known shapes) plus a pin of which token uses which shape. - dispatch: extend the scalar_types! entry grammar with an optional [eq_only] marker; eq-only entries emit eq_only_scalar_matrix! instead of ordered_numeric_matrix!. ordered int4/int2/date emission is byte-identical. - matrix: eq_only_scalar_matrix! now derives its three pivots from the ScalarType impl (like the ordered macro) instead of requiring explicit pivots — the first consumer wires cleanly with no per-call pivot authoring. - inventory: make mise test:matrix:inventory shape-aware. Add the second canonical snapshot matrix_tests_eq_only.txt; each discovered type is compared against the snapshot matching its shape (ordered vs eq-only). Document the two-shape mechanism in snapshots/README.md. matrix_tests.txt is unchanged. - CHANGELOG: timestamptz ships equality-only, ordering deferred.
…ctness Address PR #257 review feedback. The temporal_values! auto-generated tests re-run the exact parse closure over all-UTC (`…Z`) catalog fixtures, so they cannot catch a regression that drops the offset→UTC conversion, and fixture distinctness is keyed by string upstream in eql-scalars (which is zero-dep, no chrono) so two RFC3339 strings denoting the same UTC instant pass as distinct. Add two harness-side guards alongside the timestamptz temporal_values! call: - rfc3339_offset_is_normalized_to_utc: feeds an offset-bearing RFC3339 string and asserts it resolves to the same instant as the Z form (fails on a switch to .naive_utc()). - fixtures_are_distinct_by_instant: dedups timestamptz_values() by parsed DateTime<Utc>, guarding the property the fixture table keys on.
fac889e to
e0177f3
Compare
…ctness Address PR #257 review feedback. The temporal_values! auto-generated tests re-run the exact parse closure over all-UTC (`…Z`) catalog fixtures, so they cannot catch a regression that drops the offset→UTC conversion, and fixture distinctness is keyed by string upstream in eql-scalars (which is zero-dep, no chrono) so two RFC3339 strings denoting the same UTC instant pass as distinct. Add two harness-side guards alongside the timestamptz temporal_values! call: - rfc3339_offset_is_normalized_to_utc: feeds an offset-bearing RFC3339 string and asserts it resolves to the same instant as the Z form (fails on a switch to .naive_utc()). - fixtures_are_distinct_by_instant: dedups timestamptz_values() by parsed DateTime<Utc>, guarding the property the fixture table keys on.
feat(scalars): add eql_v3.timestamptz encrypted-domain type (equality-only)
…ctness Address PR #257 review feedback. The temporal_values! auto-generated tests re-run the exact parse closure over all-UTC (`…Z`) catalog fixtures, so they cannot catch a regression that drops the offset→UTC conversion, and fixture distinctness is keyed by string upstream in eql-scalars (which is zero-dep, no chrono) so two RFC3339 strings denoting the same UTC instant pass as distinct. Add two harness-side guards alongside the timestamptz temporal_values! call: - rfc3339_offset_is_normalized_to_utc: feeds an offset-bearing RFC3339 string and asserts it resolves to the same instant as the Z form (fails on a switch to .naive_utc()). - fixtures_are_distinct_by_instant: dedups timestamptz_values() by parsed DateTime<Utc>, guarding the property the fixture table keys on.
What
Add
eql_v3.timestamptzas an equality-only encrypted-domain scalar (storage +_eqvia HMAC;=/<>). Ordering is deferred: cipherstash encryptsPlaintext::Timestampat 12-block ORE width but EQL's only ORE comparator is 8-block, so an ordered domain would silently mis-order.Rides the generalized harness (#261)
Rebased onto
v3-scalar-harness-reduction, the per-type surface is +259 / 5 files (was +671 / 10). The whole type is:eql-scalars):ScalarKind::Timestamptz,Fixture::Timestamptz,EQ_ONLY_DOMAINS, theTIMESTAMPTZspec +CATALOGappend.temporal_values!call (scalar_domains.rs):scalar_types.rs):timestamptz => chrono::DateTime<chrono::Utc>,eql_plaintext.rs) + CHANGELOG.No marker, no second snapshot, no macro change — the catalog's eq-only domain shape drives everything: the emitter picks
scalar_matrix! { caps = [eq] }, and the inventory derives its eq-only name subset from the single baseline.Status / verification
cargo test -p eql-scalars→ 43 passed (incl.timestamptz_*)timestamptz: eq_only(derived, no second snapshot)release/*.sqlidentical to the pre-rebase commit — verification in progressv3-scalar-harness-reduction+ force-push (--force-with-lease) — pending (depends on refactor(scalars): generalize the test harness (catalog-driven shape, temporal_values!, unified scalar_matrix!) #261)