Skip to content

perf(frontend): preserve derived node-data identity during search - #693

Open
seonghobae wants to merge 45 commits into
mainfrom
bolt-react-flow-cache-5569281215077212328
Open

perf(frontend): preserve derived node-data identity during search#693
seonghobae wants to merge 45 commits into
mainfrom
bolt-react-flow-cache-5569281215077212328

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

What

Cache search-decorated TableNodeData objects in a WeakMap keyed by the original immutable data object. Reset the cache whenever the normalized query changes.

The same change also guards snapshot-polling continuations so an obsolete effect cannot update state after cleanup.

Why

While a canvas search is active, position-only React Flow updates previously rebuilt each node's decorated data object on every render. That defeats identity-based memoization in table-node subtrees and creates avoidable garbage during high-frequency interactions such as dragging.

Contracts

  • A stable source node.data object and stable query reuse the same decorated data reference.
  • Replacing source data or changing the normalized query produces a fresh decorated object.
  • Highlight and dim state continue to follow current search matches.
  • Snapshot results, snapshot-list refreshes, and errors are ignored after the polling effect is superseded or unmounted.

The required current-head frontend workflow must pass npm ci, typecheck, the complete 100%-coverage suite, and the production build before merge.


Originally created by Jules for task 5569281215077212328.

Summary by CodeRabbit

  • 성능 개선

    • 검색 결과의 노드 정보를 효율적으로 재사용해 드래그 중 불필요한 화면 재렌더링을 줄였습니다.
    • 노드 이동과 편집 시 화면 반응성이 향상되었습니다.
  • 버그 수정

    • 스냅샷을 불러오는 중 화면을 벗어나거나 요청이 겹칠 때 오래된 결과가 표시되는 문제를 개선했습니다.
    • 유효하지 않은 요청으로 인한 목록 덮어쓰기와 오류 표시를 방지했습니다.
    • 최신 스냅샷 요청이 완료된 후에도 이전 요청이 화면이나 자동 갱신 상태를 변경하지 않도록 개선했습니다.

@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 Jul 31, 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: 44 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: 1cbc7df1-a279-41d0-8d21-b434b59dc794

📥 Commits

Reviewing files that changed from the base of the PR and between a532d09 and a252569.

📒 Files selected for processing (7)
  • .github/pr-693-repair.py
  • .github/pr-693-workflow-probe.txt
  • .github/repair-pr-693-review-v2.trigger
  • .github/workflows/pr-693-address-review.yml
  • .github/workflows/pr-693-probe.yml
  • .github/workflows/pr-693-unblock-repair.yml
  • .github/workflows/repair-pr-693-review-v2.yml
📝 Walkthrough

Walkthrough

검색된 노드의 장식 데이터를 WeakMap으로 재사용합니다. 스냅샷 폴링은 현재 요청만 상태를 갱신합니다. 컴포넌트가 해제되면 폴링을 중지합니다. 관련 테스트와 CI 커버리지 수집을 추가합니다.

Changes

프론트엔드 상태 처리

Layer / File(s) Summary
파생 노드 데이터 캐싱
.jules/bolt.md, frontend/src/App.tsx, frontend/src/App.searchPolling.test.tsx, frontend/src/App.coverage.test.tsx
안정적인 node.data 참조를 기준으로 장식 데이터를 WeakMap에 캐시합니다. 검색 조건 변경과 원본 데이터 보존을 검증합니다.
스냅샷 폴링 요청 정리
frontend/src/App.tsx, frontend/src/App.pollingBranches.test.tsx, frontend/src/App.searchPolling.test.tsx, frontend/src/App.coverage.test.tsx
재귀적 setTimeout과 요청 유효성 검사로 오래된 응답의 상태 반영과 추가 폴링을 차단합니다. 언마운트와 오류 경로를 검증합니다.
Prisma 내보내기 및 UI 분기 검증
frontend/src/App.prismaExport.test.tsx, frontend/src/coverageGaps.test.tsx, frontend/src/erd/__tests__/prismaBranchCoverage.test.ts
Prisma 내보내기, 관계 분기, 편집 UI의 삭제·그룹 상호작용을 검증합니다.
커버리지 및 변경 내역 반영
.github/workflows/ci.yml, CHANGELOG.md, frontend/src/App.coverage.test.tsx
CI 테스트 명령을 커버리지 수집으로 변경합니다. 비동기 목록 로딩 검증을 보강하고 변경 내역을 기록합니다.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant App
  participant SnapshotAPI
  participant Timer
  App->>SnapshotAPI: 스냅샷 상태 요청
  SnapshotAPI-->>App: 상태 또는 오류 반환
  App->>App: 요청 유효성 확인
  App->>Timer: 유효한 요청이면 다음 폴링 예약
  App->>App: 완료 상태이면 목록 갱신 후 종료
Loading

Possibly related PRs

🚥 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 제목은 검색 중 파생 노드 데이터의 객체 정체성을 유지하는 핵심 변경을 정확하고 간결하게 설명합니다.
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 bolt-react-flow-cache-5569281215077212328

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

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head d02c380324b4383a37fd4522937e9508e747f12b.

  • Head SHA: d02c380324b4383a37fd4522937e9508e747f12b

  • Workflow run: 30670379507

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Changed file: bolt.md"]
  S1 --> I1["repository behavior"]
  I1 --> R1["Review risk: Changed file: bolt.md"]
  R1 --> V1["required checks"]
  Evidence --> S2["Frontend (2 files)"]
  S2 --> I2["browser runtime and bundle"]
  I2 --> R2["Review risk: Frontend (2 files)"]
  R2 --> V2["frontend tests"]
Loading

@opencode-agent

opencode-agent Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

OpenCode Review Overview

  • Head SHA: 0d19fde349f1c715f230faccaa152ff106690a03
  • Workflow run: 30822120818
  • Workflow attempt: 1
  • Gate result: REQUEST_CHANGES (approval step)

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 0d19fde349f1c715f230faccaa152ff106690a03.

  • Head SHA: 0d19fde349f1c715f230faccaa152ff106690a03

  • Workflow run: 30822120818

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: ci.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: ci.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (2 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (2 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Backend: uv.lock"]
  S3 --> I3["API and service runtime"]
  I3 --> R3["Review risk: Backend: uv.lock"]
  R3 --> V3["backend tests"]
  Evidence --> S4["Frontend (9 files)"]
  S4 --> I4["browser runtime and bundle"]
  I4 --> R4["Review risk: Frontend (9 files)"]
  R4 --> V4["frontend tests"]
Loading

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 3, 2026 01:00

Dismissed as stale: this review evaluated head d02c380, while the current head is daf0c5e and its CI, SAST Semgrep, and Security Scan workflow runs all completed successfully.

Refactored the WeakMap caching approach to adhere to React pure render rules, fixed an unmount bug in the snapshot polling hook, and removed the unintentionally generated pnpm-lock.yaml.
@seonghobae
seonghobae marked this pull request as draft August 3, 2026 01:04
@seonghobae
seonghobae marked this pull request as ready for review August 3, 2026 01:05
@seonghobae
seonghobae marked this pull request as draft August 3, 2026 01:12
@seonghobae
seonghobae marked this pull request as ready for review August 3, 2026 01:12
@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 01:15

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae seonghobae changed the title ⚡ Bolt: [React Flow WeakMap Cache for Derived State] perf(frontend): preserve derived node-data identity during search Aug 3, 2026
@seonghobae
seonghobae marked this pull request as draft August 3, 2026 03:52
auto-merge was automatically disabled August 3, 2026 03:52

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 3, 2026 03:53
@seonghobae
seonghobae enabled auto-merge (squash) August 3, 2026 03:53

@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: 2

🤖 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/App.tsx`:
- Around line 201-224: 프론트엔드 동작 변경에 대한 집중 테스트를 추가하십시오. frontend/src/App.tsx
201-224의 visibleNodes/searchCache 경로에서 동일한 node.data 참조와 정규화된 검색어일 때 장식 data 참조를
재사용하고, 검색어 또는 원본 data가 바뀌면 새 객체를 생성하는 동작을 검증하십시오. frontend/src/App.tsx 322-348의
폴링 경로에서는 unmount, snapshotId 변경, 중첩 요청의 역순 완료 시 obsolete 응답이 snapshot,
snapshots, error를 갱신하지 않는지 테스트하십시오.
- Around line 322-348: Replace the setInterval-based polling around getSnapshot
with sequential polling that schedules the next request via setTimeout only
after the current request completes, or otherwise track request generations and
apply only the latest response. Ensure terminal statuses stop further polling
and cannot be overwritten by an earlier non-terminal response, while preserving
cleanup through isCurrent and timer cancellation.
🪄 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: 49e644c4-c081-45b4-b64a-ccf9f283da4e

📥 Commits

Reviewing files that changed from the base of the PR and between 6f27589 and a46871c.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • frontend/src/App.tsx

Comment thread frontend/src/App.tsx
Comment thread frontend/src/App.tsx
@seonghobae
seonghobae marked this pull request as draft August 3, 2026 04:10
@seonghobae
seonghobae dismissed opencode-agent[bot]’s stale review August 3, 2026 13:00

Dismissed as stale after the requested evidence was implemented and validated on a superseding current head. Current head eaac845 runs the required frontend coverage evidence in CI; run 30815758349 passed npm ci, TypeScript typecheck, 32 test files / 213 tests, 100% statements/branches/functions/lines, production build, backend mypy and pytest. Current-head Security Scan 30815758729 and Semgrep 30815758088 also passed. The dismissed review targeted e16d178 and its missing evidence, not the validated current head.

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

OpenCode cannot approve yet because required coverage evidence did not pass.

Review outcome

1. HIGH .github/workflows/opencode-review.yml:1 - Coverage evidence did not prove required test/docstring evidence

  • Problem: The required coverage-evidence job result was failure, so OpenCode cannot establish approval sufficiency for this head.

  • Root cause: Automated approval is only valid when the same-head coverage-evidence job proves supported repository test suites passed and configured docstring gates passed or were advisory, or reports not applicable because no supported source files or package manifests exist. Missing, failed, skipped, unavailable, or unsupported-tooling test evidence is a blocker.

  • Fix: Install or configure the repository test/docstring evidence tooling when source files or package manifests exist, rerun the current-head coverage-evidence job, and approve only after it reports success with required evidence or explicit no-source not-applicable evidence.

  • Regression test: Keep the approval branch checking needs.coverage-evidence.result == success before posting APPROVE, and publish REQUEST_CHANGES when coverage-evidence blocker states such as cancelled, skipped, failed, unsupported-tooling, or below-100 evidence are present.

  • Result: REQUEST_CHANGES

  • Reason: coverage-evidence result was failure, so required test/docstring evidence was not proven for current head 0d19fde349f1c715f230faccaa152ff106690a03.

  • Head SHA: 0d19fde349f1c715f230faccaa152ff106690a03

  • Workflow run: 30822120818

  • Workflow attempt: 1

Coverage evidence

Coverage evidence job did not run or did not publish coverage evidence.

Changed-File Evidence Map

flowchart LR
  PR["PR changed files"] --> Evidence["OpenCode bounded evidence"]
  Evidence --> S1["Workflow: ci.yml"]
  S1 --> I1["GitHub Actions review job"]
  I1 --> R1["Review risk: Workflow: ci.yml"]
  R1 --> V1["actionlint plus required checks"]
  Evidence --> S2["Changed file (2 files)"]
  S2 --> I2["repository behavior"]
  I2 --> R2["Review risk: Changed file (2 files)"]
  R2 --> V2["required checks"]
  Evidence --> S3["Backend: uv.lock"]
  S3 --> I3["API and service runtime"]
  I3 --> R3["Review risk: Backend: uv.lock"]
  R3 --> V3["backend tests"]
  Evidence --> S4["Frontend (9 files)"]
  S4 --> I4["browser runtime and bundle"]
  I4 --> R4["Review risk: Frontend (9 files)"]
  R4 --> V4["frontend tests"]
Loading

@opencode-agent
opencode-agent Bot disabled auto-merge August 3, 2026 16:45

@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: 5

🤖 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/App.coverage.test.tsx`:
- Around line 755-769: Update the test “preserves derived node data object
identity when searching” to capture the node data passed to ReactFlow and assert
with toBe that it retains the same reference across equivalent normalized search
input and position-only updates. Keep the existing search interactions, but
verify derived node.data identity rather than only checking the input value.

In `@frontend/src/App.pollingBranches.test.tsx`:
- Around line 97-137: Strengthen the stale-response tests around the terminal
snapshot polling flow by instrumenting the relevant state observation or
setters, rather than only asserting api.listSnapshots call counts. Verify both
the delayed successful refresh and rejected refresh in the unmounted cases do
not invoke setSnapshots or setError or otherwise change observed state after
cleanup; include the analogous getSnapshot path if covered by these tests.

In `@frontend/src/App.prismaExport.test.tsx`:
- Around line 38-49: Update the ExportModal mock to accept isOpen and render the
Prisma download button only when isOpen is true. In the test flow around the
ExportModal usage, first trigger the actual control that opens the export modal,
then click the rendered Prisma download button so the user path is exercised.

In `@frontend/src/coverageGaps.test.tsx`:
- Around line 116-119: Strengthen the test case “ignores an edge whose target
node is absent” by asserting that the exported schema contains no relation or
target-model reference for the missing “absent” node. Keep the existing “model
profiles” assertion and use the generated schema result from exportPrisma for
the focused negative check.
- Line 18: 삭제 확인 책임이 중복되지 않도록 EditEdgeModal 및 GroupModal의 삭제 확인과 App.tsx의
onRelDelete 및 onDeleteBusinessGroup 콜백 후 확인 로직 중 한 계층만 유지하십시오. 통합 화면에서 삭제당
window.confirm이 한 번만 호출되도록 관련 구현을 조정하고, frontend/src/coverageGaps.test.tsx의 두
테스트를 단일 확인 동작과 일치하게 업데이트하십시오.
🪄 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: 53a3f0da-9f13-464e-88d2-6d794c8d388d

📥 Commits

Reviewing files that changed from the base of the PR and between a46871c and a532d09.

📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • frontend/src/App.coverage.test.tsx
  • frontend/src/App.pollingBranches.test.tsx
  • frontend/src/App.prismaExport.test.tsx
  • frontend/src/App.searchPolling.test.tsx
  • frontend/src/App.tsx
  • frontend/src/coverageGaps.test.tsx
  • frontend/src/erd/__tests__/prismaBranchCoverage.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/App.tsx

Comment on lines +755 to +769
it('preserves derived node data object identity when searching', async () => {
await renderReadyApp()
fireEvent.click(screen.getByRole('button', { name: '다이어그램' }))
await waitFor(() => expect(screen.getAllByRole('button', { name: '열기' }).length).toBeGreaterThan(0))
fireEvent.click(screen.getAllByRole('button', { name: '열기' })[0]!)
await waitFor(() => expect(screen.getByRole('toolbar', { name: 'ERD 캔버스 도구' })).toBeInTheDocument())

// Trigger a search that dims nodes
fireEvent.change(screen.getByLabelText('테이블 또는 컬럼 검색'), { target: { value: 'nomatch' } })
expect(screen.getByLabelText('테이블 또는 컬럼 검색')).toHaveValue('nomatch')

// Change back to match
fireEvent.change(screen.getByLabelText('테이블 또는 컬럼 검색'), { target: { value: 'users' } })
expect(screen.getByLabelText('테이블 또는 컬럼 검색')).toHaveValue('users')
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

파생 node.data 객체 동일성을 검증하십시오.

이 테스트는 검색 입력값만 확인합니다. WeakMap 캐시가 제거되어 매 렌더마다 새 node.data 객체가 생성되어도 이 테스트는 통과합니다.

ReactFlow에 전달한 노드 데이터를 캡처하십시오. 동일한 정규화 검색어와 위치 전용 업데이트에서 같은 참조인지 toBe로 검증하십시오.

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

🤖 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/App.coverage.test.tsx` around lines 755 - 769, Update the test
“preserves derived node data object identity when searching” to capture the node
data passed to ReactFlow and assert with toBe that it retains the same reference
across equivalent normalized search input and position-only updates. Keep the
existing search interactions, but verify derived node.data identity rather than
only checking the input value.

Source: Coding guidelines

Comment on lines +97 to +137
it('does not apply a terminal snapshot-list refresh that resolves after unmount', async () => {
let resolveRefresh!: (value: typeof snapshotSummary[]) => void;
api.listSnapshots
.mockResolvedValueOnce([snapshotSummary])
.mockImplementationOnce(() => new Promise((resolve) => { resolveRefresh = resolve; }));
api.getSnapshot.mockResolvedValue(terminalSnapshot);

const view = render(<App />);
await waitFor(() => expect(api.listSnapshots).toHaveBeenCalledTimes(1));
await openSnapshot();
await waitFor(() => expect(api.listSnapshots).toHaveBeenCalledTimes(2));
view.unmount();

await act(async () => {
resolveRefresh([{ ...snapshotSummary, schema_snapshot_uuid: 'stale-snapshot' }]);
await Promise.resolve();
});

expect(api.listSnapshots).toHaveBeenCalledTimes(2);
});

it('does not publish a terminal snapshot-list refresh error after unmount', async () => {
let rejectRefresh!: (reason: Error) => void;
api.listSnapshots
.mockResolvedValueOnce([snapshotSummary])
.mockImplementationOnce(() => new Promise((_, reject) => { rejectRefresh = reject; }));
api.getSnapshot.mockResolvedValue(terminalSnapshot);

const view = render(<App />);
await waitFor(() => expect(api.listSnapshots).toHaveBeenCalledTimes(1));
await openSnapshot();
await waitFor(() => expect(api.listSnapshots).toHaveBeenCalledTimes(2));
view.unmount();

await act(async () => {
rejectRefresh(new Error('stale refresh failure'));
await Promise.resolve();
});

expect(api.listSnapshots).toHaveBeenCalledTimes(2);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

오래된 응답의 상태 갱신 억제를 직접 검증하십시오.

현재 검증은 API 호출 횟수만 확인합니다. 오래된 listSnapshots 또는 getSnapshot 처리기가 언마운트 후 setSnapshots 또는 setError를 호출해도 이 테스트는 통과합니다.

상태 setter 또는 테스트용 관찰 지점을 계측하십시오. 오래된 성공 및 실패 응답이 정리 후 상태를 변경하지 않는지 검증하십시오.

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

Also applies to: 162-180

🤖 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/App.pollingBranches.test.tsx` around lines 97 - 137, Strengthen
the stale-response tests around the terminal snapshot polling flow by
instrumenting the relevant state observation or setters, rather than only
asserting api.listSnapshots call counts. Verify both the delayed successful
refresh and rejected refresh in the unmounted cases do not invoke setSnapshots
or setError or otherwise change observed state after cleanup; include the
analogous getSnapshot path if covered by these tests.

Source: Coding guidelines

Comment on lines +38 to +49
vi.mock('./components/modals', () => ({
AddTableModal: () => null,
CardinalityModal: () => null,
EditEdgeModal: () => null,
EditTableModal: () => null,
GroupModal: () => null,
ExportModal: (props: { onDownloadPrisma: () => void }) => (
<button type="button" onClick={props.onDownloadPrisma}>
Prisma 내보내기 테스트
</button>
),
}));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

닫힌 내보내기 모달을 우회하지 마십시오.

ExportModal mock은 isOpen 상태를 무시하고 버튼을 항상 렌더링합니다. 따라서 테스트는 실제 내보내기 모달을 열지 않아도 onDownloadPrisma를 호출합니다.

mock이 isOpen일 때만 버튼을 렌더링하게 변경하십시오. 그 후 실제 모달 열기 제어를 실행한 다음 Prisma 다운로드 버튼을 클릭하십시오. 이렇게 하면 사용자 경로를 검증할 수 있습니다.

As per coding guidelines: “Add or update focused tests when changing behavior.”

Also applies to: 87-92

🤖 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/App.prismaExport.test.tsx` around lines 38 - 49, Update the
ExportModal mock to accept isOpen and render the Prisma download button only
when isOpen is true. In the test flow around the ExportModal usage, first
trigger the actual control that opens the export modal, then click the rendered
Prisma download button so the user path is exercised.

Source: Coding guidelines

describe('remaining user-interaction branches', () => {
it('keeps an edge when deletion is cancelled and deletes after confirmation', () => {
const onRelDelete = vi.fn();
const confirm = vi.spyOn(window, 'confirm').mockReturnValueOnce(false).mockReturnValueOnce(true);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

삭제 확인 대화상자의 책임을 한 계층에만 두십시오.

이 테스트는 EditEdgeModalGroupModal이 삭제 전에 window.confirm을 호출한다고 고정합니다. 그러나 frontend/src/App.tsxonRelDeleteonDeleteBusinessGroup도 콜백 실행 후 확인 대화상자를 표시합니다.

통합 화면에서는 삭제마다 확인 대화상자가 두 번 표시됩니다. modal 또는 App 중 한 계층만 확인을 처리하게 변경하고, 두 테스트를 단일 확인 동작에 맞게 수정하십시오.

Also applies to: 49-49

🤖 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/coverageGaps.test.tsx` at line 18, 삭제 확인 책임이 중복되지 않도록
EditEdgeModal 및 GroupModal의 삭제 확인과 App.tsx의 onRelDelete 및 onDeleteBusinessGroup
콜백 후 확인 로직 중 한 계층만 유지하십시오. 통합 화면에서 삭제당 window.confirm이 한 번만 호출되도록 관련 구현을 조정하고,
frontend/src/coverageGaps.test.tsx의 두 테스트를 단일 확인 동작과 일치하게 업데이트하십시오.

Comment on lines +116 to +119
it('ignores an edge whose target node is absent', () => {
const edges: Edge[] = [{ id: 'missing-target', source: 'profiles', target: 'absent' }];
expect(exportPrisma(nodes, edges)).toContain('model profiles');
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

누락된 대상 관계가 생성되지 않는지 검증하십시오.

현재 assertion은 edge가 없어도 항상 생성되는 'model profiles'만 확인합니다. 따라서 exporter가 누락된 대상에 대한 관계를 잘못 생성해도 테스트가 통과합니다.

생성된 schema에 해당 @relation(...) 또는 대상 모델 참조가 없음을 assertion으로 추가하십시오.

As per coding guidelines: “Add or update focused tests when changing behavior.”

🤖 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/coverageGaps.test.tsx` around lines 116 - 119, Strengthen the
test case “ignores an edge whose target node is absent” by asserting that the
exported schema contains no relation or target-model reference for the missing
“absent” node. Keep the existing “model profiles” assertion and use the
generated schema result from exportPrisma for the focused negative check.

Source: Coding guidelines

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.

1 participant