[Feature Request]: Change ProfileId defaulting to be an invalid profile #5440
Labels
enhancement
End user-perceivable enhancements.
Impact: Medium
Moderate perceived user impact (non-blocking bugs and general improvements).
Work: Medium
The means to find the solution is clear, but it isn't at good-first-issue level yet.
Milestone
Is your feature request related to a problem? Please describe.
Currently, a default (unspecified) proto3 proto message will default its integers to 0. In the case of
ProfileId
, this means it defaults to an internal profile ID of 0.An oversight when designing the profile management system is that the admin profile (first profile created on the device) is also initialized to 0, despite the default logged out ID being -1. This creates a potentially buggy inconsistency where code may assume a default, uninitialized
ProfileId
corresponds to an invalid profile when, in reality, it probably corresponds to the admin profile.Describe the solution you'd like
ProfileId
needs to be refactored to have a proper uninitialized state, which can probably be best done by introduce a logged out value:This should be binary compatible with the existing
ProfileId
, but it changes the semantics of defaultProfileId
to be an unspecified type, rather than a type that's logged in.However, this requires substantial changes still throughout the codebase, namely:
ProfileId
.internalProfileId
is extracted from aProfileId
need to be checked to ensure thatProfileId
'stype
is the correct logged-in case.Describe alternatives you've considered
Haven't considered alternatives, but there are likely many approaches to this problem.
Additional context
Came up during review of #5248 but I was aware of it prior to that PR since it's existed as an issue since the introduction of profiles support.
The text was updated successfully, but these errors were encountered: