Skip to content

Conversation

cgwalters
Copy link
Member

We fixed the bug that caused soft reboot to trip the assertion here, so revert back to a hard check.

We fixed the bug that caused soft reboot to trip the assertion
here, so revert back to a hard check.
Copy link

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

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 simplifies the code by removing a workaround for a bug related to soft reboots, which is a good improvement. I have one suggestion to enhance robustness: instead of using g_assert(), which can crash the application, I recommend returning a GError. This aligns better with the function's signature and provides a cleaner failure path.

g_assert (self->booted_deployment);
}
}
g_assert (self->booted_deployment);

Choose a reason for hiding this comment

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

high

While the bug that required the previous complex check has been fixed, using g_assert() here could lead to a crash in production builds if this invariant is ever violated for any reason (e.g., a regression, or an unexpected system state).

Since this function can return a GError, it would be more robust to return an error instead of asserting. This provides a cleaner failure mode for callers and is more idiomatic for a library function.

  if (G_UNLIKELY (!self->booted_deployment)) return glnx_throw (error, "Inconsistent state: system is booted but no deployment found");

Copy link
Member Author

Choose a reason for hiding this comment

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

We're not converting the runtime assertions in the codebase to errors right now.

@cgwalters cgwalters mentioned this pull request Jun 30, 2025
9 tasks
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@cgwalters cgwalters merged commit ba7a7ec into ostreedev:main Jul 1, 2025
37 of 39 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