Skip to content

refactor: [DC-257] Folder to ensure it always has a sync engine #12501

Draft
modSpike wants to merge 24 commits intomasterfrom
refactor/dc-257
Draft

refactor: [DC-257] Folder to ensure it always has a sync engine #12501
modSpike wants to merge 24 commits intomasterfrom
refactor/dc-257

Conversation

@modSpike
Copy link
Copy Markdown
Contributor

to new static class. static class was chosen over namespace to ensure *all* related decls and defs are in one file.
@update-docs
Copy link
Copy Markdown

update-docs Bot commented Apr 13, 2026

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@modSpike modSpike self-assigned this Apr 13, 2026
@modSpike modSpike marked this pull request as draft April 13, 2026 08:55
modSpike added 11 commits April 13, 2026 10:56
missing tr function
also added a new, still empty folder builder shell as this will be used to construct the folder deps so they can be injected to the ctr instead of all this crazy code in the ctr itself
"fixed" is relative, as the tests in this area are confusing and I worry some results are not correct.

The tests are "fixed" insofar as the necessary prerequisite for calling addFolder is now fulfilled (ie the local folder actually exist on disk before calling addFolder)
@modSpike modSpike changed the title [DC-257] refactor Folder to ensure it always has a sync engine refactor: [DC-257] Folder to ensure it always has a sync engine Apr 16, 2026
also started cleaning up the crazy variety of smart pointers and refs related to these types. They are all QObject subs so the goal is that they should be owned by Folder, and wrapped in QPointer in other folder related classes that "need" them.
so far so good but if there are deeper problems they will assuredly show up on windows
…t of line with reality in terms of vfs instance ownership (side effect of never really caring in favor of using QSharedPointer, which is exactly why we should not use shared pointers unless there is true deomonstrated need!)

exacerbating the problem is that the FakeFolder::switchToVfs impl shares just a few bits on common with the real Folder::changeVfsMode that in my personal opinion it's not really testing modern behavior of the subsystem at all. This needs deep review.
I hope this finally fixes the alternating crashes on win vs mac - it's still just a bandaid until we review and fix these tests, especially the fake folder impl.
QFAIL(qUtf8Printable(error));
});
QSignalSpy spy(vfs.get(), &OCC::Vfs::started);
QObject::connect(vfs, &OCC::Vfs::error, vfs, [](const QString &error) { QFAIL(qUtf8Printable(error)); });
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.

not your fault, but assert here instead of a QFAIL. QFail here will only print a message, and execution continues until other problems occur later.

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.

I'm not sure it's fully desired for the tests to stop in this specific case. In theory (at least in my mind) we may want to have tests that cover handling of vfs errors in the app? Let's discuss this one in more detail.


// don't use QVERIFY outside of the test slot
if (spy.isEmpty() && !spy.wait()) {
QFAIL("VFS Setup failed");
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.

same as above: assert here please.

these are all over the place and it's often the case that one or other values are needed but not all.

key point is it carries the vfs pointer which we want to restrict as much as possible. now that is private with getter only, and checks have been added for nullptr on all consumers that arise from SyncOptions (so far).

got rid of dead regex related stuff in syncoptions so now all that is left is the vfs pointer, move to trash and parallel network job count
got rid of the godforesaken shared pointer on the propagator in sync engine -> this will hopefully fix the linux tests but let's see

also removed the handling of moveToTrash from the sync options, they should now be handled similar to ignoreHiddenFiles
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