fix: refuse a str-subclass key in a database TEST dict instead of raising
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 62/100
Research direction
The reproduction calls databases_problems from neolith/_databases.py, and the fault sits in _entry_problems, which looks up the MIRROR, DEPENDENCIES and NAME keys in the TEST dict. Read that function and the rule K2 it cites, then run the snippet from the issue. Done means a str-subclass TEST key is refused with an error naming its type, the eq never runs, and exact-str keys behave as before.
Written by the indexing model from the issue text.
Description
Reproduction
On release/0.1.0a4 (07b71c6):
from neolith._databases import databases_problems
class Trap(str):
def __eq__(self, other):
raise RuntimeError("eq ran")
__hash__ = str.__hash__
pg = "django.db.backends.postgresql"
databases_problems({"billing": {"ENGINE": pg, "NAME": "n", "TEST": {Trap("MIRROR"): "x"}}}, ["billing"])
raises RuntimeError: eq ran; the same with Trap("NAME") or Trap("DEPENDENCIES"). _entry_problems looks "MIRROR", "DEPENDENCIES" and "NAME" up in the TEST dict, which runs the __eq__ of a str-subclass key with the same hash (rule K2).
Expected
A refusal naming the key's type, as for the entry's own keys: check that every TEST key is an exact str before any lookup.
- Dominant language
- Python
- Stars
- 1
- Forks
- 0
- Avg merge
- 6h 34m
- Merged PRs (30d)
- 108
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
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.
More from stack314/django-neolith
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#180 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
stack314/django-neolith#178 ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#151 · 1 comment ·
Maintainers usually reply within 1 day
-
help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#141 ·
Maintainers usually reply within 1 day
-
fix: refuse an unhashable HOST or PORT instead of raising TypeErrorPossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
stack314/django-neolith#140 · 1 comment ·
Maintainers usually reply within 1 day
All issues in stack314/django-neolith
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
bug (unverified)
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
scikit-hep/awkward#4581 · 1 comment ·
Maintainers usually reply within 1 day
-
ci-cd priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
LearningCircuit/local-deep-research#9163 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
supersonic-lumina/ENM156#50 ·
Maintainers usually reply within 2 days