Skip to content

Commit e094fae

Browse files
committed
docs(webdriver): clarify callback and artifact wait boundaries
1 parent 8621648 commit e094fae

2 files changed

Lines changed: 12 additions & 15 deletions

File tree

‎packages/provider-webdriver/src/runtime-session.ts‎

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ type WebDriverLeaseEntry = {
7070
* Whichever route took a lease away from its allocation, and the single disposal of what that entry
7171
* stood for. `settled` is what that disposal reported and stays missing while it is still running, so a
7272
* caller can tell a session that is gone from one whose outcome it cannot see yet. `artifacts` is the
73-
* release envelope's report and is deliberately separate: it is optional, so it is never what a lease or
74-
* a daemon close waits through.
73+
* release envelope's report and is deliberately separate: releasing the lease slot and `shutdown()`
74+
* await only disposal. A release also awaits artifacts, including when it joins a shutdown's take.
7575
*/
7676
type WebDriverLeaseTake = {
7777
by: 'release' | 'shutdown';
@@ -102,9 +102,8 @@ function warningMessagesByCode(warnings: CloudWebDriverReleaseWarning[]): Record
102102
}
103103

104104
/**
105-
* Budget for one provider callback this manager waits on. A plugin may supply its own `prepareSession`
106-
* cleanup and artifact lookup, and those callbacks are the plugin's code, so this manager cannot assume
107-
* they answer: they get the budget this package already gives one WebDriver round trip.
105+
* Budget for prepared-session cleanup on disposal and failed creation, and for teardown artifact lookup.
106+
* The preparation callback itself is not bounded by this budget.
108107
*/
109108
const DEFAULT_PROVIDER_CALLBACK_TIMEOUT_MS = 30_000;
110109

@@ -350,10 +349,9 @@ export class WebDriverSessionManager {
350349
const settle = (outcome: WebDriverDisposalOutcome): void => {
351350
take.settled = outcome;
352351
take.providerSessionId = outcome.session?.providerSessionId;
353-
// The artifact report belongs to the release envelope and to nothing else: it starts here and the
354-
// release joins it, while the lease and a daemon close are answered by `disposal` alone. A plugin's
355-
// artifact lookup therefore cannot keep a lease from being allocated again, nor a close from
356-
// finishing.
352+
// The artifact report starts once session deletion and provider cleanup settle. The lease slot is
353+
// freed and `shutdown()` answers without awaiting it. A release still joins the report, even when
354+
// shutdown started this take.
357355
take.artifacts =
358356
outcome.session === undefined
359357
? undefined
@@ -381,8 +379,8 @@ export class WebDriverSessionManager {
381379
/**
382380
* Ends what one taken entry stands for: the session its create rented, once that create answers, or
383381
* nothing when the create billed nothing. This is the only place a session is ended, and one entry is
384-
* taken by exactly one route, so a session is ended once. Everything here is bounded: the provider's own
385-
* cleanup belongs to the plugin that supplied it, and this manager must still answer when it does not.
382+
* taken by exactly one route, so a session is ended once. After creation answers, session deletion and
383+
* provider cleanup are bounded. Creation still awaits `prepareSession` without a callback budget.
386384
*/
387385
private async disposeTakenEntry(entry: WebDriverLeaseEntry): Promise<WebDriverDisposalOutcome> {
388386
const session = entry.session ?? (await entry.creation.catch(() => undefined));

‎packages/provider-webdriver/src/runtime.ts‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,9 @@ export type CloudWebDriverRuntimeOptions = {
104104
/** Profile fields this provider reads; any field it refuses fails lease allocation. */
105105
profileFields: ProviderProfileFieldDeclaration;
106106
/**
107-
* Budget for one provider callback the session manager waits on — a prepared session's `cleanup`, on
108-
* disposal and on a create that failed, and the artifact lookup — so a plugin callback that never
109-
* answers cannot hold a lease open or delay a close. Defaults to the budget one WebDriver round trip
110-
* gets.
107+
* Budget for a prepared session's `cleanup` on disposal and on a failed create, and for `listArtifacts`
108+
* during teardown. Defaults to 30,000 ms. This budget does not bound `prepareSession`; release and
109+
* shutdown still wait for preparation to finish.
111110
*/
112111
providerCallbackTimeoutMs?: number;
113112
};

0 commit comments

Comments
 (0)