Fix issue #893: Implement migration of the Event GraphQL layer to review-database rev 1285590 and ji - #917
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #917 +/- ##
==========================================
+ Coverage 85.96% 86.18% +0.21%
==========================================
Files 77 77
Lines 31562 31899 +337
==========================================
+ Hits 27133 27491 +358
+ Misses 4429 4408 -21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| let end = end - 1; | ||
| let end = end | ||
| .checked_sub(1) | ||
| .ok_or("invalid time `end`: no earlier event key exists")?; |
There was a problem hiding this comment.
end is an exclusive GraphQL time boundary, so both the Unix epoch and the lower i64 nanosecond bound are valid inputs rather than malformed timestamps. The current latest implementation rejects the epoch explicitly and rejects the lower bound through checked_sub(1). Please handle these as normal range boundaries: an epoch end should return matching pre-epoch events or an empty result, while end == i64::MIN should return an empty result because no representable event can precede it. Please apply this behavior consistently to event lists, totalCount, triage lists, aggregation queries, and frequency-series queries. Since this corrects observable GraphQL behavior for existing clients, please also document it under Fixed in CHANGELOG.md.
| "{{ eventList(filter: {{ start: \"{expected}\" }}, first: 1) {{ totalCount }} }}" | ||
| )) | ||
| .await; | ||
| assert!(input.errors.is_empty(), "{:?}", input.errors); |
There was a problem hiding this comment.
The new test covers successful parsing and serialization only for Jiff's canonical Z representation within the i64 nanosecond range. Please also cover the following boundary and compatibility cases:
- A timestamp that is valid for Jiff but outside the event storage's
i64nanosecond range is rejected with a clear GraphQL error. end == i64::MINis accepted as a valid exclusive boundary and produces an empty result.- An RFC3339 input using the previous Chrono-style
+00:00offset remains accepted.
These cases exercise both the new failure boundary and compatibility with existing client input.
There was a problem hiding this comment.
After reviewing the PR, I believe the following additional changes are needed. Please review and address each item.
-
The previous
endkey calculation ingroup.rsandload_triage_list()used0whenend <= 0. Replacing it withlatest()changes this behavior:end == 0now returns an error, while negative values produce a different key. Since this issue is intended to migrate tojiffwhile preserving existing behavior, theendkey semantics of these two paths should not change. Please leavelatest(), which is used by the existingeventListand pagination paths, unchanged, and preserve the previous behavior specifically forgroup.rsandload_triage_list(). If appropriate, a dedicated helper shared by these two paths may be introduced. Please also add regression tests covering an omittedend, the Unix epoch, a negativeend, and a positiveendto prevent unintended behavior changes. -
Although this change preserves external API compatibility, migrating the core time type in the Event GraphQL layer to
jiff::Timestampis a significant change and should be documented. Please add an appropriate entry toCHANGELOG.md.
Handle epoch and minimum nanosecond bounds as valid exclusive ranges, retain legacy group and triage key behavior, and document the GraphQL timestamp compatibility fixes.
|
Pushed commit |
| }); | ||
| let start = earliest(filter.start, None)?; | ||
| let end_timestamp = filter.end; | ||
| let scan_end = legacy_latest(end_timestamp)?; |
There was a problem hiding this comment.
The current implementation mixes the legacy end <= 0 scan bound with the newly chosen [start, end) semantics. Since this PR now treats the Unix epoch and the lower i64 nanosecond bound as valid exclusive boundaries, please apply that decision consistently instead of retaining legacy scan limits. Remove legacy_latest and is_before_end, and use latest(end, None)? as the upper scan key in load_triage_list, event_frequency_series, count_events, and count_events_by_network after the existing empty_time_range short-circuit. This also avoids scanning and decoding events beyond a negative end and removes the per-event timestamp conversion performed by is_before_end.
Please add a GraphQL regression test using start = -2ns and end = -1ns, with events at both -2ns and exactly -1ns, and verify that the event at end is excluded consistently from the triage list, count aggregations, and frequency series.
|
|
||
| ### Changed | ||
|
|
||
| - Migrated Event GraphQL timestamps internally from `chrono::DateTime` to |
There was a problem hiding this comment.
The changelog requested in #917 (comment) was for the user-visible correction to event time-boundary behavior, not for the internal Rust timestamp type. Please remove the Changed entry describing the internal chrono::DateTime to jiff::Timestamp migration and retain the boundary correction under Fixed. If the +00:00 to Z canonicalization is intentionally considered user-visible, document that observable output change explicitly instead of the internal implementation.
Apply `latest(end, None)` across triage, aggregation, and frequency queries after empty-range checks, removing legacy scan limits and per-event timestamp filtering. Document the corrected boundary behavior and add regression coverage for negative nanosecond ranges.
|
Pushed follow-up changes in
|
Make the polling interval and seconds unit explicit. Part of #893
Distinguish the timestamp prefix from a complete event key. Part of #893
Keep malformed-filter errors consistent across event queries. Valid empty ranges still avoid database scans. Part of #893
Use empty event ranges when exercising GraphQL DateTime inputs. This keeps parsing compatibility coverage independent of event-key iteration order and makes the expected empty result explicit. Part of #893
|
I pushed four focused follow-up commits identified during review, and CI is green. The rationale for each change is recorded in its commit message. While validating the timestamp boundaries, I found a pre-existing correctness issue in |
|
@kimhanbeom Could you review the newly added commits please? |
Summary
Implement migration of the Event GraphQL layer to review-database rev 1285590 and jiff::Timestamp while preserving RFC3339 I/O and leaving non-event chrono usage unchanged.
Changed files
Cargo.tomlsrc/graphql/event.rssrc/graphql/event/bootp.rssrc/graphql/event/conn.rssrc/graphql/event/dcerpc.rssrc/graphql/event/dhcp.rssrc/graphql/event/dns.rssrc/graphql/event/ftp.rssrc/graphql/event/group.rssrc/graphql/event/http.rssrc/graphql/event/kerberos.rssrc/graphql/event/ldap.rssrc/graphql/event/log.rssrc/graphql/event/malformed_dns.rssrc/graphql/event/mqtt.rssrc/graphql/event/network.rssrc/graphql/event/nfs.rssrc/graphql/event/ntlm.rssrc/graphql/event/radius.rssrc/graphql/event/rdp.rssrc/graphql/event/smb.rssrc/graphql/event/smtp.rssrc/graphql/event/ssh.rssrc/graphql/event/sysmon.rssrc/graphql/event/tls.rssrc/graphql/event/unusual_destination_pattern.rsCloses #893
This pull request was automatically created by octoaide.