Skip to content

Export a quitPreservingProfile() for the paired Electron client (dispose() silently deletes the profile) #21296

Closed

Description

@nwparker

Corrected from the original filing: the primitive is not missing, it is un-composed. Quit-without-deleting is closeElectronAppForE2E(app) + cleanupE2EDaemons(userDataDir) — the first two steps of dispose() without removeProfile. That works; it produced a clean hop-by-hop reading for #21295. This issue is now a request to name it, not to build it.

Why naming it matters

Composing it wrong is silent and expensive, in both directions.

dispose() deletes the profile (tests/e2e/helpers/paired-electron-client.ts:238-242). A test that calls dispose() and then relaunches with reuseUserDataDir gets a first run on an empty profile, not a restart. Every persistence assertion after that reads empty, which is indistinguishable from data loss. This is not hypothetical — it produced a phantom data-loss finding during the #21285 investigation, and that finding was reported twice before it was caught. What exposed it was a diagnostic that listed session files rather than reading values out of them: [] files is a different claim from 0 buffers, and only the first was true.

app.close() hangs. The natural workaround — close the app directly to skip the profile deletion — has no timeout and no force-kill fallback, and hung past a 10-minute Playwright timeout with no reading at all. closeElectronAppForE2E (tests/e2e/helpers/electron-process-shutdown.ts:185) is app.close() wrapped in withTimeout plus forceKillProcessTree; the raw call is missing exactly that.

Implemented

quitPreservingProfile() on PairedElectronClient, beside dispose(), on branch repro/parked-scrollback-restart (commit 9a306519f40). Needs a home — it rode in on a repro branch that is intentionally not mergeable, so it should be cherry-picked or re-landed on its own.

Two things worth keeping with it:

  • The doc comment states both failure modes, so the next person does not rediscover which two of the three steps they want.
  • The repro pins the trap as an assertion rather than a comment: profileSurvived: onDiskAfterQuit >= 0, where -1 means no session file was found at all. Reintroducing dispose() there now fails on the harness instead of reporting a phantom bug.

The general form, which is the durable lesson: when a measurement reads zero, something in the same log line has to distinguish measured zero from measured nothing.

Related: #21295 (the defect this unblocked measuring).

Activity

  1. changed the title [-]No quit/relaunch-same-profile primitive for the paired Electron client (and dispose() silently deletes the profile)[/-] [+]Export a quitPreservingProfile() for the paired Electron client (dispose() silently deletes the profile)[/+] on Sep 17, 2026
  2. nwparker commented on Sep 17, 2026

    @nwparker
    ContributorAuthor

    Cut as its own PR against main: #21300 — helper only, no red spec, 12 lines of test infrastructure. It carries the doc comment with both failure modes (dispose() deleting the profile, and a bare app.close() hanging for want of the timeout/force-kill wrapper).

    The profileSurvived: onDiskAfterQuit >= 0 guard stays with the spec that needs it on repro/parked-scrollback-restart rather than moving into the helper, since it asserts on a reading the helper doesn't take.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions