Skip to content

Conversation

@aaguiarz
Copy link
Member

@aaguiarz aaguiarz commented Jul 11, 2025

Summary

  • allow tuple files at the test level to satisfy validation
  • test loading tuples when only a test-level tuple file is provided

fixes #539

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_68710340ff8c8322b727f8090e14493e

Summary by CodeRabbit

  • Bug Fixes

    • Improved detection of missing tuples by checking for tuples at both the store and test levels.
  • Tests

    • Enhanced test coverage to verify tuple loading from both store-level and test-level sources. Added new test cases and expectations for test-level tuple files.

@aaguiarz aaguiarz requested a review from a team as a code owner July 11, 2025 12:55
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 11, 2025

Walkthrough

The LoadTuples method in StoreData was updated to consider tuples present not only at the store level but also within any test-level tuple files or tuples. Corresponding tests were enhanced to verify this broader tuple presence detection, including a new expectation for test-level tuples in the test cases.

Changes

File(s) Change Summary
internal/storetest/storedata.go Expanded tuple presence check in LoadTuples to include test-level tuple files and tuples.
internal/storetest/storedata_test.go Updated TestLoadTuples to check for test-level tuples, added expectTestTuples field to cases.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant StoreData
    participant TestCase

    TestRunner->>StoreData: LoadTuples()
    StoreData->>StoreData: Check TupleFile, TupleFiles, allTuples
    StoreData->>TestCase: Iterate over Tests for TupleFile/Tuples
    alt Any tuples found
        StoreData-->>TestRunner: Return loaded tuples
    else No tuples found anywhere
        StoreData-->>TestRunner: Return errMissingTuple
    end
Loading

Possibly related PRs

  • feat: support multiple tuple files #506: Refactors and expands tuple-loading logic in LoadTuples, including support for multiple global tuple files and test-level tuple files, directly modifying the same method and logic as this PR.

📜 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 c2ce0c4 and edeb8db.

📒 Files selected for processing (2)
  • internal/storetest/storedata.go (1 hunks)
  • internal/storetest/storedata_test.go (3 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
internal/storetest/storedata_test.go (1)
internal/storetest/storedata.go (2)
  • StoreData (82-90)
  • ModelTest (72-80)
⏰ 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). (6)
  • GitHub Check: Test Release Process
  • GitHub Check: Lints
  • GitHub Check: Security Audits
  • GitHub Check: Tests
  • GitHub Check: Analyze (go)
  • GitHub Check: Analyze (actions)
🔇 Additional comments (5)
internal/storetest/storedata.go (1)

134-142: LGTM! Enhanced tuple validation logic correctly addresses the PR objective.

The updated validation logic properly extends tuple presence checking to include test-level tuples, preventing false "missing tuple" errors when tuples are defined only at the test level. The implementation:

  • Maintains backward compatibility with existing store-level tuple validation
  • Correctly breaks early when test-level tuples are found
  • Aligns with the PR objective of allowing test-level tuple files to satisfy validation requirements
internal/storetest/storedata_test.go (4)

42-46: Good test structure enhancement for validating test-level tuples.

The addition of expectTestTuples field provides clear separation between store-level and test-level tuple expectations, enabling comprehensive validation of the new functionality.


49-53: Proper test case update for backward compatibility.

The existing test case correctly sets expectTestTuples: 0 to maintain validation consistency with the original behavior.


91-101: Excellent test coverage for the new functionality.

This test case specifically validates the core PR objective - ensuring that test-level tuple files can satisfy validation requirements without requiring store-level tuples. The expectations correctly reflect that store-level tuples should be 0 while test-level tuples should be 2.


123-127: Robust validation logic for test-level tuples.

The additional validation correctly:

  • Checks for test existence before accessing test tuples
  • Validates the first test's tuple count against expectations
  • Maintains consistency with the existing validation pattern
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@aaguiarz aaguiarz closed this Jul 11, 2025
@rhamzeh rhamzeh mentioned this pull request Jul 11, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Model tests cannot process tuple files anymore in 0.7.1

2 participants