Skip to content

fix: wrong column selected on expand=effectiveVolumes #1014

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

Merged
merged 1 commit into from
Jul 17, 2025

Conversation

gfyrag
Copy link
Collaborator

@gfyrag gfyrag commented Jul 17, 2025

No description provided.

@gfyrag gfyrag requested a review from a team as a code owner July 17, 2025 13:52
Copy link

coderabbitai bot commented Jul 17, 2025

Walkthrough

A test was added to verify paginated account queries with point-in-time effective volumes, and the SQL expression in the account resource handler was updated to use post_commit_effective_volumes instead of post_commit_volumes for PIT queries expanding "effectiveVolumes". No changes were made to public interfaces.

Changes

File(s) Change Summary
internal/storage/ledger/accounts_test.go Added a subtest for paginated account queries with PIT and expanded "effectiveVolumes", including assertions.
internal/storage/ledger/resource_accounts.go Modified SQL expression to select post_commit_effective_volumes for PIT "effectiveVolumes" expansions.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Runner
    participant Handler as accountsResourceHandler
    participant DB as Database

    Test->>Handler: Query accounts with PIT and expand "effectiveVolumes"
    Handler->>DB: Execute SQL selecting post_commit_effective_volumes
    DB-->>Handler: Return account(s) with effective volumes at PIT
    Handler-->>Test: Return result for assertion
Loading

Possibly related PRs

  • fix: inconsistent accounts list #856: Modifies the ordering and selection logic for volume fields in account expansion queries, closely related to the changes in SQL expressions for PIT and volume retrieval.

Suggested reviewers

  • Dav-14
  • ascandone

Poem

In ledgers deep, where volumes flow,
A rabbit checks the numbers grow.
With PIT and queries, tests expand,
Effective sums now close at hand.
SQL tweaked, assertions run—
Another hop, the work is done! 🐇


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4abf93b and f7edefb.

📒 Files selected for processing (2)
  • internal/storage/ledger/accounts_test.go (1 hunks)
  • internal/storage/ledger/resource_accounts.go (1 hunks)
🔇 Additional comments (2)
internal/storage/ledger/resource_accounts.go (1)

140-140: LGTM! Bug fix correctly aligns column selection with property expansion.

The change from post_commit_volumes to post_commit_effective_volumes properly fixes the column selection when expanding "effectiveVolumes". This ensures that effective volume data is retrieved from the correct database column instead of incorrectly using the regular volumes column.

internal/storage/ledger/accounts_test.go (1)

171-182: LGTM! Test case effectively validates the effective volumes fix.

The additional test case properly validates the bug fix by:

  • Using a different PIT timestamp (3 minutes after the original reference time)
  • Testing the "effectiveVolumes" expansion that was corrected
  • Asserting expected values that align with the transaction history

This test ensures the fix works correctly across different point-in-time queries and prevents regression.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/accounts-expand-effective-volumes

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.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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 docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for 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.

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.

@gfyrag gfyrag requested a review from Dav-14 July 17, 2025 13:57
Copy link

codecov bot commented Jul 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.91%. Comparing base (4c01edc) to head (f7edefb).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1014      +/-   ##
==========================================
+ Coverage   82.80%   82.91%   +0.10%     
==========================================
  Files         145      145              
  Lines        8240     8240              
==========================================
+ Hits         6823     6832       +9     
+ Misses       1088     1082       -6     
+ Partials      329      326       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gfyrag gfyrag added this pull request to the merge queue Jul 17, 2025
Merged via the queue into main with commit c83dcb6 Jul 17, 2025
11 checks passed
@gfyrag gfyrag deleted the fix/accounts-expand-effective-volumes branch July 17, 2025 14:04
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.

3 participants