fix(command-code): guard own-property model lookups - #1184
Conversation
📝 WalkthroughWalkthroughCommand Code model IDs now use centralized canonicalization. Reasoning-effort lookup and profile refresh accept only own properties of the known-efforts table. Tests cover ChangesCommand Code model handling
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
2/4 boxes ticked. This PR stays in draft until every box above is ticked. |
|
@coderabbitai review |
✅ Action performedReview finished.
|
cc01ba0 to
a2eda3b
Compare
|
Approved the pending Cross-platform CI run at this exact head so it can actually execute — To be clear about what that does and doesn't do: it only unblocks CI. It does not make this mergeable. The four-box readiness checklist is your attestation, not something a maintainer ticks for you, and the gate keeps the PR in draft until you complete it. Once CI comes back green, tick the boxes and it moves to ready on its own. If the run comes back red, tell me and I'll dig into it rather than leaving you to guess. |
Summary
__proto__,constructor, andtoStringas literal provider model IDs.Why
These tables are ordinary JavaScript objects. Direct bracket lookup can read properties inherited from
Object.prototype, so a provider model ID with one of those names may be replaced, treated as a profile object, or throw instead of passing through literally.The patch keeps the existing tables and compatibility aliases; it only makes the lookup boundary explicit with
Object.hasOwn.Verification
tests/command-code-provider.test.ts23/23 passed, 58 assertions.5f65d3785): the same suite 23/23 passed, 58 assertions.bun x tsc --noEmit: passed.bun scripts/privacy-scan.ts: passed.git diff --check: passed.tests/api-storage-policy-run.test.tsunder Bun 1.3.14. An A-B-A single-file comparison produced branch crash / clean-dev pass / branch pass, so this PR does not claim a green full-suite result.Checklist
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
All CI tests are green on my local testing.
I pushed my PR to the latest dev commit.
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit
Bug Fixes
Tests