Skip to content

loader_app: Reset InstallationStore when slot count changes - #13471

Merged
yuying-y merged 2 commits into
youtube:mainfrom
andrewsavage1:fix-im-slot-count-reset
Oct 20, 2026
Merged

yuying-y merged 2 commits into
youtube:mainfrom
andrewsavage1:fix-im-slot-count-reset

Conversation

@andrewsavage1

Copy link
Copy Markdown
Contributor

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot configuration (Cobalt >= 26, introduced in b/349897494), an existing installation_store_<app_key>.pb on disk with 3 slots causes InstallationManager::Initialize() to fail if the device had rotated into Slot 2. When LoadSlotManagedLibrary() returns NULL, loader_app falls back to loading the system image without SbSystemGetExtensionShim, causing the device to permanently report Evergreen-Lite.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25 configuration targets an incompatible Starboard ABI (SB <= 16) and cannot be loaded by a Cobalt >= 26 (SB >= 17) loader_app, reset the on-disk InstallationStore via CreateInstallationStore() whenever installations_size() != max_num_installations_ so Slot 0 (the new system image) becomes the active slot immediately.

(Alternative to #13449)

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot
configuration (Cobalt >= 26, introduced in b/349897494), an existing
installation_store_<app_key>.pb on disk with 3 slots causes
InstallationManager::Initialize() to fail if the device had rotated into
Slot 2. When LoadSlotManagedLibrary() returns NULL, loader_app falls
back to loading the system image without SbSystemGetExtensionShim,
causing the device to permanently report Evergreen-Lite.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25
configuration targets an incompatible Starboard ABI (SB <= 16) and
cannot be loaded by a Cobalt >= 26 (SB >= 17) loader_app, reset the
on-disk InstallationStore via CreateInstallationStore() whenever
installations_size() != max_num_installations_ so Slot 0 (the new system
image) becomes the active slot immediately.

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8
@andrewsavage1
andrewsavage1 requested a review from a team as a code owner October 19, 2026 16:02
@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor
Context State Description
CI / All Pass ✅ PASS All checks passed
CI / android ✅ PASS Passed
CI / evergreen ✅ PASS Passed
CI / linux ✅ PASS Passed
CI / tvos ✅ PASS Passed
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Gemini Suggested Commit Message


evergreen: Reset store when slot count changes

The InstallationStore is now reset if the number of slots found on
disk does not match the expected maximum number of installations.
This prevents initialization failures when upgrading from a 3-slot
configuration (Cobalt 25 and below) to a 2-slot configuration
(Cobalt 26 and above).

Previously, if a device was rotated into the third slot, the
mismatch would cause the loader to fall back to the system image
without the necessary extensions, leading to an Evergreen-Lite
state. Since old binaries are incompatible with the new Starboard
ABI, resetting ensures Slot 0 becomes active immediately.

Bug: 574461089

💡 Pro Tips for a Better Commit Message:

  1. Influence the Result: Want to change the output? You can write custom prompts or instructions directly in the Pull Request description. The model uses that text to generate the message.
  2. Re-run the Generator: Post a comment with: /generate-commit-message

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates InstallationManager::Initialize to recreate the installation store if the on-disk store's slot count does not match max_num_installations_ (e.g., during upgrades), and adds a corresponding unit test. Feedback suggests avoiding mixing TEST_F and TEST_P on the same fixture class (InstallationManagerTest) by defining a simple alias for the non-parameterized test, adhering to Chromium style guides.

@y4vor
y4vor requested a review from yuying-y October 19, 2026 16:21
…slots

LoadSlotManagedLibrary() initializes InstallationManager with
kMaxNumInstallations = 2 (updated from 3 in b/349897494), whereas
SlotManagementTest.AdoptSlot was still calling ImInitialize(3, ...)
during test setup. Now that ImInitialize resets the store when the
on-disk slot count does not match max_num_installations, initialize
with 2 slots in AdoptSlot so the pre-configured Slot 1 state is
preserved.

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8
@yuying-y
yuying-y merged commit f7c9d8d into youtube:main Oct 20, 2026
1051 of 1059 checks passed
@andrewsavage1
andrewsavage1 deleted the fix-im-slot-count-reset branch October 20, 2026 18:51
cobalt-github-releaser-bot pushed a commit that referenced this pull request Oct 20, 2026
…count changes

Refer to original PR: #13471

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot
configuration (Cobalt >= 26, introduced in b/349897494), an existing
`installation_store_<app_key>.pb` on disk with 3 slots causes
`InstallationManager::Initialize()` to fail if the device had rotated
into Slot 2. When `LoadSlotManagedLibrary()` returns `NULL`,
`loader_app` falls back to loading the system image without
`SbSystemGetExtensionShim`, causing the device to permanently report
`Evergreen-Lite`.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25
configuration targets an incompatible Starboard ABI (SB <= 16) and
cannot be loaded by a Cobalt >= 26 (SB >= 17) `loader_app`, reset the
on-disk `InstallationStore` via `CreateInstallationStore()` whenever
`installations_size() != max_num_installations_` so Slot 0 (the new
system image) becomes the active slot immediately.

*(Alternative to #13449)*

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8

(cherry picked from commit f7c9d8d)
cobalt-github-releaser-bot pushed a commit that referenced this pull request Oct 20, 2026
…count changes

Refer to original PR: #13471

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot
configuration (Cobalt >= 26, introduced in b/349897494), an existing
`installation_store_<app_key>.pb` on disk with 3 slots causes
`InstallationManager::Initialize()` to fail if the device had rotated
into Slot 2. When `LoadSlotManagedLibrary()` returns `NULL`,
`loader_app` falls back to loading the system image without
`SbSystemGetExtensionShim`, causing the device to permanently report
`Evergreen-Lite`.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25
configuration targets an incompatible Starboard ABI (SB <= 16) and
cannot be loaded by a Cobalt >= 26 (SB >= 17) `loader_app`, reset the
on-disk `InstallationStore` via `CreateInstallationStore()` whenever
`installations_size() != max_num_installations_` so Slot 0 (the new
system image) becomes the active slot immediately.

*(Alternative to #13449)*

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8

(cherry picked from commit f7c9d8d)
briantting pushed a commit that referenced this pull request Oct 20, 2026
…count changes

Refer to original PR: #13471

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot
configuration (Cobalt >= 26, introduced in b/349897494), an existing
`installation_store_<app_key>.pb` on disk with 3 slots causes
`InstallationManager::Initialize()` to fail if the device had rotated
into Slot 2. When `LoadSlotManagedLibrary()` returns `NULL`,
`loader_app` falls back to loading the system image without
`SbSystemGetExtensionShim`, causing the device to permanently report
`Evergreen-Lite`.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25
configuration targets an incompatible Starboard ABI (SB <= 16) and
cannot be loaded by a Cobalt >= 26 (SB >= 17) `loader_app`, reset the
on-disk `InstallationStore` via `CreateInstallationStore()` whenever
`installations_size() != max_num_installations_` so Slot 0 (the new
system image) becomes the active slot immediately.

*(Alternative to #13449)*

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8

(cherry picked from commit f7c9d8d)
briantting pushed a commit that referenced this pull request Oct 26, 2026
…count changes

Refer to original PR: #13471

When upgrading from a 3-slot configuration (Cobalt <= 25) to a 2-slot
configuration (Cobalt >= 26, introduced in b/349897494), an existing
`installation_store_<app_key>.pb` on disk with 3 slots causes
`InstallationManager::Initialize()` to fail if the device had rotated
into Slot 2. When `LoadSlotManagedLibrary()` returns `NULL`,
`loader_app` falls back to loading the system image without
`SbSystemGetExtensionShim`, causing the device to permanently report
`Evergreen-Lite`.

Because any Evergreen binary installed under the 3-slot Cobalt <= 25
configuration targets an incompatible Starboard ABI (SB <= 16) and
cannot be loaded by a Cobalt >= 26 (SB >= 17) `loader_app`, reset the
on-disk `InstallationStore` via `CreateInstallationStore()` whenever
`installations_size() != max_num_installations_` so Slot 0 (the new
system image) becomes the active slot immediately.

*(Alternative to #13449)*

Bug: 574461089
TAG=agy
CONV=f84ec944-1df8-493c-836e-9f9ddabba3e8

(cherry picked from commit f7c9d8d)
andrewsavage1 added a commit that referenced this pull request Oct 27, 2026
…#13524)

Follow-up to #13471.

When `InstallationManager::Initialize()` has no existing store or
detects a slot count mismatch (e.g., upgrading from a 3-slot Cobalt <=
25 configuration to a 2-slot Cobalt >= 26 configuration), call `Reset()`
so that any existing incompatible slot directories on disk are also
cleaned up.

Updates `Reset()` and `CleanInstallationDirs()` to:
- Run `CleanInstallationDirs()` before `CreateInstallationStore()` and
delete slot directories `1..installation_store_.installations_size() -
1` (removing any obsolete directories such as `installation_2` when
shrinking from 3 slots to 2, and acting as a no-op when no previous
store existed).
- Recreate active slot directories via `CreateInstallationDirs()`.

Bug: 574461089
cobalt-github-releaser-bot pushed a commit that referenced this pull request Oct 27, 2026
…when slot count changes

Refer to original PR: #13524

Follow-up to #13471.

When `InstallationManager::Initialize()` has no existing store or
detects a slot count mismatch (e.g., upgrading from a 3-slot Cobalt <=
25 configuration to a 2-slot Cobalt >= 26 configuration), call `Reset()`
so that any existing incompatible slot directories on disk are also
cleaned up.

Updates `Reset()` and `CleanInstallationDirs()` to:
- Run `CleanInstallationDirs()` before `CreateInstallationStore()` and
delete slot directories `1..installation_store_.installations_size() -
1` (removing any obsolete directories such as `installation_2` when
shrinking from 3 slots to 2, and acting as a no-op when no previous
store existed).
- Recreate active slot directories via `CreateInstallationDirs()`.

Bug: 574461089

(cherry picked from commit d12af58)
cobalt-github-releaser-bot pushed a commit that referenced this pull request Oct 27, 2026
…when slot count changes

Refer to original PR: #13524

Follow-up to #13471.

When `InstallationManager::Initialize()` has no existing store or
detects a slot count mismatch (e.g., upgrading from a 3-slot Cobalt <=
25 configuration to a 2-slot Cobalt >= 26 configuration), call `Reset()`
so that any existing incompatible slot directories on disk are also
cleaned up.

Updates `Reset()` and `CleanInstallationDirs()` to:
- Run `CleanInstallationDirs()` before `CreateInstallationStore()` and
delete slot directories `1..installation_store_.installations_size() -
1` (removing any obsolete directories such as `installation_2` when
shrinking from 3 slots to 2, and acting as a no-op when no previous
store existed).
- Recreate active slot directories via `CreateInstallationDirs()`.

Bug: 574461089

(cherry picked from commit d12af58)
briantting pushed a commit that referenced this pull request Nov 9, 2026
…when slot count changes

Refer to original PR: #13524

Follow-up to #13471.

When `InstallationManager::Initialize()` has no existing store or
detects a slot count mismatch (e.g., upgrading from a 3-slot Cobalt <=
25 configuration to a 2-slot Cobalt >= 26 configuration), call `Reset()`
so that any existing incompatible slot directories on disk are also
cleaned up.

Updates `Reset()` and `CleanInstallationDirs()` to:
- Run `CleanInstallationDirs()` before `CreateInstallationStore()` and
delete slot directories `1..installation_store_.installations_size() -
1` (removing any obsolete directories such as `installation_2` when
shrinking from 3 slots to 2, and acting as a no-op when no previous
store existed).
- Recreate active slot directories via `CreateInstallationDirs()`.

Bug: 574461089

(cherry picked from commit d12af58)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants