You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Review for correctness, type safety, and test quality
Post findings
Findings
[nit] The two "status" events are only verified by type, not value — the test doesn't assert the first is { status: "running" } and the second is { status: "failed" }. If the implementation swapped the emitted status values the event-order assertion would still pass. Low risk here but reduces diagnostic clarity (api-session-runtime.test.ts:174).
[nit] No assertion on the error message content (the "error" event's message field or result.error). If the error text from the provider changes shape the test won't catch it (api-session-runtime.test.ts:173).
[nit] The fetch-throws (network error) path is a distinct failure mode from non-200 and isn't covered by any test yet. Out of scope for this PR but worth a follow-up.
Verdict: APPROVE
The test is correct and fills a real gap. I traced the implementation path for a 500 response through api-session-runtime.ts:
runProviderChatCompletion resolves to { ok: false } from the 500 response.
postRequestStatus is still "running" → no early return / no message deletion.
message(user) emitted, then session set to "failed", error emitted, status(failed) emitted.
That matches the asserted sequence ["status", "message", "error", "status"] and the DB state (user message retained, session failed). The test faithfully verifies all three invariants stated in the PR description.
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
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
Tests