Skip to content

fix: sort datamodel alphabetically#8139

Merged
CarolineDenis merged 8 commits into
mainfrom
issue-8138
Jul 7, 2026
Merged

fix: sort datamodel alphabetically#8139
CarolineDenis merged 8 commits into
mainfrom
issue-8138

Conversation

@grantfitzsimmons

@grantfitzsimmons grantfitzsimmons commented May 28, 2026

Copy link
Copy Markdown
Member

Fixes #8138

This PR sorts the tables in the data model alphabetically. See now that Absolute Age is at the top in both cases, which is the first by alphabetical sort.

image image image

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone
  • Add pr to documentation list
  • Add automated tests
  • Add a reverse migration if a migration is present in the PR
  • Add migration function to
    def fix_schema_config(stdout: WriteToStdOut | None = None):

Testing instructions

Make sure to test this against the latest v7 tagged release!

  • Verify that tables are sorted alphabetically in
    • Schema Viewer
    • Configure data entry tables
    • Configure interaction tables
    • Configure visible query tables
    • Record formatters app resources
    • Field formatters app resources
    • Form definitions

Summary by CodeRabbit

  • Refactor
    • Reworked data model table initialization into a two-pass, name-sorted flow to ensure consistent front-end field, relationship, and derived-field mapping.
  • Bug Fixes
    • Updated circular-table detection output to match the expected table set and ordering.
  • Tests
    • Refreshed the automapper circular-tables snapshot.
  • Documentation
    • Rewrapped the WbPlanView “UploadPlan” README section text.
  • Style / Maintenance
    • Applied minor code formatting cleanups across record-count sorting and JSX/layout; adjusted a migration dependency ordering.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 39f4072a-ed1c-4f2d-86b6-f2a71244f38c

📥 Commits

Reviewing files that changed from the base of the PR and between b9ddcc3 and 827c6c9.

📒 Files selected for processing (1)
  • specifyweb/specify/migrations/0046_alter_specifyuser_spprincipals.py

📝 Walkthrough

Walkthrough

Table initialization now registers all tables before per-table processing, the circular table snapshot reflects the new table order, and several related frontend and migration files are reformatted or re-ordered without logic changes.

Changes

Table initialization and ordering

Layer / File(s) Summary
Two-pass table initialization
specifyweb/frontend/js_src/lib/components/DataModel/tables.ts
fetchContext now builds sorted table pairs, registers every table in genericTables first, then processes fields, relationships, derived maps, front-end-only fields, and schemaExtras in a second pass.
Updated circular table snapshot
specifyweb/frontend/js_src/lib/components/WbPlanView/__tests__/automapper.test.ts
The circularTables() inline snapshot now expects "[table TectonicUnitTreeDefItem]" and no longer expects "[table TectonicUnit]".

Frontend formatting and dependency updates

Layer / File(s) Summary
Snapshot, formatting, and migration dependency
specifyweb/frontend/js_src/lib/components/WbActions/WbUpload.tsx, specifyweb/frontend/js_src/lib/components/WbActions/index.tsx, specifyweb/frontend/js_src/lib/components/WbPlanView/README.md, specifyweb/frontend/js_src/lib/components/WbPlanView/uploadPlanParser.ts, specifyweb/frontend/js_src/lib/components/WorkBench/DataSetMeta.tsx, specifyweb/specify/migrations/0046_alter_specifyuser_spprincipals.py
Record-count sorting callbacks, README wrapping, softFail argument formatting, DataSetMeta JSX, and the migration dependency reference were updated without behavior changes.

Suggested reviewers: emenslin

🚥 Pre-merge checks | ✅ 3 | ❌ 3

❌ Failed checks (1 warning, 2 inconclusive)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several formatting-only edits and the migration dependency change are unrelated to table sorting. Remove the unrelated formatting and migration edits, or split them into a separate PR, leaving only the alphabetical-sorting fix.
Automatic Tests ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
Testing Instructions ❓ Inconclusive Repository clone failed, so this custom check could not run with code access. Retry the review run. If this persists, inspect pre-merge custom-check logs for infrastructure or agent runtime failures.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the main change: sorting the datamodel alphabetically.
Linked Issues check ✅ Passed The sorted table initialization in tables.ts matches the issue’s request to list tables alphabetically in the affected UI contexts.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8138

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@grantfitzsimmons
grantfitzsimmons marked this pull request as draft May 28, 2026 21:37
@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@grantfitzsimmons
grantfitzsimmons marked this pull request as ready for review June 8, 2026 00:57
@grantfitzsimmons grantfitzsimmons modified the milestones: 7.12.0.7, 7.12.1 Jun 8, 2026
@CarolineDenis
CarolineDenis disabled auto-merge July 7, 2026 19:19
@CarolineDenis
CarolineDenis merged commit ea7b816 into main Jul 7, 2026
18 checks passed
@CarolineDenis
CarolineDenis deleted the issue-8138 branch July 7, 2026 19:19
@github-project-automation github-project-automation Bot moved this from 📋Back Log to ✅Done in General Tester Board Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅Done

Development

Successfully merging this pull request may close these issues.

Tables are not sorted alphabetically in all contexts

2 participants