⚡ Bolt: Optimize ERD column name resolution - #850
Conversation
- Add `parseColumnNameFromHandle` for O(1) decoding - Update exports (DBML, DDL, Dictionary, Mermaid) to avoid O(N) column matching loops - Fix DBML decoding fallback logic
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning Review limit reached
Next review available in: 44 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: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthrough엣지 핸들에서 원본 컬럼명을 파싱하는 함수를 추가했습니다. DBML, Mermaid, 데이터 사전 내보내기는 파싱된 컬럼명을 사용합니다. 관련 테스트는 비동기 렌더링 완료를 기다리도록 수정했습니다. ChangesERD 핸들 기반 컬럼 처리
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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 `@frontend/src/erd/dbml.ts`:
- Around line 93-99: In the relationship tests for the DBML generator, add a
focused case using encoded handles src-c-0075-0073-0065-0072-005f-0069-0064 and
tgt-c-0069-0064, and assert the generated output is Ref: posts.user_id >
users.id. Keep the existing legacy-handle coverage unchanged so this test
specifically verifies encoded handles are decoded into DBML column names.
In `@frontend/src/erd/export.ts`:
- Around line 70-78: Update exportDDL and fkColumnsForEdge so each node’s
column_name values are collected into Map/Set structures once at export start,
then replace the per-edge source/target .some membership checks with O(1)
lookups while preserving null handling for missing columns.
In `@frontend/src/erd/handleUtils.ts`:
- Around line 41-43: Validate every segment in the handle decoder before calling
parseInt or String.fromCodePoint, rejecting any segment that is not a complete
hexadecimal string and returning null. In frontend/src/erd/handleUtils.ts lines
41-43, update the decoding logic accordingly; in
frontend/src/erd/handleUtils.test.ts lines 39-72, add focused regression cases
confirming malformed handles such as partial or invalid hex segments return null
rather than a column name.
🪄 Autofix
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: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 4d547b85-1d00-4469-93a3-8ef606c76aa5
📒 Files selected for processing (8)
.jules/bolt.mdfrontend/src/App.coverage.test.tsxfrontend/src/erd/dbml.tsfrontend/src/erd/export.tsfrontend/src/erd/exportDataDictionary.tsfrontend/src/erd/handleUtils.test.tsfrontend/src/erd/handleUtils.tsfrontend/src/erd/mermaid.ts
- Add `parseColumnNameFromHandle` for O(1) decoding - Update exports (DBML, DDL, Dictionary, Mermaid) to avoid O(N) column matching loops - Fix DBML decoding fallback logic
|
@coderabbitai review Please review exact head |
|
|
|
Exact-current-head independent review request for @opencode-agent @cwl-noema-review Please provide a formal non-author verdict. CI, Security Scan, and SAST Semgrep are terminal-success; all four prior review threads are resolved; focused 49, full frontend 209, typecheck, and production build were reported passing. Re-verify rather than transferring predecessor evidence. Do not mutate or merge. |
💡 What
Introduced an O(1)
parseColumnNameFromHandleutility to directly parse and decode column names embedded in React Flow edge handle IDs (which are hex-encoded strings likec-0069-0064). Updatedexport.ts,dbml.ts,exportDataDictionary.ts, andmermaid.tsto decode edge handles locally in O(1) rather than performing O(E*C) lookups (where it iterates over all columns of a node just to map a handle back to a string).🎯 Why
Graph exporters previously relied on iterative
.find()lookups andsourceColumnHandleId/targetColumnHandleIdencoding steps in loops across all edges and columns. This created O(E*C) bottlenecks. Direct decoding removes unnecessary iteration and allocations. Indbml.ts, the previous simplereplace('src-', '')fallback leaked hex-encoded handles into DBML schemas. The new decoder correctly renders the original schema column strings.📊 Impact
Reduces export lookup complexity from O(E * C) to O(E), improving performance when generating DBML, Mermaid, and Dictionary exports on large diagrams. Directly generating original table column names in DBML correctly avoids emitting unparsed
c-...handles for explicitly drawn UI links.🔬 Measurement
All vitest suites pass (
frontend/src/erd/__tests__/dbml.test.ts,coverageEdges.test.ts, etc). Time complexity of column mapping insidefkColumnsForEdgeis now static.PR created automatically by Jules for task 4116336364886781330 started by @seonghobae
Summary by CodeRabbit
개선 사항
버그 수정
테스트
Exact-head remediation
Head
6ccaa690699ac0a336d6c51f6b38b3601897021ccloses every current review finding: malformed hexadecimal handles now fail closed, DBML has canonical encoded-handle regression coverage, DDL column membership is pre-indexed for O(N*C + E), and unused imports are removed. Test-first evidence: malformed partial-hex cases failed before the parser boundary and passed after full-segment validation. Focused: 49 passed; full frontend: 27 files / 209 tests passed; typecheck and production build passed.