Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: batches' dead code cleanup #355

Closed
wants to merge 3 commits into from
Closed

Conversation

fominok
Copy link
Collaborator

@fominok fominok commented Jan 22, 2025

We have a lot of unused code, and based on the ignored tests, it seems we aren't making
efforts to maintain or support it either.

Issue being fixed or feature implemented

Delete some unused and incomplete functionality.

What was done?

A careful deletion.

How Has This Been Tested?

According PR was made for platform: dashpay/platform#2438

rs-drive-abci test suite was used

Breaking Changes

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Refactor

    • Simplified GroveDB versioning structure by removing several feature version tracking fields
    • Removed batch run mode and associated methods
    • Streamlined import statements and test suite
  • Chores

    • Cleaned up code related to batch operations and cost estimations
    • Reduced complexity in version and batch management modules

Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

Walkthrough

This pull request involves a significant simplification of the GroveDB versioning and batch operation structures. Multiple files across the project have been modified to remove various feature version tracking fields from structs like GroveDBApplyBatchVersions, GroveDBOperationsInsertVersions, and GroveDBOperationsDeleteVersions. Additionally, the BatchRunMode enum and related methods have been completely removed, suggesting a streamlining of the versioning and batch execution tracking mechanisms.

Changes

File Change Summary
grovedb-version/src/version/grovedb_versions.rs Removed multiple feature version tracking fields from GroveDBApplyBatchVersions, GroveDBOperationsInsertVersions, and GroveDBOperationsDeleteVersions structs
grovedb-version/src/version/v1.rs Deleted corresponding fields from GROVE_V1 constant definition
grovedb-version/src/version/v2.rs Removed feature version fields and updated some average case metrics
grovedb/src/batch/estimated_costs/average_case_costs.rs Removed get_batch_run_mode method and BatchRunMode import
grovedb/src/batch/estimated_costs/worst_case_costs.rs Removed get_batch_run_mode method and BatchRunMode import
grovedb/src/batch/just_in_time_cost_tests.rs Removed two test functions and simplified import
grovedb/src/batch/mod.rs Removed mode module and get_batch_run_mode function
grovedb/src/batch/mode.rs Completely deleted the file containing BatchRunMode enum

Possibly related PRs

Suggested Reviewers

  • QuantumExplorer
  • ogabrielides

Poem

🐰 Hop, hop, through the code we go,
Trimming versions, letting simplicity flow
Batch modes vanish, structs get lean
A cleaner path, now clearly seen!
GroveDB dances with lighter feet 🌱


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 44c2244 and c33de8a.

📒 Files selected for processing (8)
  • grovedb-version/src/version/grovedb_versions.rs (0 hunks)
  • grovedb-version/src/version/v1.rs (0 hunks)
  • grovedb-version/src/version/v2.rs (0 hunks)
  • grovedb/src/batch/estimated_costs/average_case_costs.rs (1 hunks)
  • grovedb/src/batch/estimated_costs/worst_case_costs.rs (1 hunks)
  • grovedb/src/batch/just_in_time_cost_tests.rs (1 hunks)
  • grovedb/src/batch/mod.rs (2 hunks)
  • grovedb/src/batch/mode.rs (0 hunks)
💤 Files with no reviewable changes (4)
  • grovedb-version/src/version/v1.rs
  • grovedb/src/batch/mode.rs
  • grovedb-version/src/version/grovedb_versions.rs
  • grovedb-version/src/version/v2.rs
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Tests
  • GitHub Check: Compilation errors
  • GitHub Check: Code Coverage
  • GitHub Check: Linting
🔇 Additional comments (6)
grovedb/src/batch/just_in_time_cost_tests.rs (2)

18-18: LGTM!

The simplified import of ReferencePathType aligns with the dead code cleanup objectives, removing unused variant imports.


Line range hint 1-1000: Verify test coverage after test removals.

The removal of test_partial_costs_with_no_new_operations_are_same_as_apply_batch and test_partial_costs_with_add_balance_operations tests might impact coverage. Let's verify that the remaining tests adequately cover the functionality.

✅ Verification successful

Test coverage remains comprehensive after test removals

The removed tests were specific to partial costs functionality, while the codebase maintains extensive test coverage for all core batch operations, including:

  • Cost calculations for single/multi-item operations
  • Just-in-time cost updates
  • Storage flags and references
  • Various epoch scenarios
  • Edge cases and error conditions
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check test coverage for batch operations and partial costs.

# Search for remaining tests covering partial costs and batch operations
rg -A 5 'test_partial_costs|apply_batch|partial_batch' 

# Search for any TODO comments about missing test coverage
rg -i 'todo.*test|fixme.*test|xxx.*test'

Length of output: 67931

grovedb/src/batch/mod.rs (2)

28-31: Import of ops::AddAssign is appropriate

The addition of ops::AddAssign to the imports is necessary for additive assignment operations used within the module.


72-72: Import of BatchStructure ensures proper access

The inclusion of BatchStructure in the imports allows for correct usage of batch structures within the code.

grovedb/src/batch/estimated_costs/worst_case_costs.rs (1)

28-28: Addition of BatchApplyOptions to imports

The import of BatchApplyOptions is necessary for handling batch application options in worst case cost estimations.

grovedb/src/batch/estimated_costs/average_case_costs.rs (1)

28-28: Addition of BatchApplyOptions to imports

The import of BatchApplyOptions is necessary for handling batch application options in average case cost estimations.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 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.

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 docstrings to generate docstrings for this PR. (Beta)
  • @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.

@fominok
Copy link
Collaborator Author

fominok commented Jan 22, 2025

you have 3 months to implement it, clock's ticking 😈

@fominok fominok marked this pull request as draft January 30, 2025 09:52
@fominok fominok closed this Feb 5, 2025
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.

1 participant