Repository navigation
fix(stream): ask for login when Kite rejects the session before subscribing - #13
Merged
Merged
Conversation
…ribing The ticker can close with AuthRejected before ticks() calls subscribe. That path returned the close reason as is, so the login hint the event loop adds was missing. It made stream_ticks_uses_the_configured_url_and_ requires_login_on_auth_rejection fail on a slow CI runner. Both paths now map a close reason to an error the same way.
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.
Why
kite stream ticksshould always tell the user to runkite auth loginwhen Kite rejects their session. It failed to when the rejection arrived early. This madestream_ticks_uses_the_configured_url_and_requires_login_on_auth_rejectionfail on #12's CI run (https://github.com/zerodha/kite-cli/actions/runs/43827926153), and the race was already onmain.Cause
The ticker can close with
AuthRejectedbeforeticks()callssubscribe. In that casesubscribefails, and the code returned the close reason as is. The; run \kite auth login`hint was only added by the event loop'sClosed(AuthRejected)` arm. CI's message had the rejection text without the hint, which matches this path. The ordering depends on scheduling, so the test passed 30 out of 30 times locally.Change
Both paths now go through one
closed(reason)mapping. A unit test pins the mapping. The race itself can't be forced deterministically from the integration test.Verification
cargo clippy -D warnings, thestreamunit tests andtests/kiteconnect_mocks.rspass locally.