Test: Add tests to ensure every DB table has a default entry in schem… - #8341
Conversation
…a_localization_en.json
|
Warning One or more dependencies are approaching or past End-of-Life. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Django test that parses model table declarations, compares them with ChangesSchema localization coverage
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@specifyweb/specify/tests/test_schema_localization_contract.py`:
- Around line 37-38: Update the AST extraction logic in the schema localization
contract test to retain each associated model name alongside the lowercased
table slug instead of storing only stmt.value.value. Propagate that model name
into the missing-entry failure reported by the test so failures identify the
model and table involved, while preserving the existing table-name matching
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 1c06851d-778a-4988-93e0-6cf5860402e3
📒 Files selected for processing (1)
specifyweb/specify/tests/test_schema_localization_contract.py
grantfitzsimmons
left a comment
There was a problem hiding this comment.
Pretty cool idea! Nice!
- When there are no unexpected extras, printing "Unexpected schema localization-only tables:" with nothing after it is not needed.
- The allowlist is also part of the body, but should we maintain this list elsewhere? Are these tables excluded from any other part of the app (e.g. schema config) or should be?
- We could add feedback for future developers here like "Add entries to the
schema_localization_en.jsonfile or update the allowlist" - A count summary of the number of tables at the top would be nice, but totally optional
grantfitzsimmons
left a comment
There was a problem hiding this comment.
This PR now adds defaults for component (which I should have done a long time ago). It matches MIGRATION_0040_UPDATE_FIELDS in sp7_schemaconfig.py:
specify7/specifyweb/specify/migration_utils/sp7_schemaconfig.py
Lines 426 to 436 in a6a08e0
I added the remaining many-to-many join tables (autonumsch_coll, autonumsch_div, autonumsch_dsp, project_colobj, sp_schema_mapping, specifyuser_spprincipal, spprincipal_sppermission) to the allowlist since we do not want these to have schema config records.
…a_localization_en.json
Fixes #8078
Checklist
self-explanatory (or properly documented)
specify7/specifyweb/specify/management/commands/run_key_migration_functions.py
Line 50 in ea04665
Testing instructions
Summary by CodeRabbit
componentsection to the schema localization configuration, including localized field metadata for component-related entries.