Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the validation schemas by splitting the monolithic src/shared/validation/schemas.ts file into multiple modular schema files under a new schemas/ directory. The main schemas.ts file now acts as a barrel file, re-exporting all schemas. Feedback on these changes highlights the need to add or update corresponding unit tests under the tests/ directory to comply with the repository style guide's requirement for testing production code changes. Additionally, several of the newly created schema files contain unused imports from @/shared/constants/... and @/shared/utils/... that should be cleaned up to maintain codebase cleanliness.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| }); | ||
|
|
||
| export type ConfirmedAccount = z.infer<typeof confirmedAccountSchema>; | ||
| export * from "./schemas/auth.ts"; |
There was a problem hiding this comment.
According to Rule 9 of the Repository Style Guide, tests must always be included when changing production code under src/. Since this PR refactors and modularizes the schemas, please ensure that corresponding unit tests are added or updated under the tests/ directory to verify the modularized schemas.
References
- Always include tests when changing production code (src/, open-sse/, electron/, bin/).
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
There was a problem hiding this comment.
Only ROUTING_STRATEGY_VALUES and MAX_TIMER_TIMEOUT_MS are used in this file. Please remove the other unused imports to keep the codebase clean and maintainable.
import { ROUTING_STRATEGY_VALUES } from "@/shared/constants/routingStrategies";
import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts";| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
There was a problem hiding this comment.
Only isForbiddenUpstreamHeaderName and isForbiddenCustomHeaderName are used in this file. Please remove the other unused imports to keep the codebase clean and maintainable.
| import { | |
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | |
| ROUTING_STRATEGY_VALUES, | |
| } from "@/shared/constants/routingStrategies"; | |
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | |
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | |
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | |
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | |
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | |
| import { | |
| isForbiddenUpstreamHeaderName, | |
| isForbiddenCustomHeaderName, | |
| } from "@/shared/constants/upstreamHeaders"; | |
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; | |
| import { | |
| isForbiddenUpstreamHeaderName, | |
| isForbiddenCustomHeaderName, | |
| } from "@/shared/constants/upstreamHeaders"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
| import { | ||
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | ||
| ROUTING_STRATEGY_VALUES, | ||
| } from "@/shared/constants/routingStrategies"; | ||
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | ||
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | ||
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | ||
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | ||
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | ||
| import { | ||
| isForbiddenUpstreamHeaderName, | ||
| isForbiddenCustomHeaderName, | ||
| } from "@/shared/constants/upstreamHeaders"; | ||
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; |
There was a problem hiding this comment.
Only ACCOUNT_FALLBACK_STRATEGY_VALUES, MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB, COMBO_CONFIG_MODES, and HIDEABLE_SIDEBAR_ITEM_IDS are used in this file. Please remove the other unused imports to keep the codebase clean and maintainable.
| import { | |
| ACCOUNT_FALLBACK_STRATEGY_VALUES, | |
| ROUTING_STRATEGY_VALUES, | |
| } from "@/shared/constants/routingStrategies"; | |
| import { SUPPORTED_BATCH_ENDPOINTS } from "@/shared/constants/batchEndpoints"; | |
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | |
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | |
| import { providerAllowsOptionalApiKey } from "@/shared/constants/providers"; | |
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; | |
| import { | |
| isForbiddenUpstreamHeaderName, | |
| isForbiddenCustomHeaderName, | |
| } from "@/shared/constants/upstreamHeaders"; | |
| import { MAX_TIMER_TIMEOUT_MS } from "@/shared/utils/runtimeTimeouts"; | |
| import { ACCOUNT_FALLBACK_STRATEGY_VALUES } from "@/shared/constants/routingStrategies"; | |
| import { MAX_REQUEST_BODY_LIMIT_MB, MIN_REQUEST_BODY_LIMIT_MB } from "@/shared/constants/bodySize"; | |
| import { COMBO_CONFIG_MODES } from "@/shared/constants/comboConfigMode"; | |
| import { HIDEABLE_SIDEBAR_ITEM_IDS } from "@/shared/constants/sidebarVisibility"; |
…gosouzapw#3691) Integrated into release/v3.8.23
Integrated into release/v3.8.23
…iegosouzapw#3689) Integrated into release/v3.8.23
…ution (diegosouzapw#3692) Integrated into release/v3.8.23
Integrated into release/v3.8.23
Integrated into release/v3.8.23
…osouzapw#3685) (diegosouzapw#3702) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…osouzapw#3696) (diegosouzapw#3703) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
…souzapw#3660) Integrated into release/v3.8.23
…API (diegosouzapw#3712) Integrated into release/v3.8.23. Vertex dynamic model discovery — surfaces image models (imagen-*, gemini-*-image), embeddings and audio from the live Generative Language catalog, with cached→static fallback and the shared parseGeminiModelsList helper. Validated: parser test 5/5, typecheck:core clean.
Integrated into release/v3.8.23. Makes the diegosouzapw#3588 reasoning token buffer safe and configurable: only inflates max_tokens when the model has a known, non-default output cap and the buffered value fits inside it; otherwise preserves/clamps the client limit. Adds the reasoningTokenBufferEnabled kill switch (default ON). Validated: combo-routing-engine 81/81, combo-config 25/25, combo-quality-validator-reasoning 12/12, phase1f 10/10, typecheck:core clean.
…3408 LOC (-654) (diegosouzapw#3717) Phase 1g-1j of diegosouzapw#3501: client 4062→3408 LOC. Pure extraction (ProviderPlaygroundPanel, useCommandCodeAuth, useExternalLinkFlow+ExternalLinkModal, useAuthFileHandlers) + loadConnProxies ReferenceError fix + phase1f test path fix. Co-authored-by: oyi77 <14921983+oyi77@users.noreply.github.com>
…2553 LOC (-855) (diegosouzapw#3721) Phase 1k-1m of diegosouzapw#3501: client 3408→2553 LOC. Pure extraction (useModelImportHandlers+ImportProgressModal, useModelVisibilityHandlers, ProviderModelsSection). Co-authored-by: oyi77 <14921983+oyi77@users.noreply.github.com>
… release branch The fix itself reached main pre-tag via cherry-pick diegosouzapw#3591, but its changelog bullet (commit e33fdd4) only ever existed on release/v3.8.20 after the squash-merge. Restored under [3.8.20] per the 2026-06-12 release-branch leftover audit (_tasks/release-audit/release-leftovers-audit-2026-06-12.md).
…rofileArn (diegosouzapw#3722) Integrated into release/v3.8.23
…1376 LOC (-1177) (diegosouzapw#3725) Phase 1n-1s of diegosouzapw#3501: client 2553→1376 LOC. Pure extraction (ConnectionsListPanel, ConnectionsHeaderToolbar, ZedImportCard, BatchTestResultsModal, AdaptaTutorialModal, useApiKeySave + helpers). Co-authored-by: oyi77 <14921983+oyi77@users.noreply.github.com>
…cation, and success-decay recovery (diegosouzapw#3629) Integrated into release/v3.8.23
… LOC (≤800 TARGET REACHED ✅) (diegosouzapw#3727) Phase 1t of diegosouzapw#3501: client 1376→781 LOC (≤800 reached). Original god-component 12,882→781 (−94%). Co-authored-by: oyi77 <14921983+oyi77@users.noreply.github.com>
…opencode' CLI command (diegosouzapw#3726) Integrated into release/v3.8.23
…w#3724) Integrated into release/v3.8.23
…egosouzapw#3288) (diegosouzapw#3723) Integrated into release/v3.8.23
… every chatHelpers import diegosouzapw#3692 added a lazy 'await import(proxyEgress)' for egress-IP visibility inside safeLogEvents, which is a sync function — an ES syntax error. It went unnoticed because typecheck:core does not cover src/sse and no test in the merge gates loaded chatHelpers via tsx; any consumer that did (chat-context-relay and chat-route-coverage suites, integration harnesses) failed at module load with 'await can only be used inside an async function'. safeLogEvents is fire-and-forget logging with an outer try/catch, so making it async (and 'void'-ing the single chat.ts call site) preserves behavior exactly. Validation: tests/unit/chat-context-relay.test.ts + chat-route-coverage.test.ts went from failing-at-load to green (+14 tests destravados).
… + combo/proxy audit fixes (diegosouzapw#3699) Integrated into release/v3.8.23
…ops 403ing (diegosouzapw#3728) Integrated into release/v3.8.23
… auto-hide (diegosouzapw#3729) Integrated into release/v3.8.23
- extracted Zod validation schemas into 16 domain files (auth, combo, keys, settings, pricing, proxy, provider, payloadRules, routing, apiV1, gemini, cli, evals, translator, cloud, misc) - schemas.ts is now a facade re-exporting modules
b515332 to
0000a71
Compare
…s.ts with facade and add unit tests
Code Review SummaryStatus: Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNINGUnused imports in modularized schema files (lines 3-4 of each file):
Note: Positive Observations
Files Reviewed (18 files)
Reviewed by laguna-m.1-20260312:free · 4,691,792 tokens |
|
Thanks @oyi77 for the modularization work on
What would let this land: re-cut it as a single, independent PR branched from the current |
This PR addresses the final "Medium Priority" file from Issue #3594 by modularizing `src/shared/validation/schemas.ts` (2,506 lines).
The monolithic schema file has been split into 16 clean domain-focused files under `src/shared/validation/schemas/`, while maintaining backward compatibility with a 1-line facade re-exporting the modules in `src/shared/validation/schemas.ts`.
Changes:
Fixes #3594