Skip to content

test(gui): avoid duplicate provider hash events - #6010

Closed
Ingwannu wants to merge 1 commit into
devfrom
test/6009-provider-deep-link-hashchange
Closed

Ingwannu wants to merge 1 commit into
devfrom
test/6009-provider-deep-link-hashchange

Conversation

@Ingwannu

@Ingwannu Ingwannu commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • make the provider deep-link test helper mirror browser hash navigation
  • rely on the native hashchange event when the hash changes
  • dispatch one explicit event only when re-applying the same hash, matching openProviderAccounts

Closes #6009.

Why

The old helper assigned location.hash and manually dispatched hashchange every time. Happy DOM can also deliver the native event for a changed hash, so one navigation intermittently invoked the Accounts callback twice. The full GUI gate on #6007 and one isolated local run both observed three alpha callbacks where two were expected; immediate control/repeat runs could pass.

Validation

The focused file was run five times sequentially in a disposable home under CPUQuota=75%, MemoryMax=1536M, MemorySwapMax=0, and TasksMax=64:

  • bun test ./gui/tests/providers-deep-link.test.tsx × 5 — 30 pass, 0 fail
  • git diff --check — pass

No build, full suite, or repository-wide typecheck was run locally.

Summary by CodeRabbit

  • Tests
    • Updated deep-link test behavior to avoid duplicate hash-change events and wait for navigation updates consistently.

@Ingwannu
Ingwannu requested a review from lidge-jun as a code owner September 26, 2026 23:00
@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 9e668590-f7f1-4d0a-88e9-4e7c00dda244

📥 Commits

Reviewing files that changed from the base of the PR and between 5518653 and 3e3a57c.

📒 Files selected for processing (1)
  • gui/tests/providers-deep-link.test.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The deep-link test helper now relies on the location event when a hash changes. It dispatches a synthetic event when the requested hash is unchanged. The helper still waits for the next timer turn.

Changes

Deep-link test

Layer / File(s) Summary
Hash helper event handling
gui/tests/providers-deep-link.test.tsx:62-70
The helper records the prior hash and dispatches a synthetic hashchange only when assigning the requested hash leaves the location unchanged. The timer wait remains.

Priority: ⬇️ Low

Estimated code review effort: 1 (Trivial) | ~4 minutes

Change: Other · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 3e3a5

The deep-link test change appears mergeable after normal checks.

🚥 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. 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 The title clearly describes the main change: preventing duplicate provider hash events in tests.
Linked Issues check ✅ Passed Issue #6009 requires changed hashes to rely on the normal event, unchanged hashes to dispatch one explicit event, and the existing navigation assertions to remain. In `gui/tests/providers-deep-link.te…
Out of Scope Changes check ✅ Passed The PR changes only gui/tests/providers-deep-link.test.tsx. The helper change and retained navigation assertions directly address issue #6009. The summary identifies no unrelated source, test, or do…
  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Sep 26, 2026
@Ingwannu

Copy link
Copy Markdown
Owner Author

This test-only PR does not change the GUI; it changes only the Happy DOM navigation helper. No screenshot is applicable.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 22 / 80

이 PR은 화면을 바꾸지 않습니다. 공급자 주소 테스트가 같은 이동을 두 번 세던 것을 고칩니다.

테스트의 hash()는 주소의 # 뒤를 바꾸고, 매번 hashchange를 직접 보냈습니다. Happy DOM 20.11.2는 그 주소가 실제로 바뀌면 다음 타이머에도 같은 신호를 보냅니다. 두 신호가 겹치면 Accounts가 한 번 열려야 하는데 alpha가 세 번 잡힙니다. #6007 게이트와 로컬 한 번이 그 증상이었습니다. 바로 다시 돌리면 통과하기도 했습니다.

이제는 주소가 바뀌면 Happy DOM이 보내는 신호만 기다립니다. 주소가 그대로면 브라우저가 신호를 안 보내므로, 그때만 직접 한 번 보냅니다. 제품의 openProviderAccounts도 같은 주소면 신호를 직접 보냅니다. 그 함수는 gui/src/protocol-deep-links.ts에 있습니다. 베이스는 dev입니다. 열린 PR 제목 기준으로 이 테스트를 또 고치는 것은 없습니다.

라인 - gui/tests/providers-deep-link.test.tsx 71행. 기다림은 setTimeout(0) 한 번입니다. Happy DOM 20.11.2는 지연 없는 window.setTimeout을 전역 타이머 하나에 넣고, 해시를 바꾼 직후 그 타이머에서 hashchange를 보냅니다. 테스트 타이머는 그 뒤에 걸리므로 지금 버전에서는 신호가 먼저 도착합니다. Happy DOM이 이 신호를 한 박자보다 늦게 보내면, 테스트는 다시 신호를 놓칠 수 있습니다.

메인테이너의 판단이 필요한 지점

이 한 박자 대기를 그대로 둘지입니다. 작성자가 이 파일을 다섯 번 연속 돌렸고 모두 통과했습니다. 그 대기는 Happy DOM 20.11.2의 타이머 순서에 기대고 있습니다.

리뷰 시점에 test 2/4와 desktop shell은 아직 끝나지 않았습니다. test 1/4, test 3/4, test 4/4와 gates는 통과했습니다.

너의 추천

그대로 머지하세요. 주소가 바뀌면 Happy DOM 신호만 기다리세요. 같은 주소는 직접 한 번 보내세요. 베이스는 dev로 두세요. 닫을 중복 PR은 없습니다.

이 댓글은 grok-bot이 작성했습니다

@Ingwannu

Copy link
Copy Markdown
Owner Author

Exact head 3e3a57ccca is now fully green: four test shards, gates, desktop shell (15m09s), storage/API checks, Docker/keyring/npm, hygiene, React Doctor and aggregate ci all passed. The PR is test-only and fixes the reproduced duplicate-hashchange flake. @lidge-jun please review/approve.

@Ingwannu
Ingwannu requested a review from luvs01 September 27, 2026 02:54
lidge-jun added a commit that referenced this pull request Sep 27, 2026
Merge train round 3 B7: GUI bug fixes (#6025 #6010 #6007)
@lidge-jun

Copy link
Copy Markdown
Owner

Landed on dev in #6070 (merge 29cef45a86) as one squashed commit that keeps your authorship. Thank you. Closing because this repository merges into dev, so GitHub does not close carried PRs automatically.

@lidge-jun lidge-jun closed this Sep 27, 2026
luvs01 pushed a commit to luvs01/opencodex that referenced this pull request Sep 27, 2026
Carried from lidge-jun#6010 into merge train round 3.

Co-authored-by: Ingwannu <ingwannu@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants