Skip to content

fix(stream): ask for login when Kite rejects the session before subscribing - #13

Merged
mr-karan merged 1 commit into
mainfrom
fix/stream-auth-hint-race
Nov 16, 2026
Merged

mr-karan merged 1 commit into
mainfrom
fix/stream-auth-hint-race

Conversation

@mr-karan

Copy link
Copy Markdown
Member

Why

kite stream ticks should always tell the user to run kite auth login when Kite rejects their session. It failed to when the rejection arrived early. This made stream_ticks_uses_the_configured_url_and_requires_login_on_auth_rejection fail on #12's CI run (https://github.com/zerodha/kite-cli/actions/runs/43827926153), and the race was already on main.

Cause

The ticker can close with AuthRejected before ticks() calls subscribe. In that case subscribe fails, 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, the stream unit tests and tests/kiteconnect_mocks.rs pass locally.

…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.
@mr-karan
mr-karan merged commit a723739 into main Nov 16, 2026
3 checks passed
@mr-karan
mr-karan deleted the fix/stream-auth-hint-race branch November 16, 2026 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant