fix: Rework initial settings storage on invitee v2 - #1125
Merged
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
gmaclennan
marked this pull request as ready for review
September 25, 2025 20:49
RangerMauve
requested changes
Sep 25, 2025
RangerMauve
left a comment
Contributor
There was a problem hiding this comment.
LGTM overall, cleaner than before
RangerMauve
approved these changes
Sep 29, 2025
gmaclennan
enabled auto-merge (squash)
September 29, 2025 21:31
This was referenced Oct 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a rework of #1123, because during review I realised it was not necessary to maintain a separate table because we already store project info in the keys table.
This changes how leaving a project is tracked: it is now written to the project keys table before clearing project data. Previously we determined whether a project was left based on whether the project settings index had a row for it, which was based on several assumptions about what leaving a project did, assumptions which could break in the future (e.g. joining a project without encryption keys as a blind peer). This change required adding a new migration functionality to run JS code based on migration steps. It adds a bit of maintenance overhead, but it will also help the core manager store migration in #1092, and could be useful in the future.
A previous fix to ensure data is cleared after leaving a project used the change of role to acertain if the project had been left, however because this check was made every time a project instance was created, including when adding a new project from an invite, it was actually creating a big delay, because a project instance would not be returned until getOwnRole returned, which waited for initial sync.
This adds a
statusprop to themanager.listProjects()function to be explicit about when a project is in the "joining" state, and adds an additional "left" status.There is a change of behaviour here where $getProjectSettings() will still return the basic project info (name, description, color, sendStats) even after leaving a project, which makes it consistent with what is returned from
listProjects().The test for "partly-left projects" should be more robust now too - it doesn't "pretend" to partly leave a project, but instead prematurely exits the process to more realistically simulate what would happen in real usage if leave project fails.
Also fixes a small type bug for the
projectInviteIdcolumn of the projectKeysTable, which was defined asunknownbecause it was defaulting to a JSON column I think.