Conversation
A top-level JSON array satisfies typeof object, so mergeConfigDefaults spread it into defaults and manufactured a schema-valid config — silently discarding the original file with no backup. Guard the repair path so only object-shaped configs are merged; every other JSON value takes the invalid-file backup path.
|
✅ Deterministic PR hygiene checks passed. |
✅ READY
Review readiness checklist
✅ 4/4 boxes ticked. This pull request is already Ready for Review. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: lidge-jun/opencodex/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthrough
ChangesConfiguration validation
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix 🚥 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 |
리뷰 · 우선순위 67 / 80이 PR은 예전에는 JSON이 파싱만 되면 이번 변경은 스키마 실패 직후, 수리(merge)로 들어가기 전에 한 줄을 더 본다. 테스트는 라인 - 라인 - 라인 - PR 상태: draft이고 readiness 체크리스트가 0/4다. tip 기준 핵심 테스트 CI도 아직 거의 안 보인다. 머지 판단은 ready 전환 + exact-head 초록 뒤에 하면 된다. 메인테이너의 판단이 필요한 지점 가드를 sanitize 앞으로 옮길지(가독성·방어 순서), 아니면 지금처럼 “스키마 실패 후 수리 직전”에 둘지. draft 체크리스트·CI를 머지 블로커로 볼지(보통은 ready 후에 보면 된다). 데이터 유실 버그라 우선순위는 낮지 않다. 너의 추천 원인(배열이 이 댓글은 grok-bot이 작성했습니다 |
|
The exact-head change is correct and appropriately narrow: only plain object-shaped JSON enters repair/salvage, while primitives, arrays, and This head is now behind current |
|
Refreshed onto current dev via update-branch (head 50f154d) — the change itself is untouched, only the dev merge was added. Re-completed the readiness checklist; exact-head CI is running. |
|
Superseded by #5609, which is open and not yet merged. The non-object config backup (663e2a2) is reimplemented there with you as co-author. To keep |
Summary
config.jsoncontaining a top-level JSON array (e.g.[]) passedtypeof === "object", so the schema-fail repair path spread it into defaults and produced a schema-valid config. The original file was then treated as "repaired" — noconfig.json.invalid-*backup was written, so the operator's actual file content was unrecoverable once something else overwrote it.warnAndBackupInvalidConfig+ defaults), matching what already happened for malformed JSON.Verification
bun test tests/server/config.test.ts— 224 pass, including 5 new cases asserting a top-level number / boolean / string / array / null is backed up verbatim and falls back to defaults.bun x tsc --noEmit— clean.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