#36739: `manage.py check` unexpectedly accesses database when JSONField is used
-------------------------------------+-------------------------------------
Reporter: Storm Heg | Owner: (none)
Type: Bug | Status: new
Component: Core (System | Version: dev
checks) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* cc: charetttes, Tim Graham (added)
Comment:
Hello Storm, thank you for your report!
This is effectively a change in behavior. I would say expected though as
the commit intentionally made `check` perform all non-database tagged
checks against all databases and `JSONField.check` chain of registration
is not tagged `Tags.database`.
The question now becomes whether we want **all** checks that potentially
access the database to be tagged with `Tag.database`. From my
understanding the `Tag.database` tag was meant to convey ''check that the
database is setup properly'' and never ''might potentially access the
database'' so in this sense I don't think it would be appropriate.
Another way to see it is that `staticfiles` checks could perform access
control gated I/O to determine if they are properly setup (e.g. has access
to local or remote destination) some model checks and we don't treat them
differently. The fact this was surfaced as a potential problem here is
that `SimpleTestCase` was used to avoid database queries and previously
the suite of checks performed by default didn't access the database. The
thing is even if Django passes `databases=None` or doesn't call tests
tagged with `Tag.database` it cannot guarantee that the check it calls
actually don't access the database, it just happened to be the case within
Django core for a long time.
For these reasons I ''think'' we should keep things as they are but in all
cases I would likely augment the release notes to describe better that
this is expected and running `check` without `--tag database` might
require database access from now on.
Thoughts?
--
Ticket URL: <
https://code.djangoproject.com/ticket/36739#comment:2>