Skip to content

itest: tolerate skipped statuses in AssertReceiveEvents#2201

Merged
jtobin merged 1 commit into
lightninglabs:mainfrom
jtobin:fee-estimation-flake
Jul 14, 2026
Merged

itest: tolerate skipped statuses in AssertReceiveEvents#2201
jtobin merged 1 commit into
lightninglabs:mainfrom
jtobin:fee-estimation-flake

Conversation

@jtobin

@jtobin jtobin commented Jul 10, 2026

Copy link
Copy Markdown
Member

(N.b., fixes the flake found in this CI job, which I've also seen before.)

AssertReceiveEvents asserted that the receive event stream delivers every status in strict incremental order (detected, confirmed, proof received, completed). The custodian does not guarantee that: it only publishes the transitions it actually observes, and a transition can jump multiple statuses at once.

In particular, on a send between two addresses of the same node (as in the fee_estimation test), the proof is written to the local proof archive by the porter at confirmation time. The custodian's main event loop selects over both the proof notifier subscription and lnd's transaction notification stream. If the proof notification wins, mapProofToEvent publishes proof received and completed while the event is still at the detected status, and removes the event from the in-flight set. When lnd's confirmed transaction notification arrives afterwards, the event is already completed and is skipped, so the confirmed status is never published. The strict walk then fails with "expected: 2, actual: 3".

Relax the assertion to a monotonic walk: statuses must be non-decreasing, valid, and end with the completed status. Repeated statuses are also allowed, since V2 addresses publish one proof received event per output.

AssertReceiveEvents asserted that the receive event stream delivers
every status in strict incremental order (detected, confirmed, proof
received, completed). The custodian does not guarantee that: it only
publishes the transitions it actually observes, and a transition can
jump multiple statuses at once.

In particular, on a send between two addresses of the same node (as
in the fee_estimation test), the proof is written to the local proof
archive by the porter at confirmation time. The custodian's main
event loop selects over both the proof notifier subscription and
lnd's transaction notification stream. If the proof notification
wins, mapProofToEvent publishes proof received and completed while
the event is still at the detected status, and removes the event
from the in-flight set. When lnd's confirmed transaction
notification arrives afterwards, the event is already completed and
is skipped, so the confirmed status is never published. The strict
walk then fails with "expected: 2, actual: 3".

Relax the assertion to a monotonic walk: statuses must be
non-decreasing, valid, and end with the completed status. Repeated
statuses are also allowed, since V2 addresses publish one proof
received event per output.
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a flakiness issue in the integration tests caused by overly strict event status assertions. By shifting from a strict incremental check to a monotonic, non-decreasing validation, the test suite can now correctly handle race conditions where multiple status transitions are processed out of order or skipped entirely due to internal event loop timing.

Highlights

  • Relaxed Event Assertions: Updated AssertReceiveEvents to allow non-decreasing status transitions instead of requiring strict incremental updates.
  • Handling Skipped Statuses: Modified the assertion logic to tolerate skipped statuses, which occur when multiple state transitions are processed simultaneously.
  • Support for Repeated Statuses: Enabled support for repeated statuses, accommodating scenarios like V2 addresses that publish multiple proof-received events.
New Features

🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the AssertReceiveEvents function in itest/assertions.go to allow for non-decreasing statuses instead of strictly incremental ones. This change accommodates scenarios where intermediate statuses are skipped or repeated, updating the assertions to verify that the event status is greater than or equal to the last observed status and less than or equal to the completed status. I have no feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@github-project-automation github-project-automation Bot moved this from 🆕 New to 👀 In review in Taproot-Assets Project Board Jul 14, 2026
@jtobin jtobin added this pull request to the merge queue Jul 14, 2026
Merged via the queue into lightninglabs:main with commit 8878d38 Jul 14, 2026
44 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Taproot-Assets Project Board Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants