Skip to content

test(frontend): await diagram data before search assertion (deflake main) - #738

Open
seonghobae wants to merge 3 commits into
mainfrom
fix/flaky-diagram-search-waitfor
Open

test(frontend): await diagram data before search assertion (deflake main)#738
seonghobae wants to merge 3 commits into
mainfrom
fix/flaky-diagram-search-waitfor

Conversation

@seonghobae

Copy link
Copy Markdown
Collaborator

Summary

The test navigates dashboard, project, and diagram states including empty/search branches in frontend/src/App.coverage.test.tsx is flaky on main: it fires the diagram search (fireEvent.change on 다이어그램 검색) before the async snapshot list has loaded, so the assertion intermittently sees the empty state instead of search results. This has been failing the frontend job on unrelated PRs — e.g. the docs-only #735.

Fix

Cherry-pick of the single test hunk from commit 06a7eae on #700 (bolt/optimize-handle-lookup-17383827529551263442): await waitFor for the empty-state text (아직 다이어그램 스냅샷이 없습니다...) to disappear before firing the search. waitFor was already imported.

#700 is still open with checks stalled, so this lands the deflake standalone to stop the queue-wide flake; #700's own copy of the hunk will no-op on merge.

🤖 Generated with Claude Code

Cherry-pick of the App.coverage.test.tsx fix from 06a7eae (PR #700).
The diagram search fired before the async snapshot list loaded,
making this test flaky on main and failing CI on unrelated PRs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 43 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: 891d5443-4997-4c1f-b3b5-1f23467e4f82

📥 Commits

Reviewing files that changed from the base of the PR and between 72afe6d and 60b482d.

📒 Files selected for processing (1)
  • frontend/src/App.coverage.test.tsx

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

@seonghobae
seonghobae enabled auto-merge (squash) August 4, 2026 05:47
@seonghobae
seonghobae marked this pull request as draft August 4, 2026 06:21
auto-merge was automatically disabled August 4, 2026 06:21

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 4, 2026 06:21
seonghobae and others added 2 commits August 4, 2026 16:27
…mer tests

Same race as the diagram-search flake: four tests click the first
열기 button immediately after navigating to 다이어그램, before the
async snapshot list has rendered. Wait for the buttons (real timers)
before enabling fake timers, matching the guard already used elsewhere
in this file.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@seonghobae
seonghobae enabled auto-merge (squash) August 4, 2026 08:19

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

Please review exact current head 60b482da234158ab0aca53a5f4a4c1da46127fcc. The single test-only change waits for snapshot-list readiness before applying diagram search. Current-head CI, Security Scan, and Semgrep are green; submit the normal review verdict only if no finding remains.

Copy link
Copy Markdown
Collaborator Author

@opencode-agent Please review exact current head 60b482da234158ab0aca53a5f4a4c1da46127fcc. Verify the one-line asynchronous readiness wait is deterministic, test-only, and does not weaken assertions. Current-head repository checks are green; submit APPROVE only if no blocking finding remains.

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

expected='60b482da234158ab0aca53a5f4a4c1da46127fcc'
actual="$(git rev-parse HEAD)"
printf 'HEAD=%s\nEXPECTED=%s\n' "$actual" "$expected"
if [ "$actual" != "$expected" ]; then
  echo 'ERROR: checked-out HEAD does not match the requested commit' >&2
  exit 1
fi

echo '--- changed files and diff against first parent ---'
git diff --stat HEAD^ HEAD
git diff --find-renames --unified=80 HEAD^ HEAD -- frontend/src/App.coverage.test.tsx

echo '--- AST outline: affected test file ---'
ast-grep outline frontend/src/App.coverage.test.tsx --items all --view expanded

echo '--- empty-state and diagram search references ---'
rg -n -C 4 --glob '*.{ts,tsx}' \
  '아직 다이어그램 스냅샷이 없습니다|다이어그램 검색' frontend

Length of output: 20002


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '--- commit metadata ---'
git show -s --format='commit=%H%nparent=%P%nsubject=%s%nbody=%b' HEAD

echo '--- diagram-search test: parent versus current ---'
for revision in HEAD^ HEAD; do
  echo "### $revision: frontend/src/App.coverage.test.tsx Lines 315-342"
  git show "${revision}:frontend/src/App.coverage.test.tsx" | sed -n '315,342p'
done

echo '--- current changed test blocks ---'
sed -n '585,790p' frontend/src/App.coverage.test.tsx

echo '--- test setup and async API mocks ---'
sed -n '248,315p' frontend/src/App.coverage.test.tsx

echo '--- PR metadata ---'
gh pr view 738 --repo ContextualWisdomLab/pg-erd-cloud \
  --json number,title,baseRefOid,headRefOid,commits \
  --jq '{number,title,baseRefOid,headRefOid,commits:[.commits[]|{oid:.oid,messageHeadline:.messageHeadline}]}'

Length of output: 17183


🏁 Script executed:

#!/bin/bash
set -euo pipefail

base='72afe6db712b145baaba084f64a1ff4fb36d9fd0'
head='60b482da234158ab0aca53a5f4a4c1da46127fcc'

echo '--- complete PR diff: base to requested head ---'
git diff --check "$base" "$head"
git diff --stat "$base" "$head"
git diff --unified=30 "$base" "$head" -- frontend/src/App.coverage.test.tsx

echo '--- readiness-guard pattern in the coverage test ---'
rg -n -C 2 --glob 'App.coverage.test.tsx' \
  "waitFor\\(\\(\\) => expect\\(screen\\.getAllByRole\\('button', \\{ name: '열기' \\}\\)\\.length\\)\\.toBeGreaterThan\\(0\\)\\)" \
  frontend/src

echo '--- current PR check summary ---'
gh pr checks 738 --repo ContextualWisdomLab/pg-erd-cloud

Length of output: 20630


@seonghobae Reviewed exact head 60b482da234158ab0aca53a5f4a4c1da46127fcc.

No findings remain. The PR waits for snapshot-list readiness before the diagram search. It also applies the same guard before fake timers in related diagram-opening tests. The complete base-to-head diff only changes frontend/src/App.coverage.test.tsx. Current frontend, security, Semgrep, dependency, and static-analysis checks pass.

[approve]

You are interacting with an AI system.

Copy link
Copy Markdown
Collaborator Author

@cwl-noema-review Please independently review exact current head 60b482da234158ab0aca53a5f4a4c1da46127fcc after checks. Confirm the test waits for the intended snapshot-list state transition without hiding a product defect, and submit APPROVE only if no blocker remains.

@seonghobae
seonghobae marked this pull request as draft August 4, 2026 09:50
auto-merge was automatically disabled August 4, 2026 09:50

Pull request was converted to draft

@seonghobae
seonghobae marked this pull request as ready for review August 4, 2026 09:50
@seonghobae
seonghobae enabled auto-merge (squash) August 4, 2026 09:51

Copy link
Copy Markdown
Collaborator Author

@opencode-agent Please review exact head 60b482da234158ab0aca53a5f4a4c1da46127fcc. Repository CI, Security Scan, and Semgrep are green. Verify all four async readiness waits are deterministic, test-only, and preserve the original assertions; submit APPROVE only if no blocking finding remains.

Copy link
Copy Markdown
Collaborator Author

@cwl-noema-review Please independently review exact head 60b482da234158ab0aca53a5f4a4c1da46127fcc. Confirm the test-only deflake does not weaken behavior assertions; submit APPROVE only if no blocker remains.

Copy link
Copy Markdown
Collaborator Author

@opencode-agent @cwl-noema-review Please independently review exact current head 60b482da234158ab0aca53a5f4a4c1da46127fcc. Current-head CI, Security Scan, and SAST Semgrep are successful; no review thread is unresolved. Verify the one-file test-only change waits for async diagram/snapshot controls before search, polling, auto-layout, and stale-response interactions without weakening assertions or adding arbitrary sleeps. Submit APPROVE only for this exact head if no blocker remains.

Copy link
Copy Markdown
Collaborator Author

@opencode-agent @cwl-noema-review Please perform a fresh independent review of current head 60b482da234158ab0aca53a5f4a4c1da46127fcc. Repository CI, Security Scan, Semgrep, and CodeRabbit are green; no unresolved inline threads remain. This is the bounded standalone deflake extracted from #700.

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