test(e2e): bound OfflineWorkMetadata durable-store waits - #228
Conversation
pending/settled_conflicts used one page.evaluate that awaited listOperations before checking a JS deadline, so a never-settling store left the 300s APP_READY watchdog as first kill. Route those helpers (and operations) through wait_for_async so each await is raced, and cover never-settle failure with blank-page regressions. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Repository: Fooftilly/PRKS/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (2)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
unittest.TestCase requires a real method name; blank-page bound regressions only need the helper methods. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
Pinned APP_READY body wedge to card_meta's page.evaluate awaiting prksNavigate's Promise when leave/render never settles. Match test_offline: void the call and wait on DOM. Also bound cached list/ person IndexedDB reads through wait_for_async sentinels. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
Blank-page regression: hung navigation Promise must not block evaluate when the call is voided. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
Voiding prksNavigate exposed intermittent 30s wait_for_selector timeouts: leave waited on an unsaved-metadata confirm while the editor was still open. Clear edit mode before fire-and-forget nav. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
Keep urllib.parse with the stdlib import block. Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
PR Summary by QodoBound OfflineWorkMetadata E2E waits and navigation
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
| page.evaluate("""() => { | ||
| if (typeof prksSetWorkDetailsMode === 'function') void prksSetWorkDetailsMode('view'); | ||
| }""") | ||
| page.evaluate("r => { void prksNavigate(r); }", route) |
There was a problem hiding this comment.
1. Route assertions can inspect stale cards 🐞 Bug ☼ Reliability
navigate() discards the prksNavigate() Promise and returns before the workspace’s asynchronous leave-and-render chain completes, while callers such as progress_ids() wait on generic selectors that may still match the departing route. When switching between Progress status routes, the existing non-loading .prks-tile--main can satisfy the predicate before the requested status renders, causing progress_ids() to read the previous group’s work identifiers and exposing other converted callers with shared card selectors to the same stale-render race.
Agent Prompt
## Issue description
`navigate()` starts `prksNavigate()` with `void`, allowing callers to continue before the requested route has committed and rendered. Generic card and tile selectors may already exist on the departing route, so same-page changes such as switching Progress status query parameters can inspect stale content and produce timing-dependent results.
## Fix Focus Areas
- tests/e2e/test_work_metadata_offline.py[430-442]
- tests/e2e/test_work_metadata_offline.py[884-894]
## Recommended Fix
Keep evaluation non-blocking so a hung navigation Promise cannot block indefinitely, but make `navigate()` or each route-specific caller wait for a bounded, unambiguous condition proving that the requested route has been applied and its new render has completed. Use a condition such as the expected canonical `location.hash` together with completion of the destination route’s loading state; in `progress_ids()`, specifically verify that the requested encoded status is active instead of accepting any already-rendered `.prks-tile--main` before reading identifiers.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Void prksNavigate is correct, but progress_ids could accept the departing Progress group's non-loading tile. Commit the hash in navigate, require the requested status title before sampling ids, and drop the fixed 120ms sleep. Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: Nikola Perović <Fooftilly@users.noreply.github.com>
Summary
Focused fix for the OfflineWorkMetadata
APP_READY/ body wedge that hung Full E2E (~301s watchdog) on #227 and #212. Not a #212 bug; cascade should stay held until this merges.Root cause (pinned)
Two unbounded
page.evaluateshapes in this module:pending/settled_conflicts/operations— one evaluate awaitedlistOperations()before checking a JS deadline. A never-settling store left the 300s watchdog as first kill.page.evaluate("… => prksNavigate(…)")— Playwright awaits the returned navigation Promise. When leave/render never settles, evaluate hangs until the watchdog. Reproduced with body-stage diags: hang stageCARD_META_NAVoncard_meta's navigate evaluate (after bothpending()calls had already completed). Leaving metadata edit open made leave wait on an unsaved-draft confirm the test never clicks (intermittent 30swait_for_selectorafter voiding navigate alone).Changes
pending,settled_conflicts, andoperationsthroughwait_for_async(per-await race). Predicates unchanged in strength.navigate(): exit metadata edit, voidprksNavigate, wait on DOM (same pattern astest_offline).wait_for_asyncsentinels.Non-goals
Validation
listOperations;wait_for_asyncfails near the caller timeout for never-settle.CARD_META_NAVbefore void-navigate fix.tests.e2e.test_wait_for_asyncPASS (helper + void-navigate regressions).--jobs 1× 10 PASS--jobs 2× 3 PASStest_acknowledgement_patches_every_cached_representationalone × 15 PASS