opensafely-core / opensafely-core/opencodelists
Bug report: Many Cached hierarchies often do not reflect the current CodelistVersion state
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 60
- Forks
- 16
- Avg merge
- 4d 12h
- Merged PRs (30d)
- 17
Description
Summary
Many cached hierarchies do not reflect the current state of a CodelistVersion, leading to incorrect assertions regarding the CodelistVersion's CodingSystemRelease compatibility.
What did you do and what did you expect to happen?
Expectation:
>>> cv = CodelistVersion.objects.get_by_hash("3f51e9b7")
>>> cv.hierarchy == cv.calculate_hierarchy(cv.coding_system)
True
Counter-example:
>>> cv = CodelistVersion.objects.get_by_hash("5b45576f")
>>> cv.hierarchy == cv.calculate_hierarchy(cv.coding_system)
False
Impact of the bug
When loading a new CodingSystemRelease, a CodelistVersion's cached hierarchy is compared against one calculated using the incoming release. Whether or not they are found to be the same is considered as part of whether the CodelistVersion is "compatible" with the release.
If the cached hierarchy is an inaccurate representation of the current state of the CodelistVersion, then it may lead to incorrect assertions of incompatibility of the version with a release.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two CodelistVersion examples using the hashes in the issue and compare hierarchy with calculate_hierarchy(cv.coding_system). Trace how the cached hierarchy is stored or refreshed, then add coverage showing it matches the current CodelistVersion state and no longer produces incorrect compatibility results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 45/100