omsf-eco-infra / ticgithub

Tools to use a GitHub repository as a support ticket system
MIT License
0 stars 0 forks source link

Field used as unique ID isn't unique to email #52

Open dwhswenson opened 10 months ago

dwhswenson commented 10 months ago

It looks like the value that I thought to be unique to an email is actually a thread identifier. Need to find the actual email-specific unique identifier.

This causes a failure in the assignment-to-gmail workflow:

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/tasks/assignment_to_gmail.py", line 57, in <module>
    AssignmentToGMail.run_cli()
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/tasks/task.py", line 54, in run_cli
    task(opts.dry)
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/tasks/task.py", line 97, in __call__
    self._run(cfg, dry)
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/tasks/assignment_to_gmail.py", line 53, in _run
    self.inbox.set_labels(issue.unique_id, labels_to_assign)
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/gmail.py", line 68, in set_labels
    msg = self.get_email(gm_msg_id)
  File "/home/runner/.local/lib/python3.10/site-packages/ticgithub/gmail.py", line 57, in get_email
    raise RuntimeError("More than 1 message for unique ID "
RuntimeError: More than 1 message for unique ID '1778837105830246017'

I think that fixing this requires:

  1. Changing the MSGID_PATTERN https://github.com/dwhswenson/ticgithub/blob/cd85036f39d6e2af61477c12504162b022510e37/ticgithub/gmail.py#L10
  2. Ensuring we fetch the right thing in GMailInbox.FETCH_STR: https://github.com/dwhswenson/ticgithub/blob/cd85036f39d6e2af61477c12504162b022510e37/ticgithub/gmail.py#L38