Opened 4 weeks ago
Last modified 31 hours ago
#36663 assigned Bug
Make management commands default to running checks against all databases
| Reported by: | Tim Graham | Owned by: | Simon Charette |
|---|---|---|---|
| Component: | Core (System checks) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Simon Charette, Varun Kasyap Pentamaraju | Triage Stage: | Ready for checkin |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
In 0b83c8cc4db95812f1e15ca19d78614e94cf38dd (refs #31055), many field checks stopped running by default (see ticket:31286#comment:10 for a long analysis), thus postponing warnings and errors that would be detected runserver or makemigrations until migrate.
As proposed by Simon in ticket:31286#comment:9, the running of these checks should be restored.
Change History (10)
comment:1 by , 4 weeks ago
| Has patch: | set |
|---|---|
| Needs documentation: | set |
comment:2 by , 4 weeks ago
| Cc: | added |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:3 by , 4 weeks ago
Simon, do you feel we shoul try to maintain the behavior: "Database checks are not run by default because they do more than static code analysis as regular checks do. They are only run by the migrate command or if you specify configured database aliases using the --database option when calling the check command."
I guess we would have to go back to detecting whether or not they requested via --tag=database.
comment:4 by , 3 weeks ago
| Cc: | added |
|---|---|
| Owner: | set to |
| Status: | new → assigned |
comment:5 by , 3 weeks ago
| Owner: | changed from to |
|---|
Varun, notice this has only been in flight for 8 days and has recent unanswered questions, it's not ready for the "vulture method" yet. Simon can correct me if he does not wish to be the owner.
comment:6 by , 2 weeks ago
Thanks for the assignment Jacob and sorry for not doing it myself.
Simon, do you feel we shoul try to maintain the behavior: "Database checks are not run by default because they do more than static code analysis as regular checks do. They are only run by the migrate command or if you specify configured database aliases using the --database option when calling the check command."
Tim, I don't have a strong opinion here, I'm slightly in favor of not special casing database checks but I think it's a distinct problem that would warrant a larger discussion. Do you have any objection on keeping this ticket focused on making sure that when database checks are run they default to all databases?
Any thoughts on the PR so far?
comment:8 by , 42 hours ago
You might have noticed it during the review Tim but the proposed patch happens to achieve exactly what you're after.
Since the implicit exclusion of Tags.databases is no longer applied all checks (including the Tags.databases ones) are now performed on all management commands unless --database is specified (on commands that support it like migrate and check).
A problem I see with this approach is that since system checks are performed by management commands by default (unless they are marked with requires_system_checks = False) it means that users who might be interested in achieving the previous behaviour cannot and must use --skip-checks to disable all of them. This is fine by me as it's aligned with the thinking that no checks are more special than others but I wanted to flag it for reviewers as I'll adjust the documentation accordingly.
comment:9 by , 41 hours ago
| Needs documentation: | unset |
|---|
Thinking more about this I ended up adjusting the PR slightly so it continues to not run database tagged checks by default but passes databases for all databases unless restricted with --database in check and migrate. I extended our regression test coverage to make sure these any change in this regards is explicit (as my initial draft inadvertently changed that).
As discussed above changing how databases tagged checks should be run should be discussed somewhere else as this ticket only ensures databases passing works the way it should have when we implemented #31055.
Given the change is pretty internal and a bugfix I don't think it warrants documentation but I'm happy to include some in the release notes if you believe otherwise.
comment:10 by , 31 hours ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
PR