Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 43 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughSummary by CodeRabbit
WalkthroughThe pull request updates status-risk confirmation, selected-group billing, Qwen thinking-budget handling, DeepSeek Responses conversion, OAuth callback routing, and user log metadata. ChangesStatus code risk confirmation
Selected-group tiered billing
Thinking budget and DeepSeek Responses
OAuth callback mode
User log metadata
Estimated code review effort: 4 (Complex) | ~45 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (1 warning, 2 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@web/default/src/features/channels/components/dialogs/status-code-risk-dialog.test.tsx`:
- Around line 35-57: Rewrite the test around StatusCodeRiskConfirmationContent
to use React Testing Library rendering rather than renderToStaticMarkup, while
preserving the existing risk-notice assertions where applicable. Provide
distinct spies for onCancel and onConfirm, click each corresponding action, and
assert that each callback is invoked. Run the repository type check after
updating the test.
In
`@web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx`:
- Around line 109-113: Add aria-hidden="true" to the HugeiconsIcon using
Alert02Icon in the dialog title so assistive technology ignores the decorative
warning icon while preserving the existing DialogTitle content.
- Around line 52-56: Update both StatusCodeRiskConfirmationContent and the
component defined near its sibling signature at lines 96-101 in
web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx
to accept a typed props object, access values through props, and declare the
repository-preferred explicit React JSX return type; apply the same change at
both affected sites.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: c80b0b26-cf75-4aab-94c2-e15de5b6803e
📒 Files selected for processing (2)
web/default/src/features/channels/components/dialogs/status-code-risk-dialog.test.tsxweb/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
- GitHub Check: Frontend checks
- GitHub Check: Backend checks
🧰 Additional context used
📓 Path-based instructions (2)
web/default/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (web/default/AGENTS.md)
web/default/src/**/*.{ts,tsx}: 前端页面文本与组件内文案必须支持 i18n:React 组件中应使用useTranslation()取得t,并通过t()渲染用户可见文本;子组件也应自行使用useTranslation()保持独立性。
禁止使用两层及以上嵌套三元表达式;复杂逻辑应改用if-else、提前返回或抽取函数。
控制函数圈复杂度,复杂逻辑应拆成更小的函数;变量与函数命名应有意义并遵循驼峰等常规命名约定。
TypeScript 代码应避免使用any,优先使用具体类型或unknown;参数与返回值应显式标注类型;仅类型用途的导入应使用import type。
修改 TypeScript 或 TSX 代码后必须执行类型检查,并修复所有类型错误,不得遗留。
对象非必要不要解构,尤其是组件 props;优先直接使用props.xxx以保持代码清晰。
组件应使用函数式组件与 Hooks,遵循单一职责;组件 props 必须有明确类型(接口或类型别名)。
单文件超过约 200 行时应考虑拆分子组件或抽取自定义 Hooks;类型定义可与组件同文件或放在同模块的types中。
在 React 中应合理使用useMemo、useCallback、React.memo,避免在渲染路径中创建新对象或数组;必要时进行代码分割与动态import。
React Query 的数据获取应使用useQuery、变更应使用useMutation;每个查询需配置唯一queryKey,并在成功后对相关查询执行invalidateQueries;服务端错误应统一交给handleServerError。
Axios 请求应使用项目统一的api实例;GET 请求默认去重,特殊请求可显式关闭;认证与通用错误应在拦截器中统一处理。
服务端错误应统一使用handleServerError,展示层应使用toast.error等统一方式;文案需走 i18n;路由级错误应由errorComponent承接;表单错误应通过form.setError等方式映射到字段。
样式应以 Tailwind 工具类为主,动态类名使用cn()合并;非动态场景避免内联样式;响应式采用移动优先与 Tailwind 断点,主题与暗色模式通过 CSS 变量与dark:处理。
应使用语义化 HTML、正确关联label与输入、保证键盘可操作与合理焦点顺序;必要时添加 ARIA 属性,装饰性图标应使用aria-hidden="true"。
认证与权限应在路由与接口层校验;前后端都应做数据校验(如 Zod);敏感信息不得落前端存储;避免使用dangerouslySetInnerHTML;跨域与 Cookie 需配合withCredentials并按后端要求处理 CSRF。
组件测试应使用 React Testing Library,关注交互与行为,避免测试实现细节;关键流程可补充集成与 E2E 测试。
环境变量应通过.env读取,并使用VITE_前缀;代码中不得硬编码密钥。
Files:
web/default/src/features/channels/components/dialogs/status-code-risk-dialog.test.tsxweb/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx
web/default/src/features/**
📄 CodeRabbit inference engine (web/default/AGENTS.md)
功能模块应放在
src/features/<feature>/,并按需包含components/、lib/、hooks/、api.ts、types.ts、constants.ts等;通用组件应放在src/components/,通用工具与类型应放在src/lib/。
Files:
web/default/src/features/channels/components/dialogs/status-code-risk-dialog.test.tsxweb/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx
🔇 Additional comments (2)
web/default/src/features/channels/components/dialogs/status-code-risk-dialog.tsx (2)
19-20: LGTM!
121-125: LGTM!
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
web/default/src/routes/oauth/$provider.tsx (1)
46-50: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winValidate OAuth callback search parameters with Zod.
This route currently casts
useSearch(...)instead of defining a Zod search schema withvalidateSearchonRoute. Add validation for the expectedcode/state/redirect/bindshape before runtime code binds it to auth state.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@web/default/src/routes/oauth/`$provider.tsx around lines 46 - 50, Define a Zod schema for the optional code, state, redirect, and bind search parameters, then register it through the OAuth provider Route’s validateSearch configuration. Remove the type cast from useSearch and consume the validated search result so auth-state binding receives the expected shape.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@service/tiered_settle_test.go`:
- Around line 340-394: Add a test for the free-to-paid branch in
PrepareTieredBillingForSelectedGroup using relayInfo.Billing == nil and a
refreshed non-zero GroupRatio; assert that billing is initialized and
FinalPreConsumedQuota equals the expected pre-consumed quota.
In `@web/default/src/routes/oauth/`$provider.tsx:
- Around line 52-65: Replace the duplicated mode state and synchronization in
web/default/src/routes/oauth/$provider.tsx lines 52-65 with direct derivation
from provider, search.state, and search.bind. In the OAuth exchange effect at
lines 93-99, remove mode from the dependency list while preserving the existing
exchange behavior; both sites are in the same file.
---
Outside diff comments:
In `@web/default/src/routes/oauth/`$provider.tsx:
- Around line 46-50: Define a Zod schema for the optional code, state, redirect,
and bind search parameters, then register it through the OAuth provider Route’s
validateSearch configuration. Remove the type cast from useSearch and consume
the validated search result so auth-state binding receives the expected shape.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 6947c29e-a045-46aa-bec4-8e6df3dd4b5d
📒 Files selected for processing (16)
controller/relay.godto/openai_request.godto/openai_request_zero_value_test.gomodel/log.gomodel/log_test.gorelay/channel/deepseek/adaptor.gorelay/channel/deepseek/adaptor_test.goservice/openaicompat/chat_to_responses.goservice/openaicompat/responses_compat_test.goservice/openaicompat/responses_request_to_chat.goservice/tiered_settle.goservice/tiered_settle_test.goweb/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.tsweb/default/src/lib/oauth.tsweb/default/src/routes/oauth/$provider.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Backend checks
🧰 Additional context used
📓 Path-based instructions (8)
**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.go: In Go business code, all JSON marshal/unmarshal operations must use the wrapper functions incommon/json.go(common.Marshal,common.Unmarshal,common.UnmarshalJsonStr,common.DecodeJson,common.GetJsonType) and must not directly callencoding/jsonfor actual encode/decode work.
All database code must be compatible with SQLite, MySQL 5.7.8+, and PostgreSQL 9.6+; prefer GORM abstractions over raw SQL, avoid directAUTO_INCREMENT/SERIAL, usecommonGroupCol/commonKeyColandcommonTrueVal/commonFalseValfor DB-specific SQL, branch withcommon.UsingPostgreSQL/common.UsingSQLite/common.UsingMySQL, avoid unsupported DB-specific functions/operators without fallback, and make migrations work across all three databases.
When implementing a new relay channel, confirm whether the provider supportsStreamOptions; if it does, add that channel tostreamSupportedChannels.
For request structs parsed from client JSON and re-marshaled to upstream providers, optional scalar fields must use pointer types withomitemptyso explicit zero/false values are preserved instead of dropped.
When working on tiered/dynamic billing expression code, readpkg/billingexpr/expr.mdfirst and follow its documented expression language, architecture, token normalization, quota conversion, and versioning patterns.
**/*.go: All JSON marshal/unmarshal operations in Go business code must use the wrapper functions incommon/json.go(common.Marshal,common.Unmarshal,common.UnmarshalJsonStr,common.DecodeJson,common.GetJsonType) instead of directly importing or callingencoding/jsonfor actual marshal/unmarshal work.
All database code in Go must remain compatible with SQLite, MySQL >= 5.7.8, and PostgreSQL >= 9.6; prefer GORM abstractions, avoid raw SQL unless necessary, use the shared DB helper variables for reserved words and boolean literals, branch with thecommon.UsingPostgreSQL/common.UsingSQLite/common.UsingMySQLflags when need...
Files:
relay/channel/deepseek/adaptor_test.gomodel/log_test.goservice/openaicompat/responses_compat_test.gomodel/log.goservice/openaicompat/responses_request_to_chat.goservice/tiered_settle.gocontroller/relay.goservice/openaicompat/chat_to_responses.gorelay/channel/deepseek/adaptor.goservice/tiered_settle_test.godto/openai_request.godto/openai_request_zero_value_test.go
relay/channel/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
When implementing a new channel, confirm whether the provider supports
StreamOptions; if it does, add the channel tostreamSupportedChannels.
Files:
relay/channel/deepseek/adaptor_test.gorelay/channel/deepseek/adaptor.go
web/default/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (web/default/AGENTS.md)
web/default/src/**/*.{ts,tsx}: 前端页面文本与组件内文案必须支持 i18n:React 组件中应使用useTranslation()取得t,并通过t()渲染用户可见文本;子组件也应自行使用useTranslation()保持独立性。
禁止使用两层及以上嵌套三元表达式;复杂逻辑应改用if-else、提前返回或抽取函数。
控制函数圈复杂度,复杂逻辑应拆成更小的函数;变量与函数命名应有意义并遵循驼峰等常规命名约定。
TypeScript 代码应避免使用any,优先使用具体类型或unknown;参数与返回值应显式标注类型;仅类型用途的导入应使用import type。
修改 TypeScript 或 TSX 代码后必须执行类型检查,并修复所有类型错误,不得遗留。
对象非必要不要解构,尤其是组件 props;优先直接使用props.xxx以保持代码清晰。
组件应使用函数式组件与 Hooks,遵循单一职责;组件 props 必须有明确类型(接口或类型别名)。
单文件超过约 200 行时应考虑拆分子组件或抽取自定义 Hooks;类型定义可与组件同文件或放在同模块的types中。
在 React 中应合理使用useMemo、useCallback、React.memo,避免在渲染路径中创建新对象或数组;必要时进行代码分割与动态import。
React Query 的数据获取应使用useQuery、变更应使用useMutation;每个查询需配置唯一queryKey,并在成功后对相关查询执行invalidateQueries;服务端错误应统一交给handleServerError。
Axios 请求应使用项目统一的api实例;GET 请求默认去重,特殊请求可显式关闭;认证与通用错误应在拦截器中统一处理。
服务端错误应统一使用handleServerError,展示层应使用toast.error等统一方式;文案需走 i18n;路由级错误应由errorComponent承接;表单错误应通过form.setError等方式映射到字段。
样式应以 Tailwind 工具类为主,动态类名使用cn()合并;非动态场景避免内联样式;响应式采用移动优先与 Tailwind 断点,主题与暗色模式通过 CSS 变量与dark:处理。
应使用语义化 HTML、正确关联label与输入、保证键盘可操作与合理焦点顺序;必要时添加 ARIA 属性,装饰性图标应使用aria-hidden="true"。
认证与权限应在路由与接口层校验;前后端都应做数据校验(如 Zod);敏感信息不得落前端存储;避免使用dangerouslySetInnerHTML;跨域与 Cookie 需配合withCredentials并按后端要求处理 CSRF。
组件测试应使用 React Testing Library,关注交互与行为,避免测试实现细节;关键流程可补充集成与 E2E 测试。
环境变量应通过.env读取,并使用VITE_前缀;代码中不得硬编码密钥。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.tsweb/default/src/routes/oauth/$provider.tsxweb/default/src/lib/oauth.ts
web/default/src/features/**/lib/**/*.ts
📄 CodeRabbit inference engine (web/default/AGENTS.md)
表单应使用 React Hook Form + Zod:在功能模块的
lib/下定义 schema,并用z.infer导出表单类型;useForm应配合@hookform/resolvers/zod进行校验。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.ts
web/default/src/features/**
📄 CodeRabbit inference engine (web/default/AGENTS.md)
功能模块应放在
src/features/<feature>/,并按需包含components/、lib/、hooks/、api.ts、types.ts、constants.ts等;通用组件应放在src/components/,通用工具与类型应放在src/lib/。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.ts
web/default/src/**/*.test.ts
📄 CodeRabbit inference engine (web/default/AGENTS.md)
工具函数与纯逻辑应优先编写单元测试;测试文件应命名为
*.test.ts。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.ts
web/default/src/routes/**/*.{ts,tsx}
📄 CodeRabbit inference engine (web/default/AGENTS.md)
路由应使用 TanStack Router,并通过
createFileRoute定义;搜索参数应使用 Zod schema +validateSearch校验;认证与重定向应放在beforeLoad中;导航应优先使用useNavigate或Link,避免直接操作window.location。
Files:
web/default/src/routes/oauth/$provider.tsx
dto/**/*.go
📄 CodeRabbit inference engine (AGENTS.md)
For request structs parsed from client JSON and then re-marshaled to upstream providers, especially in relay/convert paths, optional scalar fields must use pointer types with
omitemptyso that absent fields stay omitted while explicit zero/false values are preserved.
Files:
dto/openai_request.godto/openai_request_zero_value_test.go
🔇 Additional comments (20)
model/log.go (1)
366-366: LGTM!model/log_test.go (1)
1096-1098: LGTM!web/default/src/lib/oauth.ts (2)
24-85: LGTM!
175-175: LGTM!Also applies to: 186-186, 200-200, 211-211
web/default/src/features/auth/lib/oauth-callback-mode.ts (1)
1-11: LGTM!web/default/src/features/auth/lib/oauth-callback-mode.test.ts (1)
1-105: LGTM!web/default/src/routes/oauth/$provider.tsx (1)
31-35: LGTM!dto/openai_request.go (1)
93-93: LGTM!Also applies to: 112-119, 235-241, 902-914
dto/openai_request_zero_value_test.go (1)
4-4: LGTM!Also applies to: 54-102, 169-193
service/openaicompat/chat_to_responses.go (1)
389-390: LGTM!service/openaicompat/responses_request_to_chat.go (1)
66-66: LGTM!service/openaicompat/responses_compat_test.go (1)
47-71: LGTM!relay/channel/deepseek/adaptor.go (1)
71-72: LGTM!Also applies to: 163-189
relay/channel/deepseek/adaptor_test.go (1)
12-53: LGTM!service/tiered_settle.go (3)
4-11: LGTM!
110-132: 🗄️ Data Integrity & IntegrationNo change needed.
No repository reader relies on
TieredBillingSnapshot.GroupRatioorEstimatedQuotaAfterGrouppreserving frozen pre-consume values.
155-165: 🗄️ Data Integrity & IntegrationNo change needed for
FinalPreConsumedQuota.
NewBillingSessionalready writesrelayInfo.FinalPreConsumedQuotawith the session-backed pre-consumed quota afterpreConsumesucceeds, so the free-to-paid branch stays synchronized.> Likely an incorrect or invalid review comment.service/tiered_settle_test.go (1)
12-12: LGTM!controller/relay.go (2)
198-201: LGTM!
574-577: LGTM!
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@service/tiered_settle_test.go`:
- Around line 408-434: Add a test for PrepareTieredBillingForSelectedGroup using
a nil context, relayInfo.Billing set to nil, and a non-zero refreshed GroupRatio
to enter the missing-context branch. Assert that the returned error is a non-nil
*types.MaxAPIError, while preserving the existing tiered billing setup.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 5fca1d8e-c1ff-4a1a-876a-b2658901016b
📒 Files selected for processing (4)
service/tiered_settle_test.goweb/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.tsweb/default/src/routes/oauth/$provider.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: Backend checks
🧰 Additional context used
📓 Path-based instructions (6)
web/default/src/**/*.{ts,tsx}
📄 CodeRabbit inference engine (web/default/AGENTS.md)
web/default/src/**/*.{ts,tsx}: 前端页面文本与组件内文案必须支持 i18n:React 组件中应使用useTranslation()取得t,并通过t()渲染用户可见文本;子组件也应自行使用useTranslation()保持独立性。
禁止使用两层及以上嵌套三元表达式;复杂逻辑应改用if-else、提前返回或抽取函数。
控制函数圈复杂度,复杂逻辑应拆成更小的函数;变量与函数命名应有意义并遵循驼峰等常规命名约定。
TypeScript 代码应避免使用any,优先使用具体类型或unknown;参数与返回值应显式标注类型;仅类型用途的导入应使用import type。
修改 TypeScript 或 TSX 代码后必须执行类型检查,并修复所有类型错误,不得遗留。
对象非必要不要解构,尤其是组件 props;优先直接使用props.xxx以保持代码清晰。
组件应使用函数式组件与 Hooks,遵循单一职责;组件 props 必须有明确类型(接口或类型别名)。
单文件超过约 200 行时应考虑拆分子组件或抽取自定义 Hooks;类型定义可与组件同文件或放在同模块的types中。
在 React 中应合理使用useMemo、useCallback、React.memo,避免在渲染路径中创建新对象或数组;必要时进行代码分割与动态import。
React Query 的数据获取应使用useQuery、变更应使用useMutation;每个查询需配置唯一queryKey,并在成功后对相关查询执行invalidateQueries;服务端错误应统一交给handleServerError。
Axios 请求应使用项目统一的api实例;GET 请求默认去重,特殊请求可显式关闭;认证与通用错误应在拦截器中统一处理。
服务端错误应统一使用handleServerError,展示层应使用toast.error等统一方式;文案需走 i18n;路由级错误应由errorComponent承接;表单错误应通过form.setError等方式映射到字段。
样式应以 Tailwind 工具类为主,动态类名使用cn()合并;非动态场景避免内联样式;响应式采用移动优先与 Tailwind 断点,主题与暗色模式通过 CSS 变量与dark:处理。
应使用语义化 HTML、正确关联label与输入、保证键盘可操作与合理焦点顺序;必要时添加 ARIA 属性,装饰性图标应使用aria-hidden="true"。
认证与权限应在路由与接口层校验;前后端都应做数据校验(如 Zod);敏感信息不得落前端存储;避免使用dangerouslySetInnerHTML;跨域与 Cookie 需配合withCredentials并按后端要求处理 CSRF。
组件测试应使用 React Testing Library,关注交互与行为,避免测试实现细节;关键流程可补充集成与 E2E 测试。
环境变量应通过.env读取,并使用VITE_前缀;代码中不得硬编码密钥。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.tsweb/default/src/routes/oauth/$provider.tsx
web/default/src/features/**/lib/**/*.ts
📄 CodeRabbit inference engine (web/default/AGENTS.md)
表单应使用 React Hook Form + Zod:在功能模块的
lib/下定义 schema,并用z.infer导出表单类型;useForm应配合@hookform/resolvers/zod进行校验。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.ts
web/default/src/features/**
📄 CodeRabbit inference engine (web/default/AGENTS.md)
功能模块应放在
src/features/<feature>/,并按需包含components/、lib/、hooks/、api.ts、types.ts、constants.ts等;通用组件应放在src/components/,通用工具与类型应放在src/lib/。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.tsweb/default/src/features/auth/lib/oauth-callback-mode.ts
web/default/src/**/*.test.ts
📄 CodeRabbit inference engine (web/default/AGENTS.md)
工具函数与纯逻辑应优先编写单元测试;测试文件应命名为
*.test.ts。
Files:
web/default/src/features/auth/lib/oauth-callback-mode.test.ts
web/default/src/routes/**/*.{ts,tsx}
📄 CodeRabbit inference engine (web/default/AGENTS.md)
路由应使用 TanStack Router,并通过
createFileRoute定义;搜索参数应使用 Zod schema +validateSearch校验;认证与重定向应放在beforeLoad中;导航应优先使用useNavigate或Link,避免直接操作window.location。
Files:
web/default/src/routes/oauth/$provider.tsx
**/*.go
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.go: In Go business code, all JSON marshal/unmarshal operations must use the wrapper functions incommon/json.go(common.Marshal,common.Unmarshal,common.UnmarshalJsonStr,common.DecodeJson,common.GetJsonType) and must not directly callencoding/jsonfor actual encode/decode work.
All database code must be compatible with SQLite, MySQL 5.7.8+, and PostgreSQL 9.6+; prefer GORM abstractions over raw SQL, avoid directAUTO_INCREMENT/SERIAL, usecommonGroupCol/commonKeyColandcommonTrueVal/commonFalseValfor DB-specific SQL, branch withcommon.UsingPostgreSQL/common.UsingSQLite/common.UsingMySQL, avoid unsupported DB-specific functions/operators without fallback, and make migrations work across all three databases.
When implementing a new relay channel, confirm whether the provider supportsStreamOptions; if it does, add that channel tostreamSupportedChannels.
For request structs parsed from client JSON and re-marshaled to upstream providers, optional scalar fields must use pointer types withomitemptyso explicit zero/false values are preserved instead of dropped.
When working on tiered/dynamic billing expression code, readpkg/billingexpr/expr.mdfirst and follow its documented expression language, architecture, token normalization, quota conversion, and versioning patterns.
**/*.go: All JSON marshal/unmarshal operations in Go business code must use the wrapper functions incommon/json.go(common.Marshal,common.Unmarshal,common.UnmarshalJsonStr,common.DecodeJson,common.GetJsonType) instead of directly importing or callingencoding/jsonfor actual marshal/unmarshal work.
All database code in Go must remain compatible with SQLite, MySQL >= 5.7.8, and PostgreSQL >= 9.6; prefer GORM abstractions, avoid raw SQL unless necessary, use the shared DB helper variables for reserved words and boolean literals, branch with thecommon.UsingPostgreSQL/common.UsingSQLite/common.UsingMySQLflags when need...
Files:
service/tiered_settle_test.go
🔇 Additional comments (5)
web/default/src/features/auth/lib/oauth-callback-mode.ts (1)
1-15: LGTM!Also applies to: 17-23
web/default/src/features/auth/lib/oauth-callback-mode.test.ts (1)
1-45: LGTM!Also applies to: 47-108, 110-149
web/default/src/routes/oauth/$provider.tsx (1)
19-49: LGTM!Also applies to: 76-89, 236-246
service/tiered_settle_test.go (2)
13-13: LGTM!
396-444: 🎯 Functional CorrectnessNo change needed for the bare test context.
PreConsumeBillingonly passesctoNewBillingSession; it does not dereferencec.Request,c.Writer, orc.ClientIP.> Likely an incorrect or invalid review comment.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Important
📝 变更描述 / Description
(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
🚀 变更类型 / Type of change
🔗 关联任务 / Related Issue
✅ 提交前检查项 / Checklist
Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。📸 运行证明 / Proof of Work
(请在此粘贴截图、关键日志或测试报告,以证明变更生效)