ActivityWatch / aw-core

Core library for ActivityWatch
Mozilla Public License 2.0
48 stars 47 forks source link

Migration from peewee to sqlite loses some window titles #87

Closed xylix closed 4 years ago

xylix commented 4 years ago

Migrating my own buckets through starting aw-server with an existing peewee-database and letting it auto-migrate lost some of my window title data.

This will need to be solved before (if) we migrate users. Also need to test if rust migrations have the same issue.

Blocks PR: https://github.com/ActivityWatch/aw-core/pull/86 Screenshot 2020-02-19 at 11 52 29 The window titles existed before the migration.

There's also some new 2020-02-19 11:56:58 [WARNING]: Gap was of negative duration but could be safely merged (-7830.091s). This message will only show once per batch. (aw_transform.flood:46) warnings too.

ErikBjare commented 4 years ago

Well that's worrying. I have no idea how that could happen, doesn't the migration just copy over the entire data field of all the events?

The warning is unrelated.

xylix commented 4 years ago

Yes the migration seems to just copy over all the data. I'll try reproducing on a clean install and see what happens.

ErikBjare commented 4 years ago

Are you sure this happened in the migration and isn't an artifact of you not giving ActivityWatch the accessibility permission? Because that would give the exact same result...

On Wed, 19 Feb 2020, 11:55 Kerkko Pelttari, notifications@github.com wrote:

Yes the migration https://github.com/ActivityWatch/aw-core/blob/f43bbf47d2f192e1d104babff94e2aa8f9f5f226/aw_datastore/migration.py#L33 seems to just copy over all the data. I'll try reproducing on a clean install and see what happens.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ActivityWatch/aw-core/issues/87?email_source=notifications&email_token=AAKXDORZXCKHF4UEZ5ZH6Z3RDUF2PA5CNFSM4KXVYON2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMHJ7GI#issuecomment-588160921, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKXDOUCIOWJAP6HTLQN7ZLRDUF2PANCNFSM4KXVYONQ .

xylix commented 4 years ago

Yes that does actually make a lot of sense, now that I looked the titles are only missing for the days after I updated to Catalina. But the issue is not with activitywatch's permissions.

Screenshot 2020-02-19 at 14 57 51

I think it's most likely related to aw-watcher-window not having any permissions, since the .app starts it as a subprocess.

xylix commented 4 years ago

Oh right since this wasn't related to anything except macOS permissions I'll close this for now and if we see issues like this in the future probably open an issue in the main AW repo.

ErikBjare commented 4 years ago

There still needs to be a better indication what went wrong however. It would be a kinda nice improvement to new macOS users to check and make sure that they enable the permission.

Feel free to create an issue about that in the main repo.

xylix commented 4 years ago

Did that at https://github.com/ActivityWatch/activitywatch/issues/351