There are some inconsistencies between the Django models in models.py and the schema localization file at schema_localization_en.json. We need to add a unit test to prevent regressions: every data model table used by the application should have a default localization entry in schema_localization_en.json, and any JSON-only entries should be reviewed.
Tables present in models but missing from schema_localization_en.json
- autonumschcoll
- autonumschdiv
- autonumschdsp
- component
- modelwithtable
- project_colobj
- specifyuser_spprincipal
- spexportschema_exportmapping
- spprincipal_sppermission
- tectonicUnittreedefitem
Tables present in schema_localization_en.json but not found in the models
- dnasequencerunattachment
- libraryrole
- libraryrolepolicy
- message
- role
- rolepolicy
- spattachmentdataset
- spdataset
- spdatasetattachment
- spmerging
- spuserexternalid
- tectonicunittreedefitem
- uniquenessrule
- uniquenessrulefield
- userpolicy
- userrole
Notes
- Some discrepancies are probably legitimate (system or legacy tables kept for backward compatibility, intentionally omitted model-generated tables, or namespaced/join tables). Others (e.g.,
component) are genuine omissions that should be added and rely on migrations currently for coverage.
Proposed unit test
- Add a test that:
- Loads
schema_localization_en.json.
- Collects model table slugs
- Computes:
- missing = model_tables - json_keys
- extra = json_keys - model_tables
- Fails the test if
missing is non-empty.
- Optionally warn on
extra, or fail if extra contains tables that are not on an allowlist of intentionally JSON-only keys.
- Make it so we can provide a short allowlist for system/legacy tables that we intentionally keep in JSON even if no model exists.
Acceptance criteria
- The test must fail on CI if any model table lacks a
schema_localization_en.json key (unless explicitly allowed).
- The test output must be actionable: list missing keys and file/line or model name when possible.
- There must be support for allowlist entries for known exceptions (if desirable).
There are some inconsistencies between the Django models in
models.pyand the schema localization file atschema_localization_en.json. We need to add a unit test to prevent regressions: every data model table used by the application should have a default localization entry inschema_localization_en.json, and any JSON-only entries should be reviewed.Tables present in models but missing from
schema_localization_en.jsonTables present in
schema_localization_en.jsonbut not found in the modelsNotes
component) are genuine omissions that should be added and rely on migrations currently for coverage.Proposed unit test
schema_localization_en.json.missingis non-empty.extra, or fail ifextracontains tables that are not on an allowlist of intentionally JSON-only keys.Acceptance criteria
schema_localization_en.jsonkey (unless explicitly allowed).