Skip to content

fix: Omit installing Snaps from getAllSnaps and getRunnableSnaps#3990

Merged
FrederikBolding merged 2 commits intomainfrom
fb/omit-installing-snaps-from-runnable
May 8, 2026
Merged

fix: Omit installing Snaps from getAllSnaps and getRunnableSnaps#3990
FrederikBolding merged 2 commits intomainfrom
fb/omit-installing-snaps-from-runnable

Conversation

@FrederikBolding
Copy link
Copy Markdown
Member

@FrederikBolding FrederikBolding commented May 8, 2026

Omit Snaps in the installing state from being returned by getAllSnaps and getRunnableSnaps. Since they aren't actually runnable.

In the clients this caused a bug where consumers of Snaps would fail to get valid permissions from PermissionController because the installation had not completed.


Note

Low Risk
Low risk change that only filters out SnapStatus.Installing entries from getAllSnaps, narrowing what downstream callers (including getRunnableSnaps) can see; main risk is any consumer that expected installing snaps to be listed.

Overview
SnapController.getAllSnaps() now omits Snaps in SnapStatus.Installing, so they are no longer returned in the truncated Snap list.

Because getRunnableSnaps() is derived from getAllSnaps(), installing Snaps will also no longer be considered runnable, avoiding clients interacting with Snaps before installation (and permissions) are complete.

Reviewed by Cursor Bugbot for commit ba0faa0. Bugbot is set up for automated code reviews on this repo. Configure here.

@FrederikBolding FrederikBolding requested a review from a team as a code owner May 8, 2026 10:44
return getRunnableSnaps(
Object.values(this.state.snaps)
.filter((snap) => snap.status !== SnapStatus.Installing)
.map(truncateSnap),
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.

Did getAllSnaps do this previously?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I don't think so, but I wonder if it should. #3990 (comment)

*/
getRunnableSnaps(): TruncatedSnap[] {
return getRunnableSnaps(this.getAllSnaps());
return getRunnableSnaps(
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We could also modify getAllSnaps to filter out installing Snaps. The JSDoc seems to imply that only installed Snaps should be included. WDYT @Mrtenz ?

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.

Makes sense to me, I can't think of a good reason to get a Snap that isn't installed yet.

@FrederikBolding FrederikBolding changed the title fix: Omit installing Snaps from getRunnableSnaps fix: Omit installing Snaps from getAllSnaps and getRunnableSnaps May 8, 2026
@FrederikBolding FrederikBolding requested a review from Mrtenz May 8, 2026 10:50
@FrederikBolding FrederikBolding enabled auto-merge May 8, 2026 10:52
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.56%. Comparing base (dcb5bf9) to head (ba0faa0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3990   +/-   ##
=======================================
  Coverage   98.56%   98.56%           
=======================================
  Files         429      429           
  Lines       12365    12366    +1     
  Branches     1944     1944           
=======================================
+ Hits        12187    12188    +1     
  Misses        178      178           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@FrederikBolding FrederikBolding added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 83bd548 May 8, 2026
131 checks passed
@FrederikBolding FrederikBolding deleted the fb/omit-installing-snaps-from-runnable branch May 8, 2026 10:58
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