Repository navigation
test(relay): signal invite mint await instead of yield polling (#991) - #1023
Conversation
(cherry picked from commit a504b69)
🦋 Changeset detectedLatest commit: 453d057 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
[Low impact] The PR appears safe to merge.
|
Two review findings from Greptile on the contributed change, neither about the fix itself: - `cargo fmt --all --check` failed: `use tokio::sync::Notify` sat inside the futures import group, before the `nostream_config` block, so the required format step would have stopped the checks before the test ran. - `create_started().await` had no deadline, so a handler that panicked before minting would hang the test instead of failing it. The wait is now wrapped in a five-second timeout with a message that says which wait expired. `cargo fmt --all --check` is clean, and `cargo test -p nostream-relay --test handlers a_close_during_the_invite_mint` passes.
|
Merged as 48f1e01 — thanks, @avantikonde. The Two review findings landed on top in Your commit is the first on the branch with your authorship intact, and your branch is linked from the PR. Thanks for the careful write-up on the issue too. |
Contributed by @avantikonde, who wrote this fix and reported it on #991. The commit is cherry-picked with
-xfrom theirs, so authorship is preserved rather than reassigned:What it changes
a_close_during_the_invite_mint_leaves_the_event_but_not_the_readwaited for the invite mint with a 100-iterationyield_now()loop. On a loaded runner the loop can be exhausted before the mint task runs, and the test then fails with a message that accuses the mint.InMemoryInviteCodeRepositorynow carries atokio::sync::Notifythat fires when acreatecall starts, including one a gate is holding, and the test awaits it instead.Notifystores a permit when nothing is waiting, so a create that starts before the await still satisfies it.The two comment blocks explain why the test authenticates before subscribing (the mint sits behind the NIP-42 identity check) and why a wire test cannot assert this after #978, where
CLOSEruns as a connection-loop prefix.Test-only: no production code path changes.
Verification
Built and run at the contributed commit on top of the current
rewrite/maintip:Closes #991.