test(cleanup_stream): add coverage for index cleanup, auth, and eligibility guards - #641
Merged
Austinaminu2 merged 1 commit intoAug 27, 2026
Conversation
…bility guards - test_cleanup_after_cancellation_removes_indexes: verifies all four index slices (active + archive, sent + received) are wiped after a cancelled stream is cleaned up by the sender. - test_cleanup_after_completion_removes_indexes: verifies the same for a fully-drained stream (withdrawn >= deposited AND time >= end_time), called by the recipient; also asserts StreamNotFound on get_stream. - test_cleanup_rejected_by_third_party: asserts Unauthorized is returned when a caller who is neither sender nor recipient attempts cleanup on an otherwise-eligible (cancelled) stream. - test_cleanup_rejected_when_stream_still_active: asserts StreamNotEligibleForCleanup is returned mid-stream (no cancel, no full withdrawal), and confirms stream data is untouched. Closes FlowwStar#466
|
@joshfatoye0011-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
joshfatoye0011-bit
had a problem deploying
to
staging
August 26, 2026 23:57 — with
GitHub Actions
Failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary Adds four tests to contracts/streaming/src/test.rs covering the previously untested cleanup_stream function (lines 1068-1108 of lib.rs). ## Tests added - ** est_cleanup_after_cancellation_removes_indexes** — calls cancel then cleanup_stream as the sender; asserts all four index slices (active sent/received + archive sent/received) no longer contain the stream ID. - ** est_cleanup_after_completion_removes_indexes** — advances past end_time, withdraws the full amount, calls cleanup_stream as the recipient; asserts all indexes are cleared and ry_get_stream returns StreamNotFound. - ** est_cleanup_rejected_by_third_party** — cancels the stream then calls cleanup_stream from a freshly generated outsider address; asserts Unauthorized is returned and stream data remains intact. - ** est_cleanup_rejected_when_stream_still_active** — attempts cleanup_stream on a running mid-stream; asserts StreamNotEligibleForCleanup and confirms funds are untouched. ## Coverage gaps closed | Guard / path | Test | |---|---| | caller != sender && caller != recipient → Unauthorized | est_cleanup_rejected_by_third_party | | !cancelled && !fully_drained → StreamNotEligibleForCleanup | est_cleanup_rejected_when_stream_still_active | | All four
emove_from_index calls (cancelled path) | est_cleanup_after_cancellation_removes_indexes | | All four
emove_from_index calls + storage delete (completion path) | est_cleanup_after_completion_removes_indexes | Closes #466