Skip to content

feat: add match argument in tx execution succeeded and failed - #24

Merged
cristiam86 merged 6 commits into
mainfrom
drojas/dxp-301-add-match-argument-in-tx_execution_succeeded-and
Jun 5, 2025
Merged

cristiam86 merged 6 commits into
mainfrom
drojas/dxp-301-add-match-argument-in-tx_execution_succeeded-and

Conversation

@danieljrc888

@danieljrc888 danieljrc888 commented Jun 5, 2025 •

Copy link
Copy Markdown
Contributor

Fixes DXP-301
Fixes DXP-319

What

  • Added match_std_out and match_std_err arguments to both tx_execution_succeeded and tx_execution_failed
  • Added tests
  • Updated version to 0.1.3
  • Updated README
    • new match arguments
    • .gpy extensions to .py

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced transaction assertion functions to support optional matching of stdout and stderr outputs using strings or regex patterns.
  • Documentation

    • Updated the documentation to describe new assertion capabilities, including usage examples and parameter details.
    • Corrected example contract file extensions and updated minimum Python version requirements.
  • Tests

    • Expanded test coverage to validate the new output matching features and ensure robust handling of various transaction result scenarios.
  • Chores

    • Updated the project version to 0.1.3.

@linear

linear Bot commented Jun 5, 2025

Copy link
Copy Markdown
DXP-301 Add match argument in tx_execution_succeeded and tx_execution_failed functions

Allow to test with std_err and std_out match operator

Note: only available for localnet

@coderabbitai

coderabbitai Bot commented Jun 5, 2025 •

Copy link
Copy Markdown
## Walkthrough

The changes update the transaction assertion functions to support optional matching of stdout and stderr outputs using strings or regex patterns. Documentation in the README is expanded to explain these new features, and comprehensive tests are added to validate the extended assertion logic. The project version is incremented.

## Changes

| File(s)                                      | Change Summary                                                                                      |
|----------------------------------------------|-----------------------------------------------------------------------------------------------------|
| README.md                                    | Added documentation for new assertion features, including usage examples and parameter descriptions.|
| gltest/assertions.py                         | Extended `tx_execution_succeeded` and `tx_execution_failed` to support optional stdout/stderr matching.|
| tests/assertions/test_assertions.py          | Added extensive tests covering new output matching scenarios and edge cases.                        |
| pyproject.toml                               | Updated project version from 0.1.2 to 0.1.3 and raised minimum Python version to 3.12.              |
| gltest/artifacts/contract.py                  | Generalized docstring for `ContractDefinition` to refer to any contract file instead of `.gpy`.     |

## Sequence Diagram(s)

```mermaid
sequenceDiagram
    participant Test as Test Suite
    participant Assertions as assertions.py
    participant Tx as GenLayerTransaction

    Test->>Assertions: tx_execution_succeeded(Tx, match_std_out, match_std_err)
    Assertions->>Tx: Check execution result status
    alt match_std_out or match_std_err provided
        Assertions->>Tx: Check for genvm_result
        alt genvm_result present
            Assertions->>Tx: Match stdout/stderr with pattern(s)
            alt All matches succeed
                Assertions-->>Test: Return True
            else Any match fails
                Assertions-->>Test: Return False
            end
        else genvm_result missing
            Assertions-->>Test: Return False
        end
    else
        Assertions-->>Test: Return status check result
    end

Possibly related PRs

Suggested reviewers

  • cristiam86

Poem

🐇
In the warren of code, assertions now gleam,
With stdout and stderr, we match and we dream.
Patterns and strings, regex delight—
Our tests now check output, both left and right!
Version hops forward, the docs catch the light,
A bunny’s small hop, but the logic feels right.


<!-- walkthrough_end -->


---

<details>
<summary>📜 Recent review details</summary>

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


<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 0a225332e578e9947cffef96b909260f32e234c5 and b277f6100eeb9f2e20a3e2f239613b19a56e2a14.

</details>

<details>
<summary>📒 Files selected for processing (4)</summary>

* `README.md` (5 hunks)
* `gltest/artifacts/contract.py` (1 hunks)
* `gltest/assertions.py` (1 hunks)
* `pyproject.toml` (2 hunks)

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (2)</summary>

* pyproject.toml
* gltest/artifacts/contract.py

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>README.md</summary>

[uncategorized] ~293-~293: Loose punctuation mark.
Context: ...pt the following parameters:  - `result`: The transaction result object from cont...

(UNLIKELY_OPENING_PUNCTUATION)

</details>

</details>
<details>
<summary>🪛 Pylint (3.3.7)</summary>

<details>
<summary>gltest/assertions.py</summary>

[refactor] 6-6: Too many return statements (13/6)

(R0911)

---

[refactor] 6-6: Too many branches (15/12)

(R0912)

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (8)</summary><blockquote>

<details>
<summary>gltest/assertions.py (4)</summary>

`1-2`: **LGTM: Proper imports added for new functionality.**

The required imports for regex operations and type hints are correctly added to support the new output matching features.

---

`6-10`: **LGTM: Function signature properly extended.**

The function signature correctly adds the optional parameters with proper type hints, maintaining backward compatibility while enabling the new output matching functionality.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 Pylint (3.3.7)</summary>

[refactor] 6-6: Too many return statements (13/6)

(R0911)

---

[refactor] 6-6: Too many branches (15/12)

(R0912)

</details>

</details>

---

`28-51`: **LGTM: Comprehensive output matching implementation with proper error handling.**

The implementation correctly handles the regex matching logic with all necessary validations:
- Checks for presence of required fields before attempting matches
- Includes proper error handling for invalid regex patterns (addressing previous review feedback)
- Uses early returns for clear failure conditions
- Maintains logical flow despite static analysis complexity warnings

The complexity is justified given the comprehensive validation requirements.

---

`54-59`: **LGTM: Clean delegation pattern for failed transaction assertions.**

The `tx_execution_failed` function correctly delegates to `tx_execution_succeeded` with negation, maintaining consistency and avoiding code duplication.

</details>
<details>
<summary>README.md (4)</summary>

`144-144`: **LGTM: File extension correction for consistency.**

Good catch updating the file extension from `.gpy` to `.py` to maintain consistency throughout the documentation.

---

`261-298`: **Excellent documentation of the new assertion functionality.**

The new Assertions section provides comprehensive coverage of the enhanced assertion functions:
- Clear examples demonstrating both basic and advanced usage
- Proper documentation of all parameters and their purposes
- Important network compatibility limitations clearly stated
- Good use of code examples showing regex pattern matching

This documentation will help users understand and effectively use the new output matching features.

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 LanguageTool</summary>

[uncategorized] ~293-~293: Loose punctuation mark.
Context: ...pt the following parameters:  - `result`: The transaction result object from cont...

(UNLIKELY_OPENING_PUNCTUATION)

</details>

</details>

---

`374-374`: **LGTM: Consistent file extension updates.**

The file extension corrections from `.gpy` to `.py` maintain consistency across all documentation examples.



Also applies to: 386-386

---

`406-406`: **LGTM: Python version requirement update.**

The Python version requirement update from 3.8 to 3.12 aligns with the project's current requirements and ensures users have the necessary Python version for compatibility.

</details>

</blockquote></details>

</details>
<!-- internal state start -->


<!-- DwQgtGAEAqAWCWBnSTIEMB26CuAXA9mAOYCmGJATmriQCaQDG+Ats2bgFyQAOFk+AIwBWJBrngA3EsgEBPRvlqU0AgfFwA6NPEgQAfACgjoCEYDEZyAAUASpETZWaCrKNwSPbABsvkCiQBHbGlcSHFcLzpIACIAMxJqLjRaemZqBlh0CiJHdhQsXAAPSBJC0Tx4fCwHBgYSOijMeljtSNpoyAB3NGQHAWZ1Gno5MNgPbERKSFpMeBIvCgYADhX0ZFtIDEcBKYAmABZ80Y9SDC80WUowGkRxDCIwB3UPf258RHV8Fw0YMcZYTCkZDwDC4CiKbB1egghhebBKdApEFEMKdfCbEidLI5NigxAAGkgAAM0rgMgB9W60cn4PBE9AYegk9KwSm4amUChEwkEY6QWLYDBiSoYZBEork0rlcRVSmQuoNWj0prEiVShgVWUteBtIk/dyTRG0dQi5BoHz4LGxL6QUkZZH2XBNZz0Wm4bh4Bn0W7Oij0Tk22jYCgOsGYRBoYVVEplDUyrAZUQAa0Q+r+G3NiHRMLhSmQ5CxN1wyF5TCkfFwY0NGUB0kJ2G4MxufN4+BEYkg5Y+0d5AAYNABGDQAZkJKobTekfJsAFEAIIAEQAsjO0x4PT4/IFgrdGJhIDtO3NOo1QrBcO7EBwAPTXojqWDYAQaJjMO9kc6XCjnASId9nC4riLZFHmwZ5rw3LxrwODQjH0YxwCgMhXViHACGIMhlCGBRWHYLheH4YRRHEKQZHkJglCoVR1C0HR4JMKA4FQVB9zQPBCFOLColfXFOD8NAsQcJwXAPcjFGUajNG0XQwEMBDTAMWdFxXDRmFoDgDGiLSDAsSA5wASQw8gqGwoS0hE/BUJre5pDcP4lOXVc1K6HpIAnagolLL5/A7SsPFKNBmG4SIFFBKgO1iHV/MKGhRRFflwWYYkN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AABuD7M/AsDPbqejR/WYoUnPZjfPEYw6WgPnFRfzQXAwMjEILRHRFoMQP8DqMMMQDQPRXzWXOBeXYyNjCWZXZnBHVLdLFhVYtg1pP4IkZbTqMQBcTjEEE0KoekLPA7ZFVyfhY0X2C7SAExSGAAL2AMVOkAlLQ35L+FTOyXsFpEWDsSihoW4FgCoENDiGvnORSjSnuUiA6EG1DWKiiH91XKq3OUnK6i3Oag6AEHBHyXXjLz+Cdz+LsWvkQC9gYHNwBOSlSnSnPNpwZDElrMxMiFT3RGmjGD4FkTtP7nvBkUNKnBJ2sPyRlNrWpzunNIDzQSJ1yLEXVO7XtM5ydLISgAXBWLBAdEDR1yrJrLTNwHrMinXnjCP3OGaR/zjM0WcHECTOLGvFPPTOyi4AR2aGviJGiEWyYsOSX2L2OTxHQFCmooDzoqbNXzXMgA3PkDdI0GiAynRGEtEsukX3tVDRLxyRPPOKnPnUbOumUp4sApIA0p8wMX8zkgYmIRQjQg4gV3zJ4jwn4kEniwsVEgUEohUDUCkjolkgMGcp4nUHJCekQBuUekxDoDZHYpkicsQkgF7DQF2F2AAFZhxhxdgSAcqAB2JYEgAATnKv2GKoYFiHiFiHKoADYBByrexyrdhGrexYgCqSBdhhx9gGAcrUqIr0qBBdhirirYhGqBxexex6gWrYhCrdhMrhxerFrhwmqBxhwBABxyq0AcrGreq0ABxDh4IRqIAcIBhcAYqkV4rjwkrkJUqgA -->

<!-- internal state end -->
<!-- finishing_touch_checkbox_start -->

<details open="true">
<summary>✨ Finishing Touches</summary>

- [ ] <!-- {"checkboxId": "7962f53c-55bc-4827-bfbf-6a18da830691"} --> 📝 Generate Docstrings

</details>

<!-- finishing_touch_checkbox_end -->
<!-- tips_start -->

---



<details>
<summary>🪧 Tips</summary>

### Chat

There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=genlayerlabs/genlayer-testing-suite&utm_content=24):

- 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](https://www.coderabbit.ai/contact-us/support) 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](https://docs.coderabbit.ai/finishing-touches/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](https://docs.coderabbit.ai/guides/configure-coderabbit) 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](https://docs.coderabbit.ai) for detailed information on how to use CodeRabbit.
- Join our [Discord Community](http://discord.gg/coderabbit) to get help, request features, and share feedback.
- Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.

</details>

<!-- tips_end -->

@danieljrc888 danieljrc888 self-assigned this Jun 5, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 (2)
gltest/assertions.py (1)

6-46: Consider refactoring to reduce complexity.

The static analysis correctly identifies high cyclomatic complexity. Consider extracting the output matching logic into a separate helper function to improve readability and maintainability.

def _validate_output_match(genvm_result: dict, match_std_out: Optional[str], match_std_err: Optional[str]) -> bool:
    """Helper function to validate output matching."""
    if match_std_out is not None:
        if "stdout" not in genvm_result:
            return False
        try:
            if not re.search(match_std_out, genvm_result["stdout"]):
                return False
        except re.error:
            return False

    if match_std_err is not None:
        if "stderr" not in genvm_result:
            return False
        try:
            if not re.search(match_std_err, genvm_result["stderr"]):
                return False
        except re.error:
            return False
    
    return True

def tx_execution_succeeded(
    result: GenLayerTransaction,
    match_std_out: Optional[str] = None,
    match_std_err: Optional[str] = None,
) -> bool:
    # Basic validation logic...
    if execution_result != "SUCCESS":
        return False

    if match_std_out is not None or match_std_err is not None:
        if "genvm_result" not in leader_receipt:
            return False
        return _validate_output_match(leader_receipt["genvm_result"], match_std_out, match_std_err)

    return True
🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 6-6: Too many return statements (11/6)

(R0911)


[refactor] 6-6: Too many branches (13/12)

(R0912)

README.md (1)

293-293: Minor formatting improvement for parameter list.

Consider adjusting the punctuation formatting for the parameter list to improve readability.

-Both `tx_execution_succeeded` and `tx_execution_failed` accept the following parameters:

-- `result`: The transaction result object from contract method calls
+Both `tx_execution_succeeded` and `tx_execution_failed` accept the following parameters:

+- `result`: The transaction result object from contract method calls
🧰 Tools
🪛 LanguageTool

[uncategorized] ~293-~293: Loose punctuation mark.
Context: ...pt the following parameters: - result: The transaction result object from cont...

(UNLIKELY_OPENING_PUNCTUATION)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0e1db6f and 0a22533.

📒 Files selected for processing (4)
  • README.md (1 hunks)
  • gltest/assertions.py (1 hunks)
  • pyproject.toml (1 hunks)
  • tests/assertions/test_assertions.py (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/assertions/test_assertions.py (1)
gltest/assertions.py (2)
  • tx_execution_succeeded (6-46)
  • tx_execution_failed (49-54)
🪛 LanguageTool
README.md

[uncategorized] ~293-~293: Loose punctuation mark.
Context: ...pt the following parameters: - result: The transaction result object from cont...

(UNLIKELY_OPENING_PUNCTUATION)

🪛 Pylint (3.3.7)
gltest/assertions.py

[refactor] 6-6: Too many return statements (11/6)

(R0911)


[refactor] 6-6: Too many branches (13/12)

(R0912)

🔇 Additional comments (7)
pyproject.toml (1)

7-7: LGTM: Appropriate version bump for feature addition.

The version increment from 0.1.2 to 0.1.3 correctly reflects the addition of new assertion functionality.

gltest/assertions.py (3)

1-2: LGTM: Appropriate imports for new functionality.

The re import for regex matching and Optional for type hints are correctly added to support the new output matching features.


6-10: LGTM: Well-designed function signature extension.

The optional parameters with default None values maintain backward compatibility while enabling the new output matching functionality.

🧰 Tools
🪛 Pylint (3.3.7)

[refactor] 6-6: Too many return statements (11/6)

(R0911)


[refactor] 6-6: Too many branches (13/12)

(R0912)


49-54: LGTM: Elegant implementation using negation.

The tx_execution_failed function correctly delegates to tx_execution_succeeded and negates the result, ensuring consistent behavior between the two functions.

README.md (1)

261-298: LGTM: Comprehensive documentation for new assertion features.

The new "Assertions" section provides excellent documentation with clear examples for both basic usage and advanced output matching. The environment compatibility note is particularly valuable for users.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~293-~293: Loose punctuation mark.
Context: ...pt the following parameters: - result: The transaction result object from cont...

(UNLIKELY_OPENING_PUNCTUATION)

tests/assertions/test_assertions.py (2)

13-64: LGTM: Well-designed test fixtures covering diverse scenarios.

The test fixtures comprehensively cover various transaction structures including successful/failed executions, different genvm_result configurations, empty fields, and missing fields. This provides excellent foundation for thorough testing.


111-344: LGTM: Comprehensive test coverage for new assertion functionality.

The test suite excellently validates all aspects of the new output matching features:

  • Basic success/failure scenarios without output matching
  • Simple string and regex pattern matching for both stdout and stderr
  • Combined stdout/stderr matching
  • Edge cases like empty fields and missing genvm_result
  • Proper precedence of execution_result over output matching
  • Error handling for missing fields

The test organization with clear docstrings and descriptive test names makes the test suite very maintainable.

Comment thread gltest/assertions.py Resolved
@linear

linear Bot commented Jun 5, 2025

Copy link
Copy Markdown

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@danieljrc888
danieljrc888 requested a review from cristiam86 June 5, 2025 04:17
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.

2 participants