Skip to content

test(web): 补 hooks 与 query 错误分支直测 - #1425

Merged
DeliciousBuding merged 1 commit into
masterfrom
test/web-hooks-coverage
Jul 27, 2026
Merged

test(web): 补 hooks 与 query 错误分支直测#1425
DeliciousBuding merged 1 commit into
masterfrom
test/web-hooks-coverage

Conversation

@DeliciousBuding

Copy link
Copy Markdown
Collaborator

Summary

  • 为 web 现存 hooks(useAuth / useWebAuth)补 vitest 直测:auto-login 成功/失败/卸载竞态、ensureAuth fail-closed(无 token / 仅 store authenticated)、token 读取。
  • 为已删除的 useWorkbenchProjection / useHubIMSnapshot 补 successor 直测:空数据、signed-out、real-mode 空壳、断连后丢弃 stale contacts、reconnect last-read seq。
  • query 层补 401/404/500 与无 token fail-closed:contactQueries 新测;agentQueries / projectQueries / executionTargetQueries 追加错误分支。
  • transport 已由 refactor(front): transport 下沉 shared 单一实现 #1416 下沉 shared,本 PR 不重做;web 无 agentTeamQueries / edgeClient(desktop-only / 已删)。

覆盖

目标 状态
useAuth 直测
useWebAuth 直测(401 门控 / 断网 auto-login / 重连就绪)
useWorkbenchProjection successor helpers 直测
useHubIMSnapshot successor helpers 直测
contactQueries 401/404/500 + 无 token
agent/project/executionTarget queries 401/404/500

验证

  • vitest 定向 8 files / 52 tests PASS
  • git diff --check PASS
  • typecheck:仓库既有 shared/react 解析噪声;本 PR 仅测试文件,无生产代码改动

风险

  • 低:仅加测试,不改生产路径
  • hooks 目录现仅剩 2 个文件;原 issue 的 8 hooks 中其余已在清理中删除,用 projection/IM successor 覆盖行为合同
  • 未覆盖 desktop-only agentTeamQueries

Refs #1395

Copilot AI review requested due to automatic review settings July 27, 2026 14:26

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@DeliciousBuding, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 46 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: d47a9373-7ce9-482d-9b0a-6c41ba790d65

📥 Commits

Reviewing files that changed from the base of the PR and between 159e621 and 4b5a135.

📒 Files selected for processing (8)
  • app/web/src/api/agentQueries.test.ts
  • app/web/src/api/contactQueries.test.ts
  • app/web/src/api/executionTargetQueries.test.ts
  • app/web/src/api/projectQueries.test.ts
  • app/web/src/hooks/useAuth.test.ts
  • app/web/src/hooks/useHubIMSnapshot.test.ts
  • app/web/src/hooks/useWebAuth.test.tsx
  • app/web/src/hooks/useWorkbenchProjection.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/web-hooks-coverage

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.

@DeliciousBuding
DeliciousBuding merged commit 2b40d3d into master Jul 27, 2026
20 checks passed
@DeliciousBuding
DeliciousBuding deleted the test/web-hooks-coverage branch July 27, 2026 14:30
DeliciousBuding added a commit that referenced this pull request Jul 27, 2026
Live tip 58d09fd;Closed 补 #1384+#1427 / #1424+#1426 / #1425;Open 去 #1384#1395 partial,保留 #1385
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.

2 participants