Skip to content

fix: Rework initial settings storage on invitee v2 - #1125

Merged
gmaclennan merged 16 commits into
mainfrom
fix/no-unknown-forks-gregor
Sep 29, 2025
Merged

fix: Rework initial settings storage on invitee v2#1125
gmaclennan merged 16 commits into
mainfrom
fix/no-unknown-forks-gregor

Conversation

@gmaclennan

@gmaclennan gmaclennan commented Sep 25, 2025

Copy link
Copy Markdown
Member

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 status prop to the manager.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 projectInviteId column of the projectKeysTable, which was defined as unknown because it was defaulting to a JSON column I think.

@gmaclennan gmaclennan self-assigned this Sep 25, 2025
@awana-lockfile-bot

Copy link
Copy Markdown

package-lock.json changes

Click to toggle table visibility
Name Status Previous Current
@comapeo/core4.1.4 ADDED - 4.1.4

@socket-security

socket-security Bot commented Sep 25, 2025

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Added@​comapeo/​core@​4.1.4781008495100

View full report

@gmaclennan
gmaclennan marked this pull request as ready for review September 25, 2025 20:49

@RangerMauve RangerMauve 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.

LGTM overall, cleaner than before

Comment thread drizzle/client/0004_fresh_pestilence.sql Outdated
@gmaclennan
gmaclennan enabled auto-merge (squash) September 29, 2025 21:31
@gmaclennan
gmaclennan merged commit f7b8bc2 into main Sep 29, 2025
11 checks passed
@gmaclennan
gmaclennan deleted the fix/no-unknown-forks-gregor branch September 29, 2025 21:37
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