refactor(gateway): one owner for the trailing-slash trim - #3047
Conversation
…w-up) The LiteLLM production audit added the same inline expression at ten sites across seven files (openai, embedding, readiness probe, realtime x2, rerank, stt x2, tts x2). They route through trimTrailingSlash in config.ts now, next to the other URL helpers, so the rule has a single owner. Behavior is identical by construction — the helper IS the expression — and it stays package-internal (not re-exported from index.ts), so the root package surface is unchanged. Coverage: a dedicated helper suite pins both branches plus the doubled-slash and empty-string edges, and openai-adapter.test.ts gains the no-slash branch beside its existing trim pin. Blast-radius proof re-run on this rebase: replacing the helper body with an unconditional slice(0, -1) turns 13 tests across 8 files red, restored by exact inverse. 1047/1047, tsc across three packages, eslint, prettier, sonar PASS. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Warning Review limit reached
Next review available in: 58 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: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
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 |
|



Summary
The LiteLLM production audit fixed a real 404 (a base URL ending in
/produced//chat/completions) by adding the same inline expression —x.endsWith("/") ? x.slice(0, -1) : x— at ten sites across seven files: the openai and embedding adapters, the readiness probe, and the realtime, rerank, speech-to-text and text-to-speech adapters (the last four carry two each). CodeRabbit counted seven on #3042; the sweep found ten.They now route through
trimTrailingSlashinconfig.ts, beside the other URL helpers, so the normalization rule has a single owner.Two deliberate choices:
normalizeBaseUrlandvalidateBaseUrlare untouched; this is not a normalizer.index.ts), so the root package-surface contract is unchanged. Only adapters inside the package need it.Verification
openai-adapter.test.tsgains the no-slash branch beside its existing trim pin.slice(0, -1)turns 13 tests across 8 files red — before, the same sabotage at one inline site would have failed only that site's own test. Restored by exact inverse afterwards.tsc -bacross three packages, repo ESLint, prettier,npm run gates:sonarPASS.Update-Impact
Pure refactor: no behavioral change, no surface change, no migration.
🤖 Generated with Claude Code