Skip to content

Conversation

rvagg
Copy link
Member

@rvagg rvagg commented May 29, 2025

Closes: #13116

This was mostly AI, needs some clearer review than I can afford right at this moment, but seems good on the surface. It also should have that job run in CI a bunch of times to confirm that it's actually fixed.

@Copilot Copilot AI review requested due to automatic review settings May 29, 2025 10:48
@github-project-automation github-project-automation bot moved this to 📌 Triage in FilOz May 29, 2025
@rvagg rvagg added the skip/changelog This change does not require CHANGELOG.md update label May 29, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Fix flaky TestAPIV2_ThroughRPC by introducing a stable execution guard and refactoring test helpers to avoid chain reorgs during RPC calls.

  • Add mkStableExecute to repeat operations until the chain tipset remains unchanged through execution.
  • Refactor tipset and certificate helper closures to return (value, error) instead of using testing helpers directly.
  • Wrap RPC requests, JSON unmarshalling, and assertions inside the stable execution flow for all test sections.

@BigLep BigLep moved this from 📌 Triage to 🔎 Awaiting Review in FilOz May 29, 2025
@rvagg rvagg force-pushed the claude/fix-TestAPIV2_ThroughRPC branch from 718937d to 1fca973 Compare May 30, 2025 01:55
@rvagg rvagg requested a review from Copilot May 30, 2025 02:06
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR aims to address flaky behavior in the TestAPIV2_ThroughRPC test by adding context cancellation checks and enforcing chain stability during test execution. Key changes include:

  • Adding a context cancellation check in TestEthAPIWithF3 to prevent potential infinite loops
  • Introducing a stable execution wrapper (mkStableExecute) in TestAPIV2_ThroughRPC to ensure consistent chain tipset state during test runs
  • Refactoring several helper functions to return errors instead of immediately failing the test

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
itests/eth_api_f3_test.go Added context cancellation check inside a retry loop
itests/api_v2_test.go Introduced mkStableExecute and updated helper functions for better error handling and stability during RPC test execution

@rvagg rvagg requested a review from Copilot May 30, 2025 03:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request addresses flakiness in API tests by introducing a stable execution wrapper that ensures the blockchain state (tipset) remains unchanged during test execution. Key changes include:

  • Adding a context check inside a loop in TestEthAPIWithF3 to fail early if the context is cancelled.
  • Introducing mkStableExecute in TestAPIV2_ThroughRPC to repeatedly invoke operations until a stable tipset is achieved.
  • Refactoring test cases in TestAPIV2_ThroughRPC to use the new stable execution helper and replacing direct actor expectation with tipset-based resolutions.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
itests/eth_api_f3_test.go Inserts a context cancellation check in the execution loop.
itests/api_v2_test.go Implements a stable execution wrapper and updates test expectations to reduce flakiness.
Comments suppressed due to low confidence (2)

itests/api_v2_test.go:43

  • [nitpick] Consider renaming mkStableExecute to a more descriptive name (e.g., withStableChain) to better communicate its purpose.
mkStableExecute := func(getTipSet func(t *testing.T) *types.TipSet) func(fn func()) *types.TipSet {

itests/api_v2_test.go:527

  • [nitpick] For consistency with the StateGetActor tests, consider capturing the return value from stableExecute in the StateGetID tests to enable additional validations and improve test clarity.
_ = stableExecute(func() { ... })

@rvagg rvagg force-pushed the claude/fix-TestAPIV2_ThroughRPC branch from 5a16d6c to 5125066 Compare May 30, 2025 04:42
@rvagg
Copy link
Member Author

rvagg commented May 30, 2025

Rebased on top of #13149 so I'd like for that one to land before this one so it'll be removed from here.

@rvagg rvagg requested review from masih and rjan90 May 30, 2025 04:55
@rvagg rvagg force-pushed the claude/fix-TestAPIV2_ThroughRPC branch from 5125066 to df96ce9 Compare May 30, 2025 07:33
@github-project-automation github-project-automation bot moved this from 🔎 Awaiting Review to ✔️ Approved by reviewer in FilOz May 30, 2025
@rvagg rvagg merged commit 8e92525 into master May 30, 2025
96 checks passed
@rvagg rvagg deleted the claude/fix-TestAPIV2_ThroughRPC branch May 30, 2025 12:42
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FilOz May 30, 2025
Copy link
Member

@masih masih left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip/changelog This change does not require CHANGELOG.md update
Projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

Flaky: itest TestAPIV2_ThroughRPC
3 participants