Skip to content

Conversation

nikhilsinhaparseable
Copy link
Contributor

@nikhilsinhaparseable nikhilsinhaparseable commented Aug 22, 2025

Summary by CodeRabbit

  • New Features

    • New CLI option (and env var) to configure the maximum allowed age gap between events; defaults to 1 hour (range: 0–168 hours).
    • Reference-based timestamp validation that compares event ages relative to a shared reference time.
  • Bug Fixes

    • More consistent time-partition validation across runs using the shared reference.
    • Enhanced error messages now include actual and reference timestamps for clearer diagnostics.
  • Tests

    • Removed one unit test related to array-to-object conversion with time partitions.

Copy link
Contributor

coderabbitai bot commented Aug 22, 2025

Walkthrough

Adds a new CLI option event_max_chunk_age to Options in src/cli.rs. Reworks timestamp validation in src/utils/json/flatten.rs to use a mutex-guarded global reference timestamp, extends JsonFlattenError with absolute and relative timestamp variants, and removes one unit test in src/utils/json/mod.rs.

Changes

Cohort / File(s) Summary
CLI option addition
src/cli.rs
Adds pub event_max_chunk_age: u64 to Options, exposed via Clap --event-max-chunk-age, env P_EVENT_MAX_CHUNK_AGE, validated 0..=168, default 1, with help text.
Timestamp validation, reference store, and errors
src/utils/json/flatten.rs
Adds a static REFERENCE_TIMESTAMP guarded by Mutex and imports Mutex. Changes validate_time_partition to: on first valid timestamp, store it as the reference (absolute cutoff against now - limit_days); on subsequent calls, validate timestamps relative to the stored reference using max_age_hours. Replaces JsonFlattenError::TimestampTooOld(String, i64) with TimestampTooOld(String, i64, DateTime<Utc>) and adds TimestampTooOldRelative(String, i64, DateTime<Utc>, DateTime<Utc>). Updates error messages to include parsed/reference datetimes.
Test removal
src/utils/json/mod.rs
Removes unit test test_convert_array_to_object_with_time_partition; other tests unchanged.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Caller
  participant Validator as validate_time_partition
  participant RefStore as REFERENCE_TIMESTAMP (Mutex)

  Caller->>Validator: validate(field, raw_ts, limit_days, max_age_hours)
  Validator->>RefStore: lock & read()
  alt No reference set
    Validator->>Validator: parse raw_ts -> parsed_ts
    Validator->>Validator: check parsed_ts >= now - limit_days
    alt Too old (absolute)
      Validator-->>Caller: Err TimestampTooOld(field, raw_ts, parsed_ts)
    else Valid
      Validator->>RefStore: store parsed_ts as reference
      Validator-->>Caller: Ok
    end
  else Reference exists
    Validator->>Validator: parse raw_ts -> parsed_ts
    Validator->>Validator: check parsed_ts >= reference - max_age_hours
    alt Too old (relative)
      Validator-->>Caller: Err TimestampTooOldRelative(field, raw_ts, parsed_ts, reference)
    else Valid
      Validator-->>Caller: Ok
    end
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Suggested labels

for next release, docs needed

Suggested reviewers

  • parmesant

Poem

I thump my paw — a flag unfurled, hooray! 🥕
A reference time within the burrow stays.
Old ticks are checked, new rules keep pace,
No stray seconds cross the cozy space.
I hop, I code, and mark the day.

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e75dd59 and f38a975.

📒 Files selected for processing (1)
  • src/utils/json/mod.rs (0 hunks)
💤 Files with no reviewable changes (1)
  • src/utils/json/mod.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: coverage
  • GitHub Check: Build Default x86_64-pc-windows-msvc
  • GitHub Check: Quest Smoke and Load Tests for Standalone deployments
  • GitHub Check: Quest Smoke and Load Tests for Distributed deployments
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot]
coderabbitai bot previously approved these changes Aug 22, 2025
@nitisht nitisht merged commit 9712581 into parseablehq:main Aug 22, 2025
13 checks passed
@nikhilsinhaparseable nikhilsinhaparseable deleted the unordered-ingestion branch August 22, 2025 05:20
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.

2 participants