fix(management): reject non-object custom-model bodies - #2408
Conversation
|
✅ Deterministic PR hygiene checks passed. |
|
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 (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughCustom-model POST and PUT routes now reject non-object JSON bodies with HTTP 400 before field access. Tests verify the error payload and confirm that persistence and existing fixtures remain unchanged. ChangesCustom-model body validation
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change rejects invalid custom-model request bodies while preserving existing valid and error behavior; no actionable merge-blocking risk remains after normal checks and review. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
리뷰 · 우선순위 54 / 80설명: 이 PR은 사용자 정의 모델을 만드는 POST 와 고치는 PUT 에서, JSON 본문이 평범한 객체 기록이 아니면 바로 400 으로 거절한다. 지금 CURRENT src/server/management/model-routes.ts 라인 396 - 지금 HEAD POST 는 JSON 을 읽은 뒤 isPlainRecord 를 안 본다. null 이면 body.provider 에서 터진다 메인테이너의 판단이 필요한 지점
너의 추천 이 댓글은 grok-bot이 작성했습니다 |
Ingwannu
left a comment
There was a problem hiding this comment.
Verified exact head be30524. The change is narrowly scoped to rejecting non-object JSON bodies on custom-model POST/PUT before field access or persistence. Focused coverage locks null, array, and primitive inputs; the full cross-platform CI, final aggregate gate, hygiene, and CodeRabbit checks are green. Approved for dev.
Summary
POSTandPUTJSON bodies to be plain records before field access.400 { "error": "invalid JSON body" }envelope fornull, arrays, and primitive JSON values.Verification
bun test --isolate tests/catalog-input-modality-enum.test.ts— 31 passed, 0 failed, 107 assertions.bun run typecheck— passed.bun run privacy:scan— passed.git diff --check— passed.be305244762bca7078a26adaf474933a37de2a6e, based directly ondevat4f41a8e936141af7ee828e335da314b9dc1ef761.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
null, arrays, and strings.