fix(providers): harden discovery contract cleanup - #743
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
📝 WalkthroughWalkthroughDiscovery validation rejects backslashes and normalized parent-directory traversal segments. Tests now share scoped registry discovery overrides that restore registry state and clear model caches before and after execution. ChangesDiscovery validation and test infrastructure
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ebe0bdb60
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@src/providers/model-discovery.ts`:
- Line 93: Update the discovery-path validation near the existing parent-segment
guard in resolveProviderModelDiscoveryUrl to reject URL-equivalent encoded dot
segments such as %2e%2e and backslash-based traversal before constructing the
URL. Add regression cases in tests/provider-model-discovery-contract.test.ts
lines 70-74 covering both encoded traversal and backslash traversal inputs.
In `@tests/helpers/provider-registry-discovery.ts`:
- Around line 17-30: Update the temporary override flow around
entry.modelDiscovery in the provider registry helper to call
clearModelCache(providerId) before applying the override, ensuring run() cannot
reuse a cached model result. Keep the existing clearModelCache(providerId) call
in finally for cleanup after restoring the original registry settings.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 180c8aaf-399e-4115-aa9e-9429e7a09728
📒 Files selected for processing (4)
src/providers/model-discovery.tstests/helpers/provider-registry-discovery.tstests/provider-connection-test.test.tstests/provider-model-discovery-contract.test.ts
3ebe0bd to
5356e23
Compare
|
Review follow-up is complete in Verification:
The three full-suite failures are existing failures on the new
No unrelated baseline fixes were added to this provider-contract PR. |
|
LAND-AFTER + NEEDS-SECURITY-REVIEW The production surface here is genuinely small — four lines at The security review requirement is not about the size of the diff. To be clear about scope: this hardens the shared discovery contract from #572 but does not close that umbrella, and the PR body saying "Relates to #572" is accurate. What happens next: no code change requested. The PR waits on explicit security review, then lands after the release blockers. CI context (shared across the current review round). |
Summary
..segmentThis is a focused follow-up to the contract merged in #652 and to review findings surfaced on #653.
Relates to #572. This PR does not close the umbrella issue.
Verification
bun run typecheckbun run privacy:scanSummary by CodeRabbit
Bug Fixes
Tests