FlowKit icon indicating copy to clipboard operation
FlowKit copied to clipboard

Include version in query hash

Open greenape opened this issue 1 year ago • 2 comments

Closes #4489

I have:

  • [x] Formatted any Python files with black
  • [x] Brought the branch up to date with master
  • [x] Added any relevant Github labels
  • [x] Added tests for any new additions
  • [ ] Added or updated any relevant documentation
  • [ ] Added an Architectural Decision Record (ADR), if appropriate
  • [x] Added an MPLv2 License Header if appropriate
  • [x] Updated the Changelog

Description

Includes the value of __version__ in query_id hashing, which makes the cached versioned to avoid accidentally pulling in an incompatible cache table. (Where we rely on knowing the query id in tests, I have monkeypatched the __version__ attribute to a fixed value)

greenape avatar Oct 22 '24 10:10 greenape

FlowAuth    Run #24007

Run Properties:  status check passed Passed #24007  •  git commit cee9a1c95c: Add the version to stubs
Project FlowAuth
Branch Review versioned-cache
Run status status check passed Passed #24007
Run duration 00m 43s
Commit git commit cee9a1c95c: Add the version to stubs
Committer Jonathan Gray
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
View all changes introduced in this branch ↗︎

cypress[bot] avatar Oct 22 '24 10:10 cypress[bot]

Codecov Report

Attention: Patch coverage is 25.00000% with 15 lines in your changes missing coverage. Please review.

Project coverage is 76.63%. Comparing base (5317388) to head (cee9a1c). Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
flowmachine/flowmachine/core/query_stub.py 0.00% 12 Missing :warning:
flowmachine/flowmachine/core/cache.py 50.00% 2 Missing and 1 partial :warning:

:exclamation: There is a different number of reports uploaded between BASE (5317388) and HEAD (cee9a1c). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (5317388) HEAD (cee9a1c)
9 7
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #6841       +/-   ##
===========================================
- Coverage   92.15%   76.63%   -15.52%     
===========================================
  Files         275      276        +1     
  Lines       10755    10761        +6     
  Branches     1297     1298        +1     
===========================================
- Hits         9911     8247     -1664     
- Misses        691     2243     +1552     
- Partials      153      271      +118     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Oct 22 '24 12:10 codecov[bot]

[!WARNING]

Rate limit exceeded

@greenape has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 17 minutes and 8 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between eadc498b44479005006d70b0c0d528bb0806dc0d and cee9a1c95c3d2cefd3949d80a03c8be81dce6741.

Walkthrough

The pull request introduces several significant changes to the FlowKit codebase. Key updates include the addition of version numbers in query IDs to enhance cache management, improved error handling for asynchronous tasks during server shutdown, and the requirement for Python version 3.11 or higher. A new class, QStub, has been introduced, and modifications have been made to various caching and query functionalities. Additionally, the test suite has been updated to cover new features and ensure compatibility with versioning changes.

Changes

File Path Change Summary
flowmachine/core/cache.py Enhanced error handling in get_obj_or_stub, moved QStub class, updated SQL query in get_query_object_by_id to include version, added debugging output.
flowmachine/core/query.py Updated query_id generation to include flowmachine.__version__ for uniqueness.
flowmachine/core/query_stub.py Introduced QStub class with initial attributes and methods.
flowmachine/tests/test_cache.py Added test_retrieve_query_other_version to verify query retrieval across versions.
flowmachine/tests/test_cache_utils.py Added test_get_query_object_by_id_other_version to check for ValueError on version mismatch.
flowmachine/tests/test_dependency_graph.py Updated test_print_dependency_tree to include monkeypatch for version control.
flowmachine/tests/test_query_object_construction.py Added monkeypatch to test_construct_query for version simulation, expanded test cases.
flowmachine/tests/test_table.py Updated test_dependencies to include monkeypatch for version control.
flowmachine/tests/test_query_object_construction.test_construct_query.approved.txt Updated JSON structure for query configurations with new identifiers and structural changes.

Assessment against linked issues

Objective Addressed Explanation
Add version field per query for caching (4489)

🐇 In the meadow, we hop and play,
With queries that now know their way!
Each version saved, no cache to dread,
In FlowKit's world, we leap ahead!
So let us cheer, with joy and delight,
For every change makes our future bright! 🌟


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

coderabbitai[bot] avatar Nov 04 '24 13:11 coderabbitai[bot]