Skip to content

fix: Rework initial settings storage on invitee - #1123

Closed
RangerMauve wants to merge 8 commits into
mainfrom
fix/no-unknown-forks
Closed

fix: Rework initial settings storage on invitee#1123
RangerMauve wants to merge 8 commits into
mainfrom
fix/no-unknown-forks

Conversation

@RangerMauve

@RangerMauve RangerMauve commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

Does away with the previous approach of using old unix timestamps with the hope of them being overwritten to instead store project data from the invite in a separate table and to fall back to it if we don't have a synced value

Closes #1122

@gmaclennan gmaclennan left a comment

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.

Do we have a test that actually checks that this data is being used? Maybe check the code coverage to see whether the lines where we attempted to read the backupInfo are actually being called by test code?

Note that we will still need the re-index to happen along with the deletion of the projectSettings index table - the "bad" data will still be in there for existing projects, this just stops it for newly invited devices going forwards.

A few things to address in the comments.

Also, obviously, tests need to pass.

Comment thread src/mapeo-project.js Outdated
Comment thread test-e2e/project-settings.js
)
})

test('Set project settings after being invited', async (t) => {

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.

Is this test failing prior to the fix? Could you maybe separate this into a separate commit so we can see CI confirmation of the failing test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it was failing and would like have failed since version 4.1.0. I'll do a rebase

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.

Thanks. In a perfect world, for bug fixes, it's always good to start with a commit with a failing test, to confirm on CI that the test actually works, followed by the fix. I've made mistakes before writing tests that don't actually fail in all circumstances.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah I'll make sure to make a commit to track that fact next time. In the past I've preferred making my first commit as close to "working" as possible but I see the value in starting with a failing test commit so I can adjust.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Rebased to make the test commit separate from the fix

@RangerMauve

Copy link
Copy Markdown
Contributor Author

Regarding whether we have tests that actually check for getProjectStats, that's happening inside the list projects and leave project tests in addition to the $getProjectSettings test

@RangerMauve

Copy link
Copy Markdown
Contributor Author

Instead of dropping the entire project settings table I have the projects remove their entry from it on re-index

@RangerMauve

Copy link
Copy Markdown
Contributor Author

Closed in favor of #1125

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.

Error when trying to update project settings

2 participants