Skip to content

test: cover stale conversation switching - #18211

Merged
JinHai-CN merged 3 commits into
infiniflow:mainfrom
01JohnMa:test/stale-session-switch
Aug 19, 2026
Merged

JinHai-CN merged 3 commits into
infiniflow:mainfrom
01JohnMa:test/stale-session-switch

Conversation

@01JohnMa

@01JohnMa 01JohnMa commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add focused frontend regression coverage for stale conversation messages during chat session switching.

Why

When the URL already points to a newly created conversation while the child still receives the previous conversation prop, the old messages must not be hydrated into the new session. This reproduces the race fixed by #18140.

The production guard is already present on main; this PR adds the missing component-level regression test.

Validation

  • npm test -- --runInBand src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx
  • npx oxfmt --check src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx
  • npx oxlint src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx
  • The stale-session test fails when the fix: prevent stale conversation messages during session switch #18140 guard is removed and passes with the guard restored.

Related: #18140.

Replaces #18208.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e81ad236-7154-495d-aaec-2c1eb15d2612

📥 Commits

Reviewing files that changed from the base of the PR and between 5d408d0 and d509c7a.

📒 Files selected for processing (1)
  • web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx

📝 Walkthrough

Walkthrough

Added SingleChatBox tests for conversation hydration. The tests cover mismatched URL conversation IDs and matching IDs with the expected conversation messages.

Changes

SingleChatBox hydration

Layer / File(s) Summary
Conversation hydration coverage
web/src/pages/next-chats/chat/chat-box/single-chat-box.test.tsx
Mocks dependent components and hooks. Verifies that stale conversations are not hydrated and that matching conversations call hydrateFromServer with the conversation ID and messages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d509c

This change adds regression coverage for stale conversation switching without changing production behavior, so no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

Poem

A rabbit checks each chat in flight,
Mismatched messages stay out of sight.
Matching IDs bring messages near,
Hydration runs when paths are clear.
Tests record the flow just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the regression test for stale conversation switching.
Description check ✅ Passed The description explains the problem, test purpose, validation steps, related issue, and replacement PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@01JohnMa
01JohnMa marked this pull request as ready for review August 13, 2026 07:07
@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🧪 test Pull requests that update test cases. 🧰 typescript Pull requests that update Typescript code labels Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@JinHai-CN
JinHai-CN requested a review from dcc123456 August 18, 2026 08:09
@JinHai-CN JinHai-CN added the ci Continue Integration label Aug 18, 2026
@JinHai-CN
JinHai-CN merged commit 2b58e62 into infiniflow:main Aug 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files. 🧪 test Pull requests that update test cases. 🧰 typescript Pull requests that update Typescript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants