Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ItemsMap doesn't match real object #1279

Conversation

darkdread
Copy link

@darkdread darkdread commented Dec 5, 2022

Multiple reads after tasks have been fetched causes folder index to be misaligned. This fix forces fetched tasks to be queued, ensuring that task handlers finish committing their changes before running the next task handler.

fixes #1187

Multiple reads after tasks have been fetched causes folder index to be
misaligned. This fix forces fetched tasks to be queued, ensuring that
task handlers finish committing their changes before running the next
task handler.
@raucao
Copy link
Member

raucao commented Dec 8, 2022

@darkdread Welcome, and thank you for the proposed fix! It makes sense to me at first glance, and this bug surely is a rather critical show stopper.

Since you seem to have nailed the bug down to the actual problem there, I'm wondering if you could add a test case that demonstrates the bug and that this implementation fixes it? That would make it both easier to review as well as bulletproof against future regressions.

The testing setup is pretty straight-forward, and even though we're in the process of porting everything from Jaribu to Mocha/Chai (and TS), it's still fine to add new cases to the existing suites.

@raucao raucao changed the title Fix ItemsMap doesn't match real object (fixes #1187) Fix ItemsMap doesn't match real object Dec 8, 2022
@raucao raucao requested review from DougReeder, galfert, rosano and a team December 8, 2022 11:26
Updated inmemorystorage.ts getNodes to follow
behavior of localStorage and indexeddb.
@darkdread darkdread force-pushed the bugfix/1187-ItemsMap_doesnt_match_real_object branch from a94fc46 to 41e409d Compare December 12, 2022 08:21
@raucao
Copy link
Member

raucao commented Dec 12, 2022

Great!

@darkdread Just to confirm with you: the first test case added is a missing case and supposed to be green on master (it is for me at least), while the second one is testing the bugfix, correct?

@darkdread
Copy link
Author

darkdread commented Dec 12, 2022

Great!

@darkdread Just to confirm with you: the first test case added is a missing case and supposed to be green on master (it is for me at least), while the second one is testing the bugfix, correct?

In order to simulate the bug, you have to emulate the cloning properties of localStorage and indexeddb for inmemorystorage. I believe the current getNodes implementation of inmemorystorage is a bug; it should behave the same way as its other counterparts.

The first test case after applying the inmemorystorage fix should fail on master, while the second test case should pass.

On a side note, should I open a bug for the fix I applied?

@raucao
Copy link
Member

raucao commented Dec 12, 2022

Ok, thanks. Confirmed.

On a side note, should I open a bug for the fix I applied?

Yes, I think that's a good idea.

@DougReeder
Copy link
Contributor

FWIW, I'm not familiar with this part of the code to knowledgeably review it. Thanks, everyone, for your work!

@raucao raucao merged commit 432ebe3 into remotestorage:master Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

ItemsMap doesn't match real object
3 participants