Skip to content

Conversation

@modSpike
Copy link
Contributor

This branch will include some refactoring work to improve the efficiency of the app. First task is to reduce the number of calls to QSettings::sync(), and possibly refactor the update behavior of the FolderStatusModel

@update-docs
Copy link

update-docs bot commented Feb 25, 2025

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 Feb 25, 2025
@modSpike modSpike marked this pull request as draft February 25, 2025 13:48
modSpike added 2 commits March 4, 2025 18:53
…derMan named migrateFolderDefinition

improved loading from config to only save the extracted FolderDefintions if they were migrated

started prepping for deeper cuts related to Folder::saveToSettings, plus overhaul of impl and uses of FolderMan::addFolderFromFolderWizardResult and addFolderFromWizard
@ishabaral
Copy link
Contributor

Client crashed when squish tries to run client. Crash stracktrace and client logs are here:
https://drone.owncloud.com/owncloud/client/20530/4/11

modSpike added 20 commits March 5, 2025 15:27
…ccessors, all members are now private, FolderMan has been removed as friend

refactored addFolderInternal -> moved the small amount of actual folder adding code out and renamed it connectFolder. Also refactored unloadFolder -> moved some parts to removeFolderSync (formerly removeFolder which was easily confused with internal remove operations) and renamed it to disconnectFolder to match connectFolder activity.

put an end to the extra careful handling of "unexpected" Vfs modes - basically now if the mode isn't among our legit set, it just assumes VfsMode = off

added loads of todo's and other notes for next steps
ok param originally took a pointer to bool which makes no sense since it's a simple flag value, and most importantly not allowed to be nullptr. It should therefore be a ref.
Refactored the auto-loading of spaces/ocis folders on adding account. Moved the bulk of the activity to FolderMan where it belongs.
saving is still wonky and done in the folder sometimes but now I should be able to finally finish this persistence task now that loading spaces/folders from account is in the FolderMan.
need to validate the auto-save on changing pause or vfs mode as I think we will still get too many saves when enabling/disabling vfs in the Folder but otherwise it's in good shape now
last steps are to relocate the removeFromSettings operations from Folder to FolderMan
…n now

there are a couple of wonky bits but they should be ironed out in future when we convert direct calls from Gui to FolderMan to signals requesting xyz change
I have to do one more pass comparing functionality in AddFolderFromWizared to AddFolder, will tidy up and finally rename AddFolderFromWizard to something more sensible
@saw-jan
Copy link
Member

saw-jan commented Apr 10, 2025

@saw-jan thank you for the explanation. When do you expect this will be resolved?

we will first need adjust the .drone.star of all repos that use those secrets. We will track it in ticket owncloud/QA#883

@modSpike
Copy link
Contributor Author

aha! Excellent insight @saw-jan - that may make sense, since I did change how the folders are loaded from config but it should not be broken because of it, unless you are testing a really old config format or so. @ishabaral this may be important for you to know

For example, migration/handling of legacy settings groups named Multifolders and FoldersWithPlaceholders is now gone, because this was already migrated in 5.0 and instances in those groups should no longer exist.

If you can send me the config file this is breaking with I can have a look and try to see what is going on. I don't think I will be able to run with it, but sometimes just looking at it is enough.

@ishabaral
Copy link
Contributor

Tests generate these configs :

[Accounts]
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/davUrl=https://host.docker.internal:9200/dav/spaces/00dd906e-dcf3-40e9-a251-cfb98527a5f8$992c3152-5277-4669-b618-070c74b6c5c1/
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/ignoreHiddenFiles=true
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/localPath=/tmp/owncloudtest/Alice/Personal/
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/displayString=Personal
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/paused=false
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/targetPath=/
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/version=13
0/Folders/9247cb56-3253-4dff-8579-2e06c77e47f7/virtualFilesMode=off
0/dav_user=Alice
0/display-name=Alice Hansen
0/http_CredentialVersion=1
0/http_oauth=true
0/http_user=Alice
0/url=https://host.docker.internal:9200/
0/user=Alice
0/supportsSpaces=true
0/version=13
version=13
[ownCloud]
remotePollInterval=5000

Screenshot from 2025-04-10 14-14-37

@modSpike
Copy link
Contributor Author

@ishabaral that is very helpful, thanks!

so far, when I compare it to a real config created by the app using ocis, your test config is missing a lot of settings for the folders. I honestly have no idea if this is supposed to work without full settings. My gut tells me the complete set of settings should be present in any config file the app needs to use but let me look into it a bit. We have some local tests that use fake configs so once I find it, I'll compare to that to see what the "minimum" working config is.

just for reference, here is the folder related content of my config that is syncing just one folder (created by the app, not generated)

0\default_sync_root=C:/Users/reeseThinkpad/ownCloud (3)
0\http_CredentialVersion=1
0\http_oauth=true
0\http_user=katherine
0\user=katherine
0\userExplicitlySignedOut=false
0\supportsSpaces=true
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\localPath=C:/Users/reeseThinkpad/ownCloud (3)/Personal (2)/
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\journalPath=.sync_journal.db
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\targetPath=/
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\spaceId=166d1210-cdb9-50ab-9f1e-ecb9ef12a304$534bb038-6f9d-4093-946f-133be61fa4e7
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\davUrl=@variant(\0\0\0\x11\0\0\0nhttps://demo.owncloud.com/dav/spaces/166d1210-cdb9-50ab-9f1e-ecb9ef12a304$534bb038-6f9d-4093-946f-133be61fa4e7)
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\displayString=Personal
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\paused=false
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\ignoreHiddenFiles=true
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\deployed=false
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\priority=100
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\virtualFilesMode=wincfapi
0\Folders\699e15a3-2edd-4f2c-bc89-d96be456cc7d\version=13

@ishabaral
Copy link
Contributor

I tried to use most of the possible configs like this. But still same issue.

[Accounts]
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\davUrl=https://host.docker.internal:9200/dav/spaces/00dd906e-dcf3-40e9-a251-cfb98527a5f8$0f61c474-ac8e-420d-a3b8-ab767f0211e2
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\deployed=false
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\displayString=Personal
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\ignoreHiddenFiles=true
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\localPath=/home/isha/ownCloud (6)/Personal/
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\paused=false
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\priority=100
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\spaceId=00dd906e-dcf3-40e9-a251-cfb98527a5f8$0f61c474-ac8e-420d-a3b8-ab767f0211e2
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\targetPath=/
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\version=13
0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\virtualFilesMode=off
0\dav_user=admin
0\default_sync_root=/home/isha/ownCloud (6)
0\display-name=Admin
0\http_CredentialVersion=1
0\http_oauth=true
0\http_user=admin
0\supportsSpaces=true
0\url=https://host.docker.internal:9200/
0\user=admin
0\userExplicitlySignedOut=false
0\version=13
version=13

When using this config, I found out that this file .sync_journal.db is not created in this path, which should have been created

0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\localPath=/home/isha/ownCloud (6)/Personal/

@modSpike
Copy link
Contributor Author

modSpike commented Apr 10, 2025

I'm not sure what you mean - did adding the sync db entry to the config fix it?

or do you mean that the app did not create the sync db entry in the config when you added the folder sync

@ishabaral
Copy link
Contributor

I'm not sure what you mean - did adding the sync db entry to the config fix it?

or do you mean that the app did not create the sync db entry in the config when you added the folder sync

I mean that when starting the client this file: .sync_journal.db must be created in this path 0\Folders\1080ffb8-a2d3-41bf-842f-b02ef671df59\localPath=/home/isha/ownCloud (6)/Personal/ , but that is not created. This might not be the fix but one possible cause of the issue.

@modSpike
Copy link
Contributor Author

@ishabaral yes now I understand.

I need to discuss this with my guys as the journal is created when the application adds folders from scratch (eg on connecting an account the first time or adding a folder sync by hand).

the config is used to re-load folders which have been loaded from scratch in previous runs of the app, so it presumes the journals already exist. It assumes they live in the default location if the journal setting is empty, as it is for you, but it does not create the journal (since it should already exist).

IMO it's not a correct test to use a config the way it's being used because it does not match real life purpose of the config file (which is to save data from previous runs). To fix this current issue, the app would have to handle not-real-life functionality just to support the tests which I don't think is the right way, but again I need to discuss this with the team. Primarily what I need to find out is if we offer some "feature" to users to set up accounts/syncs using a config file that is not generated by the app, or whether the app should try to "heal" or fix configurations that are somehow broken for whatever reason. I'll get back to you asap.

Open question at the moment though: have you been using this type of config to create test scenarios for some time, right? Was that encouraged as a method of setting up the cases?

@saw-jan
Copy link
Member

saw-jan commented Apr 10, 2025

Open question at the moment though: have you been using this type of config to create test scenarios for some time, right? Was that encouraged as a method of setting up the cases?

I don't remember someone encouraging using the config file. But AFAIK, we used the config file to reduce the test run time by setting up the test accounts without having to go through the account setup dialog. We do have separate test scenarios for account setup dialog. Config file is used for tests that are not related to the account setup dialog.
So, it was a choice from our side to reduce the test execution time.

Let us know what will be the decision and then we can use the account setup flow for all test scenarios, and remove the config file usage

@modSpike
Copy link
Contributor Author

@ishabaral or @saw-jan can you please provide a log file associated with this test failure? So far I don't see how this problem can arise so the log might help.

@ishabaral
Copy link
Contributor

@modSpike Here is the log file:
client.log

@modSpike
Copy link
Contributor Author

Just a brief update after discussion with @erikjv: the current use of the "fake" config to bootstrap test cases is not ideal because it relies on behavior that is not officially supported for the user. In short the user needs to rely on the content of the config file which is generated by the app, and you should too, as "faking" it with a generated config can lead to missed bugs and false failures when we change code or features. Unfortunately it is not reasonable for us to intentionally support this corner use case for testing only, as it too often leads to confusing code, which we are trying to eliminate.

So we'd like to open an issue to update the account bootstrapping on your side. We are happy to support you with this, and we already have some proposals to hopefully keep the setup simple while bringing the tests in line with "real world" use cases. The question is: should I open a general issue for this task or a dedicated QA issue?

@saw-jan
Copy link
Member

saw-jan commented Apr 10, 2025

Thanks for the decision.

The question is: should I open a general issue for this task or a dedicated QA issue?

A dedicated QA issue would be great and then we can start workoing on that.

@modSpike
Copy link
Contributor Author

modSpike commented Apr 10, 2025

ETA: I know you are ending your day over in Nepal - please look at this tomorrow!

Regarding the log file results specifically which I'd still like to work out:

It appears that the authentication with the credentials in the config fails with some ssl error? It looks like the test causes a dialog to pop asking for re-authentication. Then it can connect. Is this actually part of the test? When you re-authenticate, is it actually using the correct server which contains the folder you have specced in the config?

Second, it appears that the test runs with local sync targets/folders that do not exist at all. It also appears that this is what causes the folder to not appear in the gui as from that point on, the folder loading fails so effectively, "no folder exists" to show there. Why this is, is still unclear to me as if I use a normal app generated config that points to a local folder that I have deleted, I still see the folder in the gui but it shows the local folder is missing and sync is blocked. Granted this is using windows/vfs so maybe there is a fundamental difference in how that is handled...still looking into it.

Third, and very important: as I pointed out previously, the gui shows "Synchronizing 0 out of 0 Spaces" If this generated config "matches" the target server I would expect it to contain at least one folder, which would be reported as "syncronizing 0 out of 1 spaces" or something in that direction. the fact that the server is reporting 0 available spaces makes me think something is quite wrong.

Will continue to look into possible fixes on my side but any additional info you can provide about these points would be really helpful.

@saw-jan
Copy link
Member

saw-jan commented Apr 10, 2025

It appears that the authentication with the credentials in the config fails with some ssl error? It looks like the test causes a dialog to pop asking for re-authentication. Then it can connect. Is this actually part of the test? When you re-authenticate, is it actually using the correct server which contains the folder you have specced in the config?

yeah, with pre-added config, we would see a cert accept dialog and have to re-authenticate when starting the client (as the config doesn't contain the cert and auth settings). The test would accept the cert and re-login again after starting the client and then perform the other checks.

Second, it appears that the test runs with local sync targets/folders that do not exist at all. It also appears that this is what causes the folder to not appear in the gui as from that point on, the folder loading fails so effectively, "no folder exists" to show there

Before starting the client, the test code will create the necessary sync paths. FYI, the test doesn't use the default sync and config paths, it uses the custom path in /tmp folder so that we don't mess with the existing personal sync folders.
These paths are defined in

return os.path.join(gettempdir(), 'owncloudtest')

XDG_CONFIG_HOME=/tmp/owncloudtest/.config

@saw-jan
Copy link
Member

saw-jan commented Apr 10, 2025

ETA: I know you are ending your day over in Nepal - please look at this tomorrow!

Sure, we will give this a priority. Thank you

@modSpike
Copy link
Contributor Author

current state includes workarounds for the current qa configs in the FolderMan::migrateFolderDefinition

those safety checks should be reevaluated and ideally removed once #12136 is resolved.

@modSpike modSpike marked this pull request as ready for review April 11, 2025 09:25
@saw-jan
Copy link
Member

saw-jan commented Apr 11, 2025

current state includes workarounds for the current qa configs in the FolderMan::migrateFolderDefinition

those safety checks should be reevaluated and ideally removed once #12136 is resolved.

Thanks a lot. we will let you know when the workaround can be removed.

@modSpike modSpike merged commit 4b05aed into master Apr 11, 2025
6 checks passed
@modSpike modSpike deleted the work/improveEfficiency branch April 11, 2025 10:02
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.

6 participants