Skip to content

🎨 Palette: [UX improvement] ERD Auto Layout 개선 (Dagre 적용) - #716

Open
seonghobae wants to merge 68 commits into
mainfrom
jules-3578797244930525994-2c5c0eb4
Open

🎨 Palette: [UX improvement] ERD Auto Layout 개선 (Dagre 적용)#716
seonghobae wants to merge 68 commits into
mainfrom
jules-3578797244930525994-2c5c0eb4

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 2, 2026

Copy link
Copy Markdown
Collaborator

What

Replace the fixed four-column ERD grid with a maintained Dagre-based, relationship-aware layout engine.

  • supports deterministic left-to-right and top-to-bottom layouts;
  • accounts for node dimensions and foreign-key edges;
  • preserves existing coordinates when layout computation fails;
  • applies the same layout contract to imported snapshots and the explicit auto-layout action;
  • adds focused unit and workflow regression coverage;
  • records the buyer-visible capability in CHANGELOG.md.

Why

Large schemas were visually arranged without regard to dependencies, making reference flows harder to understand and increasing manual repositioning work. The new layout uses the relationship graph to produce a reviewable hierarchy while retaining keyboard and screen-reader semantics because it changes coordinates rather than interactive structure.

Validation

  • current-head frontend typecheck, complete coverage suite, and production build passed;
  • backend validation passed;
  • Security Scan and Semgrep passed;
  • the async snapshot-readiness race in the auto-layout regression was fixed deterministically;
  • temporary repair and planning artifacts were removed;
  • no unresolved review threads remain.

Auto-merge is enabled and awaits the repository-required independent current-head approval.

Summary by CodeRabbit

  • 새 기능
    • ERD가 노드와 연결 관계를 기반으로 자동 배치되어 더 읽기 쉬운 다이어그램을 제공합니다.
    • 가로·세로 방향의 자동 레이아웃을 지원합니다.
  • 버그 수정
    • 레이아웃 계산 실패나 잘못된 좌표 발생 시 기존 위치를 유지합니다.
    • 유효하지 않은 데이터베이스 주소와 로컬·내부망 접근을 차단합니다.
    • 프로젝트명과 상태 표시의 HTML 처리를 강화했습니다.
  • 테스트
    • 빈 다이어그램, 단일 노드, 연결되지 않은 노드 및 레이아웃 복원 동작 검증을 보강했습니다.

- dagre 패키지를 추가하여 방향성 계층 그래프 레이아웃 엔진 적용
- 기존의 단순 그리드(grid) 배치(snapshotToGraph)에서 dagre 기반 배치(computeDagreLayout)로 로직 대체
- dagreLayout unit test 추가
@google-labs-jules

Copy link
Copy Markdown

👋 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 5 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 47cb1419-c88f-4b34-b7ce-c7749519de81

📥 Commits

Reviewing files that changed from the base of the PR and between 413ac4c and e240b27.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (12)
  • .jules/sentinel.md
  • CHANGELOG.md
  • backend/tests/test_production_tls_config.py
  • compose.prod.yaml
  • deploy/traefik/dynamic.yaml
  • docs/doctoring.md
  • docs/production-deployment.md
  • frontend/package.json
  • frontend/src/App.coverage.test.tsx
  • frontend/src/api.redirect-security.test.ts
  • frontend/src/api.ts
  • frontend/src/erd/dagreLayout.test.ts
📝 Walkthrough

Walkthrough

Dagre 기반 ERD 자동 레이아웃을 추가했습니다. ERD 변환과 앱 자동 정렬이 새 레이아웃을 사용합니다. DSN 내부 주소 차단과 프로젝트명 HTML 정제를 적용했습니다. 관련 테스트와 패키지 버전을 갱신했습니다.

Changes

ERD 자동 레이아웃

Layer / File(s) Summary
Dagre 레이아웃 엔진
frontend/src/erd/dagreLayout.ts, frontend/src/erd/dagreLayout.test.ts
computeDagreLayout이 노드와 엣지를 Dagre 그래프로 변환합니다. 방향별 좌표를 계산하고 유효하지 않은 결과에는 기존 위치를 사용합니다. 테스트는 배치, 방향, 결정성, 입력 보존을 검증합니다.
ERD 변환 연결
frontend/src/erd/convert.ts, frontend/package.json
ERD 변환이 초기 노드와 외래 키 엣지를 Dagre 레이아웃에 전달합니다. @dagrejs/dagre와 관련 패키지 버전을 갱신했습니다.
앱 자동 정렬과 검증
frontend/src/App.tsx, frontend/src/App.coverage.test.tsx, .jules/palette.md
앱의 제목순 그리드 정렬을 Dagre 정렬로 교체했습니다. 렌더링 실패를 오류 경로로 전달하고 비동기 완료 및 위치 복원 테스트를 갱신했습니다.

입력 및 출력 보안 검증

Layer / File(s) Summary
DSN 및 프로젝트명 처리 강화
frontend/src/App.tsx, .jules/sentinel.md
DSN 검증이 클라우드 메타데이터, 내부, 사설, 루프백, 링크 로컬 주소를 차단합니다. 프로젝트명 렌더링에 sanitizeHtml을 적용했습니다. 변경 내용을 보안 기록에 추가했습니다.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant App
  participant computeDagreLayout
  participant Dagre
  User->>App: 자동 정렬 실행
  App->>computeDagreLayout: nodes와 edges 전달
  computeDagreLayout->>Dagre: 그래프와 레이아웃 옵션 전달
  Dagre-->>computeDagreLayout: 노드 좌표 반환
  computeDagreLayout-->>App: 좌표 변환 또는 기존 위치 반환
  App-->>User: 정렬된 ERD 렌더링
Loading

Possibly related PRs

Suggested labels: dependencies, javascript

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 Dagre를 적용한 ERD 자동 레이아웃 개선이라는 변경의 핵심 내용을 명확하게 설명합니다.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-3578797244930525994-2c5c0eb4

Comment @coderabbitai help to get the list of available commands.

- dagre 패키지를 추가하여 방향성 계층 그래프 레이아웃 엔진 적용 (package.json / pnpm-lock.yaml 추가)
- 기존의 단순 그리드(grid) 배치(snapshotToGraph)에서 dagre 기반 배치(computeDagreLayout)로 로직 대체
- dagreLayout unit test 추가
- App.coverage.test.tsx의 Vitest 비동기 timeout 문제 해결 및 test 단언문 수정

Copy link
Copy Markdown
Collaborator Author

@jules Please repair this PR and push a focused follow-up commit:

  1. This repository uses npm (frontend/package-lock.json, CI runs npm ci). Delete the newly added frontend/pnpm-lock.yaml and regenerate/update frontend/package-lock.json so it is exactly synchronized with package.json.
  2. Replace the seven-year-old dagre@0.8.5 plus @types/dagre pair with the maintained @dagrejs/dagre package, which ships its own TypeScript declarations. Update imports and the npm lockfile accordingly; do not keep duplicate/obsolete Dagre packages.
  3. Strengthen dagreLayout.test.ts: cover empty input, one node, disconnected nodes, a directed chain in both LR and TB, finite/non-overlapping positions, preservation of IDs/data and input immutability, and deterministic output for identical input. Assert directional ordering rather than only not.toBeNull().
  4. Keep snapshotToGraph contract tests intact and prove FK-directed layout does not alter edge contents or node data. Handle missing/non-finite Dagre coordinates defensively rather than throwing an opaque property-access error.
  5. Remove stale/unused grid-layout imports after deleting computeSortedGridLayout. Prefer a normal static import unless code-splitting is intentionally measured; do not claim a circular dependency where only a type import exists.
  6. Keep the existing undo behavior and add/retain a focused auto-layout test that verifies layout completion and undo restore the exact prior positions.
  7. Preserve .jules/palette.md history and append only the new entry with the correct 2026-08-02 date.
  8. Run npm ci, typecheck, the full frontend tests with coverage, and build before pushing. The current CI failure is specifically the npm lockfile mismatch.

Copy link
Copy Markdown
Collaborator Author

@jules CI의 frontend Install 단계가 npm ci에서 실패합니다. frontend/package.json에 추가한 dagre@^0.8.5@types/dagre@^0.7.54frontend/package-lock.json에 반영되지 않았습니다. 현재 브랜치에서 Node 26/npm 11 기준으로 package-lock을 재생성해 package.json, package-lock.json, pnpm-lock.yaml의 의존성을 일치시키고 커밋해 주세요. 그 뒤 npm ci, typecheck, 전체 frontend test/coverage, build를 실행해 검증하세요. 기능 변경은 최소화하고 기존 Dagre 구현과 테스트는 유지하세요.

Copy link
Copy Markdown
Collaborator Author

@jules 정정: 직전 한국어 코멘트보다 2026-08-03 01:29 UTC의 상세 8개 항목 코멘트(#issuecomment-5161392410)를 우선 적용하세요. 즉 pnpm-lock.yaml은 삭제하고, 구형 dagre/@types/dagre 대신 @dagrejs/dagre 하나만 사용하며, 강화된 layout·immutability·determinism·undo 테스트와 방어적 좌표 처리를 포함해 npm lockfile을 재생성하십시오.

@seonghobae
seonghobae marked this pull request as draft August 3, 2026 04:00
auto-merge was automatically disabled August 3, 2026 04:00

Pull request was converted to draft

seonghobae and others added 4 commits August 3, 2026 04:21
- dagre 패키지를 추가하여 방향성 계층 그래프 레이아웃 엔진 적용 (package.json / pnpm-lock.yaml 추가)
- 기존의 단순 그리드(grid) 배치(snapshotToGraph)에서 dagre 기반 배치(computeDagreLayout)로 로직 대체
- dagreLayout unit test 추가
- App.coverage.test.tsx의 Vitest 비동기 timeout 문제 해결 및 test 단언문 수정

Copy link
Copy Markdown
Collaborator Author

@jules Repair the current branch so it uses the maintained typed @dagrejs/dagre package rather than dagre plus @types/dagre, removes the noncanonical frontend/pnpm-lock.yaml, regenerates frontend/package-lock.json, and keeps the existing layout behavior and regression tests. Validate with npm ci, typecheck, full coverage, and production build before pushing. Keep the PR draft until current-head checks pass.

@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 12:38

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/erd/dagreLayout.test.ts (1)

81-84: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

LR 및 TB chain의 실제 비겹침을 검증하세요.

현재 순서 비교는 좌표 차이가 1이어도 통과합니다. 이 경우 node rectangle은 겹칠 수 있습니다.

LR 테스트에서는 target과 source의 x 차이가 node width 280 이상인지 확인하세요. TB 테스트에서는 y 차이가 node height 80 이상인지 확인하세요. 두 테스트에서 모든 좌표가 유한한지도 확인하세요.

As per coding guidelines, "**/*.{py,ts,tsx}: Add or update focused tests when changing behavior."

Also applies to: 95-98

🤖 Prompt for 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.

In `@frontend/src/erd/dagreLayout.test.ts` around lines 81 - 84, Update the LR and
TB chain tests around computeDagreLayout to verify actual non-overlap: assert
the relevant target/source coordinate separation is at least the node width
(280) for LR and node height (80) for TB, rather than only comparing ordering.
Add assertions that every returned node coordinate is finite in both tests,
while preserving the existing layout expectations.

Source: Coding guidelines

🤖 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 @.jules/sentinel.md:
- Line 8: Update the SSRF identifier in the documentation entry for
isSupportedConnectionDsn() from CVE-918 to CWE-918, leaving the vulnerability
description unchanged.

In `@frontend/src/App.tsx`:
- Around line 109-144: Update the credential POST flow in createConnection to
use fetch with redirect handling that rejects redirects, preserving the existing
HTTPS validation from requireSecureCredentialTransport. Also configure TLS
termination for the production API in compose.prod.yaml and
deploy/traefik/dynamic.yaml so operational endpoints are served over HTTPS.
- Around line 109-144: Update the Snowflake connection flow around
_validated_ip_hosts() so its validated IP result is used as the actual
connection target instead of the original hostname passed as account. Preserve
the original hostname only for TLS/SNI when required, ensuring DNS rebinding
cannot redirect connections to private, loopback, or link-local addresses.

In `@frontend/src/erd/dagreLayout.test.ts`:
- Around line 48-70: 올바른 geometry fallback과 별도로 dagre.layout 예외 경로를 검증하는 테스트를
추가하세요. `computeDagreLayout`에서 사용하는 `@dagrejs/dagre`의 `layout`이 예외를 던지도록 mock하고,
모든 반환 노드의 position이 입력 노드 위치와 동일한지 단언하세요. 현재 `Number.isFinite` 기반 geometry
fallback 테스트는 그대로 유지하세요.

---

Outside diff comments:
In `@frontend/src/erd/dagreLayout.test.ts`:
- Around line 81-84: Update the LR and TB chain tests around computeDagreLayout
to verify actual non-overlap: assert the relevant target/source coordinate
separation is at least the node width (280) for LR and node height (80) for TB,
rather than only comparing ordering. Add assertions that every returned node
coordinate is finite in both tests, while preserving the existing layout
expectations.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5292afb2-f2af-435b-ac35-ca91fa162d34

📥 Commits

Reviewing files that changed from the base of the PR and between de7579c and 413ac4c.

⛔ Files ignored due to path filters (1)
  • frontend/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (7)
  • .jules/palette.md
  • .jules/sentinel.md
  • frontend/package.json
  • frontend/src/App.coverage.test.tsx
  • frontend/src/App.tsx
  • frontend/src/erd/dagreLayout.test.ts
  • frontend/src/erd/dagreLayout.ts
🚧 Files skipped from review as they are similar to previous changes (3)
  • frontend/package.json
  • frontend/src/App.coverage.test.tsx
  • .jules/palette.md

Comment thread .jules/sentinel.md Outdated
Comment thread frontend/src/App.tsx
Comment thread frontend/src/erd/dagreLayout.test.ts Outdated
@opencode-agent
opencode-agent Bot disabled auto-merge August 4, 2026 07:19

Copy link
Copy Markdown
Collaborator Author

@opencode-agent @cwl-noema-review Please independently review exact current head 392b6790a39d1dd415c0c3e899f8010adb62649c after current-head CI, Security Scan, and SAST Semgrep complete. All inline review threads are resolved. Verify deterministic LR/TB Dagre layout, actual rectangle non-overlap, immutable inputs, exception/incomplete-geometry position preservation, exact undo restoration, snapshot readiness race handling, TLS/redirect and Snowflake DNS-pinning hardening included in the current tree, removal of temporary repair artifacts, and CHANGELOG accuracy. Submit APPROVE only for this exact head if no blocker remains.

@seonghobae
seonghobae enabled auto-merge (squash) August 4, 2026 12:16
Comment thread .github/workflows/pr-716-final-cleanup.yml Fixed
Comment thread .github/workflows/pr-716-final-cleanup.yml Fixed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants