Skip to content

Conversation

@piyush-zlai
Copy link
Contributor

@piyush-zlai piyush-zlai commented May 12, 2025

Summary

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

  • Refactor
    • Updated test cases to use a new event schema with revised field names and structure.
    • Renamed and adjusted test data and helper methods to align with the new schema and naming conventions.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented May 12, 2025

Walkthrough

The test suite was refactored to use a new "LargeEvent" Avro schema and corresponding payload generator, replacing the previous "BeaconTop" schema. All references, field names, data generators, and tests were updated to align with the new schema structure, field names, and event data.

Changes

File(s) Change Summary
online/src/test/scala/ai/chronon/online/test/CatalystUtilComplexAvroTest.scala Replaced "BeaconTop" schema and payload generator with "LargeEvent" equivalents; updated field names, event values, nested structures, test logic, and helper functions to match the new schema. Renamed and refactored methods and data generators accordingly.

Poem

Out with BeaconTop, in with LargeEvent,
Fields renamed, new data sent.
Attributes now where properties lay,
Fresh schema guides each test’s ballet.
Code reborn, assertions tight,
Avro’s story shines anew tonight!

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
online/src/test/scala/ai/chronon/online/test/CatalystUtilComplexAvroTest.scala (1)

186-189: Schema definition could be improved.

Consider moving the large schema string to a separate file or splitting it for better readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro (Legacy)

📥 Commits

Reviewing files that changed from the base of the PR and between 6c5862d and dd9fb13.

📒 Files selected for processing (1)
  • online/src/test/scala/ai/chronon/online/test/CatalystUtilComplexAvroTest.scala (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (16)
  • GitHub Check: service_commons_tests
  • GitHub Check: service_tests
  • GitHub Check: flink_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: cloud_aws_tests
  • GitHub Check: cloud_aws_tests
  • GitHub Check: service_tests
  • GitHub Check: api_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: online_tests
  • GitHub Check: api_tests
  • GitHub Check: flink_tests
  • GitHub Check: online_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: scala_compile_fmt_fix
🔇 Additional comments (9)
online/src/test/scala/ai/chronon/online/test/CatalystUtilComplexAvroTest.scala (9)

21-24: Schema renaming looks good.

The class comment accurately describes test purpose and import updated correctly.


26-33: Field name changes in select expressions are consistent.

All references properly updated from previous schema field names to new LargeEvent fields.


35-41: Where conditions updated correctly.

Field paths changed from "properties_top" to "attributes" consistently.


46-52: Schema processing references updated properly.

Consistent schema reference usage throughout the processing logic.


66-67: Good update to result validation.

Item ID validation logic correctly updated.


73-85: Test case for add_cart event updated correctly.

All field references and method calls properly adjusted to use the new schema.


194-247: Base event creation looks good.

All fields properly renamed and structured according to the new schema.


249-266: Default attributes creation updated correctly.

Proper field setup for the nested attributes record.


268-284: Modified event creation properly updated.

The function maintains the same behavior while adapting to the new schema structure.

Comment on lines +114 to 129
it should "match event condition (favorite) with listing IDs" in {
val favoriteEvent = createModifiedEvent(
Map(
"event_name" -> "backend_favorite_item2",
"event_logger" -> "native",
"event_source" -> "ios",
"properties_top.region" -> "JP",
"properties_top.listing_id" -> "789012,456789"
"event" -> "favorite",
"logger" -> "native",
"src" -> "ios",
"attributes.region" -> "JP",
"attributes.item_id" -> "789012,456789"
))
val payloadBase64 = serializeToBase64(favoriteEvent)
val result = processEvent(payloadBase64)
// expect 2 rows for each of the listings, we check those
assert(result.size == 2)
assert(result.map(r => r("listing_id")).map(_.toString).toSet == Set("456789", "789012"))
assert(result.map(r => r("item_id")).map(_.toString).toSet == Set("456789", "789012"))
assert(result.map(r => r("favorite")).toSet == Set(1))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Inconsistent type handling in assertions.

Line 127 converts to string before comparison while line 66 doesn't need conversion.


🏁 Script executed:

#!/bin/bash
# Check if the code is inconsistent in handling item_id types
grep -r "item_id" --include="*.scala" ./online/src/test/scala/

Length of output: 3460


Unify item_id assertion types in tests

The favorite-event test casts to String, while other tests compare Longs. Prefer comparing Longs for consistency:

• File: online/src/test/scala/ai/chronon/online/test/CatalystUtilComplexAvroTest.scala
Lines 127–128

- assert(result.map(r => r("item_id")).map(_.toString).toSet == Set("456789", "789012"))
+ assert(result.map(r => r("item_id")).toSet == Set(456789L, 789012L))
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
it should "match event condition (favorite) with listing IDs" in {
val favoriteEvent = createModifiedEvent(
Map(
"event_name" -> "backend_favorite_item2",
"event_logger" -> "native",
"event_source" -> "ios",
"properties_top.region" -> "JP",
"properties_top.listing_id" -> "789012,456789"
"event" -> "favorite",
"logger" -> "native",
"src" -> "ios",
"attributes.region" -> "JP",
"attributes.item_id" -> "789012,456789"
))
val payloadBase64 = serializeToBase64(favoriteEvent)
val result = processEvent(payloadBase64)
// expect 2 rows for each of the listings, we check those
assert(result.size == 2)
assert(result.map(r => r("listing_id")).map(_.toString).toSet == Set("456789", "789012"))
assert(result.map(r => r("item_id")).map(_.toString).toSet == Set("456789", "789012"))
assert(result.map(r => r("favorite")).toSet == Set(1))
}
it should "match event condition (favorite) with listing IDs" in {
val favoriteEvent = createModifiedEvent(
Map(
"event" -> "favorite",
"logger" -> "native",
"src" -> "ios",
"attributes.region" -> "JP",
"attributes.item_id" -> "789012,456789"
))
val payloadBase64 = serializeToBase64(favoriteEvent)
val result = processEvent(payloadBase64)
// expect 2 rows for each of the listings, we check those
assert(result.size == 2)
assert(result.map(r => r("item_id")).toSet == Set(456789L, 789012L))
assert(result.map(r => r("favorite")).toSet == Set(1))
}

@piyush-zlai piyush-zlai merged commit 997e7f4 into main May 12, 2025
20 checks passed
@piyush-zlai piyush-zlai deleted the piyush/rework_cu_tests branch May 12, 2025 21:03
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

## Checklist
- [ ] Added Unit Tests
- [X] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Updated test cases to use a new event schema with revised field names
and structure.
- Renamed and adjusted test data and helper methods to align with the
new schema and naming conventions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 15, 2025
## Summary

## Checklist
- [ ] Added Unit Tests
- [X] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Updated test cases to use a new event schema with revised field names
and structure.
- Renamed and adjusted test data and helper methods to align with the
new schema and naming conventions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
chewy-zlai pushed a commit that referenced this pull request May 16, 2025
## Summary

## Cheour clientslist
- [ ] Added Unit Tests
- [X] Covered by existing CI
- [ ] Integration tested
- [ ] Documentation update



<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **Refactor**
- Updated test cases to use a new event schema with revised field names
and structure.
- Renamed and adjusted test data and helper methods to align with the
new schema and naming conventions.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
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.

4 participants