Skip to content

Conversation

@Roasbeef
Copy link
Member

In this commit, we fix a flake in the rbf loop sub-test for the TestRbfCloseClosingNegotiationLocal test case.

The fix here is that when we go from ClosePending for an RBF iteration loop, we first transition to LocalCloseStart. However we only do this extra transition if we're doing an iteration (starting from ClosePending).

To fix this, we add a new bool that tracks if this is an iteration or not. We can then also eliminate the extra assertion at the end, as we'll terminate in ClosePending which is checked by
assertLocalClosePending() in assertSingleRbfIteration.

Fixes #9526.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

Copy link

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 addresses a test flake in the RBF loop for the TestRbfCloseClosingNegotiationLocal by introducing an iteration flag to better track state transitions during iterations.

  • Adds an iteration boolean parameter to the functions expectHalfSignerIteration and assertSingleRbfIteration.
  • Updates test calls to pass the correct iteration flag.

@Roasbeef
Copy link
Member Author

Looks like this revealed another flake:

--- FAIL: TestRbfChannelFlushingTransitions (0.02s)
    --- FAIL: TestRbfChannelFlushingTransitions/unknown_event (0.01s)
        rbf_coop_test.go:805: 
            	Error Trace:	/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:116
            	            				/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:257
            	            				/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:805
            	            				/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:144
            	Error:      	Received unexpected error:
            	            	timeout hit
            	Test:       	TestRbfChannelFlushingTransitions/unknown_event
            	Messages:   	expected state: *chancloser.ChannelFlushing

Will look into it.

In this commit, we fix a flake in the rbf loop sub-test for the
TestRbfCloseClosingNegotiationLocal test case.

The fix here is that when we go from ClosePending for an RBF iteration
loop, we first transition to LocalCloseStart. However we only do this
extra transition if we're doing an iteration (starting from ClosePending).

To fix this, we add a new bool that tracks if this is an iteration or
not. We can then also eliminate the extra assertion at the end, as we'll
terminate in `ClosePending` which is checked by
`assertLocalClosePending()` in `assertSingleRbfIteration`.

Fixes lightningnetwork#9526.
@Roasbeef Roasbeef force-pushed the rbf-iteration-loop-flake branch from 67e9826 to 40f58da Compare April 2, 2025 00:03
@Roasbeef
Copy link
Member Author

Roasbeef commented Apr 2, 2025

I think that was a flake that was fixed in my other PR. Pushed up a rebased version.

@Roasbeef Roasbeef requested review from a team, bhandras, bitromortac and yyforyongyu and removed request for a team, bhandras and bitromortac April 2, 2025 00:12
Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Looks like we have one more flake tho,

--- FAIL: TestRbfCloseClosingNegotiationLocal (0.04s)
    --- FAIL: TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script (0.00s)
        rbf_coop_test.go:1565: FAIL:	ReportError(mock.argumentMatcher)
            		at: [/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:398 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:1548]
        rbf_coop_test.go:1565: FAIL: 0 out of 1 expectation(s) were met.
            	The code you are testing needs to make 1 more call(s).
            	at: [/home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:238 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:248 /home/runner/work/lnd/lnd/lnwallet/chancloser/rbf_coop_test.go:1565]
FAIL
FAIL	github.com/lightningnetwork/lnd/lnwallet/chancloser	0.505s
FAIL

@Roasbeef
Copy link
Member Author

Roasbeef commented Apr 4, 2025

Hmm yeah I think this fix exposed some other ones. I think the issue is mainly with the way the test framework does the assertions.

I'll do a pass to try to make the state assertions more precise.

@lightninglabs-deploy
Copy link

@Roasbeef, remember to re-request review from reviewers when ready

…l/send_offer_rbf_wrong_local_script

In this commit, we fix a flake in the
`TestRbfCloseClosingNegotiationLocal/send_offer_rbf_wrong_local_script`
test.

This flake can happen if the test shuts down _before_ the state machine
is actually able to process the sent event. In this case, the
expectations are triggered, and we find that the error isn't sent.

To resolve this, we create a new wrapper function that'll use a sync
channel send to assert that the error has been sent before we exit the
test.
@Roasbeef
Copy link
Member Author

Pushed up a commit to attempt to fix the latest concurrency related flake.

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

Thank you!

@Roasbeef Roasbeef merged commit 35102e7 into lightningnetwork:master Jun 11, 2025
71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[unit test flake]: TestRbfCloseClosingNegotiationLocal fails

3 participants