Skip to content

Ensure every DB table has a default entry in schema_localization_en.json #8078

Description

@grantfitzsimmons

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:
    1. Loads schema_localization_en.json.
    2. Collects model table slugs
    3. Computes:
      • missing = model_tables - json_keys
      • extra = json_keys - model_tables
    4. Fails the test if missing is non-empty.
    5. 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).

Metadata

Metadata

Assignees

Labels

2 - Database/SchemaIssues that are related to the underlying database and schema2 - Schema ConfigIssues that are related to the Schema Config tool

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions