Skip to content

fix(wallpaper): refuse cleanup when any live player lacks a registry row - #314

Merged
Lucas1479 merged 3 commits into
Code-Amadeus:mainfrom
sanketpatel32:issue-233-lively-wallpaper-recovery
Nov 25, 2026
Merged

Lucas1479 merged 3 commits into
Code-Amadeus:mainfrom
sanketpatel32:issue-233-lively-wallpaper-recovery

Conversation

@sanketpatel32

Copy link
Copy Markdown
Contributor

Refs #233. Keep the issue open: this widens the incomplete-report veto from the managed project's rows to the whole reported wallpaper list. It does not change Lively's RPCs, qualify non-WebView2 players, or resolve the upstream reporting contract.

What changed

Lively 2.2.1.0 can drop wallpaper rows and still complete a successful GetWallpapers response, including a fully empty one. The helper already refused cleanup when managed-URL WebView2 wrappers outnumbered the rows reported for the managed project (#296), but an omitted row for any other scene still read as a cleared desktop:

  • Session.restore could pass the user_changed/changed checks on a false-empty report and stop an Amadeus-owned host that was still displaying unreported user scenes.
  • Session.mount could accept a false-empty report as the before-image and journal it.
  • The restarted/unmounted restore path could restore originals over monitors whose live scenes were simply unlisted.

Every live WebView2 player owns a registry row, so a total same-session player count above the whole reported row count proves an incomplete list. Windows.managed_player_count becomes player_counts, returning both counts from the same kernel pass; LivelyHost.unlisted_players vetoes on either excess. The fake host, Electron fixture, lifecycle doc and error text follow the widened contract.

The veto fires only on proven inconsistency: a genuinely empty desktop (0 players, 0 rows) still passes, the journal and original error are retained for recover retries, and no Close resend or host shutdown is attempted. Post-Close convergence stays bounded by the existing two-second window.

Regression coverage

python -m pytest tests/test_windows_wallpaper_helper.py — 112 tests pass on this machine (Windows, CPython 3.12.10; two sub-second native-pipe/powershell timeouts flaked under load during full-suite runs and passed on isolated rerun). python tools/probes/windows_wallpaper_counterexample.py still exits 0. New coverage:

  • test_empty_report_is_not_a_before_image_while_a_scene_is_live: mount refuses an empty reported list while a scene is live.
  • test_omitted_live_scene_is_not_proof_of_a_cleared_desktop: restore vetoes a fully empty report with a live non-managed scene; the journal is retained, no Close or host stop is attempted, and the retry keeps the user's new scene.
  • test_any_player_without_a_registry_row_vetoes_the_whole_report: a real hidden test process with a non-Amadeus --wallpaper-url vetoes an empty report through the production Windows observer.

Limits

  • Rows backed by non-WebView2 player types, and omissions whose surviving player count still fits inside the reported row total, remain undetectable host-side; that needs the truthful list/close contract tracked in Windows wallpaper recovery: Lively false-empty reports and unconfirmed project close #233 (upstream report drafts in docs/evidence/issue233-lively-recovery.md).
  • Simulated registries and synthetic player processes only; no stock-Lively desktop run was performed. Physical multi-monitor behavior is unchanged and unqualified.
  • electron/tests/fixtures/wallpaper_helper_fixture.py mirrors the contract; the Electron parent-lifetime suite it serves was not run here (requires a packaged Electron build).

Refs Code-Amadeus#233. Keep the issue open: this widens the incomplete-report
veto from the managed project's rows to the whole reported list; it
does not change Lively's RPCs or certify non-WebView2 players.

Lively's enumeration can drop wallpaper rows while still returning a
successful list, including a fully empty one. The helper already
refused cleanup when managed-URL wrappers outnumbered entries for the
managed project, but an omitted row for any other scene still passed
as a cleared desktop: an owned host could be stopped while an
unreported user scene was still playing, and a false-empty report
could be saved as the before-image.

Every live WebView2 player owns a registry row, so a total player
count above the whole reported row count also proves an incomplete
list. The veto fires only on that excess: a genuinely empty desktop
still passes, the journal is retained for retry, and neither a close
nor a host shutdown is attempted.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sanketpatel32
sanketpatel32 force-pushed the issue-233-lively-wallpaper-recovery branch from e07c492 to 570017a Compare November 22, 2026 23:55

@Lucas1479 Lucas1479 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @sanketpatel32 for extending the veto to the whole report. Counting every same-session WebView2 player against all reported rows addresses the false-empty case from #233 without trusting an empty list. Merging.

Two non-blocking notes for later:

  • In Lively 2.2.1.0, WallpaperPreview windows (the library preview and the screensaver preview) also run WebView2 players without a row in GetWallpapers. While one is open, the helper vetoes cleanup and reports an incomplete list. This fails closed, so it is safe, but the error should mention an open preview as a possible cause.
  • Two of the three new tests also pass on the previous helper, because their veto logic lives in the test FakeHost. Only the native test exercises the production change.

@Lucas1479
Lucas1479 merged commit ae1be4e into Code-Amadeus:main Nov 25, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants