openlibhums / openlibhums/janeway

Use constants in `log_dict`

Open
#4,028 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Infrastructure Priority medium refactoring Size L
Dominant language
Python
Stars
238
Forks
97
Avg merge
9d 1h
Merged PRs (30d)
8

Description

Problem
The email logs rely on a dictionary that is passed through about 5-6 layers of function calls, ending up here:

https://github.com/BirkbeckCTP/janeway/blob/bcc90328e7c908b6f75d66b73829e2a09e8ce329/src/utils/notify_plugins/email_log.py#L18-L25

With the keys being strings, it is easy to introduce errors that result in inaccurate or incomplete logs. See #3810.

Proposed solution
Refactor using constants.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/utils/notify_plugins/email_log.py at lines 18-25, then trace the dictionary through the five to six function-call layers described in the issue. Identify the repeated string keys and replace their use with constants without changing the email log contents. Done means the logs remain accurate and the key-name errors described in #3810 are prevented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
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.