Repository navigation
Document three e2e completion signals that pass vacuously - #18455
Merged
Merged
Conversation
Each of these made a test in the #18444 work pass without exercising the code it was written to guard: - executeInConsole resolves on the console prompt, which the session enqueues before running change detection, so plot/package/file effects have not been delivered yet. - Client state is pushed on a passive 5s timer, so a reload outruns the save and restores nothing. - Workbench pane elements attach long before client state is applied, so a pane selector is not a gate for startup state handling. No product change; guidance only.
Contributor
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Both entries as written could still let a test pass vacuously, which is the exact failure mode the section documents: - The set_client_state gate only proved the RPC was sent. waitForResponse resolves on a rejected response too, and a failed RPC comes back HTTP 200 with an error member (sendJsonRpcError goes through sendJsonRpcResponse), so response.ok() is not enough either -- the body has to be checked. - window.rstudio.ready was described as gating post-reload state. On the re-join path a page.reload() takes it is set in initializeAgent(), which Application.java calls immediately before initializeWorkbench(), so it can be observed before PaneManager exists. Split out the reason the second one matters: expect.poll returns on its first passing sample, so it cannot assert that something never happens -- the pre-condition state is the passing state and the poll is green before the bad state arrives. No product change; guidance only.
The entry said window.rstudio.ready can be observed before PaneManager is constructed. It cannot. Application.java calls initializeAgent() and initializeWorkbench() in one task, and WorkbenchScreen builds PaneManager synchronously (paneManager_ = pPaneManager.get()), so the event loop never yields in between -- an out-of-page observer only ever sees ready after the panes exist. The entry's conclusion is unchanged, because it does not rest on that claim: ready still is not a state-applied gate, since startup work deferred to a later task (scheduleDeferred, and timers like ZoomedTabStateValue.onInit's 200ms one) is outstanding when it flips.
initializeWorkbench() returns early with a ReloadEvent when the UI-language cookie, or on Electron the web-dialogs cookie, disagrees with its pref -- before it constructs the workbench, and the reload it fires is delayed. ready is already true at that point, so it can be observed with no panes at all. The previous wording had swung too far the other way, claiming ready does mean the panes exist. Neither direction is a safe thing to lean on; the element wait belongs in the assertion.
Same facts, shorter sentences. These entries had grown long clauses and nested asides across three revisions, which made them hard to read. Entry 11 carried two independent reasons in one paragraph, so it now states them as a list and puts the re-join detail after them, where it explains the first reason instead of interrupting it.
Entry 9 said executeInConsole returns before change detection has queued anything. That is only one of the possible outcomes. ClientEventQueue::add ends with notify_all, so queueing the prompt wakes a waiting get_events poller before onDetectChanges runs on the R thread -- but whether the poller drains first is a thread race, so the change events may also be queued, or delivered, and merely not rendered. State the part that is always true instead: the prompt is ordered ahead of the change-detection events and can reach the client first, so at the moment the prompt counter advances the effect may be unqueued, undelivered, or unrendered. The guidance is unchanged, and holds in all three cases.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds three entries to the "Waits and markers that lie" section of the
rstudio-create-playwright-testsskill. No product change; guidance only, so noNEWS entry and no associated issue.
Each of these was found the hard way while writing the regression tests for
#18444 (#18454): in every case a test passed while never exercising the code it
was written to guard.
A console prompt does not mean R-side change detection has run. The
session enqueues
kConsolePromptbefore callingonDetectChanges(
SessionConsoleInput.cpp), soexecuteInConsole-- which resolves on theprompt counter -- returns before a plot raising the Plots pane, a package-list
refresh, or a file change has been queued. A test that waits on the prompt and
then measures asserts against the pre-effect state.
Client state is pushed on a passive 5s timer.
persistClientState()firesPushClientStateEventwithactive=false, soClientStateUpdaterreschedulesrather than nudging. A test that changes persisted state and reloads outruns
the save and restores nothing. The entry gives the
set_client_statewaitForResponsepredicate, and notes that all state values ship in one RPC,so the wait also gates state written by other components in the same push.
window.rstudio.ready, not a pane selector, gates post-reload state.Workbench pane elements attach at construction, well before client state is
applied, so
waitForSelector('#rstudio_TabSet1_pane')returns while startupstate handling is still pending -- including work deferred on a timer, such as
PaneManager.ZoomedTabStateValue.onInit.