GAM-team / GAM-team/got-your-back

Adding to existing label fails

Open
#385 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
3.1k
Forks
245
PR merge metrics
No merged PRs in 30d

Description

Please confirm the following:
* I have upgraded to the latest GYB release from https://github.com/jay0lee/got-your-back/releases and I still have this issue.
Yes

* I am typing the command as described in the GAM Wiki at https://github.com/jay0lee/got-your-back/wiki
Yes

Full steps to reproduce the issue:
1. Counting messages on target mailbox with label SomeLabel **before restore** `gyb --email target@gmail.com --action estimate --search "label:SomeLabel"`

```
Got 939 Message IDs
GYB needs to examine 939 messages
GYB already has a backup of 0 messages
Estimated size 17.31mb 939/939 messages
```

3. Restoring 69 messages with command `gyb --email target@gmail.com --action restore --local-folder GYB-GMail-Backup-source@gmail.com --label-restored "SomeLabel"` gives warning on every message

```
...
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 30 messages (30/69)
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 30 messages (60/69)
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
WARNING: failed to create (existing?) label SomeLabel
restoring 9 messages (69/69)
```

4. Counting SomeLabel messages in target **after restore**

```
Got 989 Message IDs
GYB needs to examine 989 messages
GYB already has a backup of 0 messages
Estimated size 19.14mb 989/989 messages
```

**Expected outcome (what are you trying to do?):**

All messages imported successfullly to label SomeLabel

**Actual outcome (what errors or bad behavior do you see instead?):**

Only 50 messages were imported into the label out of 69

So the script doesn't allow importing messages to the label that already exists and doesn't imports correctly. Please, fix it.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the restore using the documented `gyb` commands and an existing `SomeLabel`, comparing the before and after message counts. Trace the restore and label-creation entry points involved in `--label-restored`; done means all 69 messages are imported under the existing label without repeated warnings and the post-restore count is correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.