Handle empty data in system info during setup - #8415
Conversation
|
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe system information endpoint now works before guided setup completes. It reports setup status and nullable metadata. Frontend types, statistics requests, tree creation, hierarchy configuration, navigation, fixtures, and tests handle incomplete setup safely. ChangesGuided setup system information
Sequence Diagram(s)sequenceDiagram
participant Client
participant system_info
participant GuidedSetup
participant InitialContext
participant Statistics
Client->>system_info: Request system_info.json
system_info->>GuidedSetup: Check setup completion
GuidedSetup-->>system_info: Return setup status
system_info-->>InitialContext: Return nullable or complete metadata
InitialContext->>Statistics: Send normalized request parameters
Statistics-->>InitialContext: Return statistics response
🚥 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: 3
🤖 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/backend/context/views.py`:
- Around line 726-728: In the exception handler surrounding collection lookup,
replace the broad Exception catch with Collection.DoesNotExist so only stale
collection cookies reset collection and discipline to None. Allow database
failures, empty-table IndexError, and other programming errors to propagate
normally.
In `@specifyweb/frontend/js_src/lib/components/Core/VersionMismatch.tsx`:
- Line 33: Update the version-mismatch enablement condition in VersionMismatch
so the dialog is shown only after setup is complete and
getSystemInfo().database_version is non-null; do not rely on the databaseVersion
fallback at the displayed description. Preserve the existing mismatch behavior
once both prerequisites are satisfied.
In `@specifyweb/frontend/js_src/lib/components/TreeView/CreateTree.tsx`:
- Around line 100-101: In CreateTree, use the discipline value from
getSystemInfo to block tree creation when it is empty, before setting
isTreeCreationStarted or invoking startTreeCreation; apply the same guard in the
ImportTree flow. When targeting connectedCollection, pass it through the
request’s collectionName field rather than collection so the backend uses the
intended specify_collection.
🪄 Autofix
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: 4367a886-809e-453b-a157-6bd5314abe17
📒 Files selected for processing (11)
specifyweb/backend/context/tests/test_system_info.pyspecifyweb/backend/context/views.pyspecifyweb/backend/setup_tool/api.pyspecifyweb/frontend/js_src/lib/components/Core/VersionMismatch.tsxspecifyweb/frontend/js_src/lib/components/InitialContext/__tests__/systemInfo.test.tsspecifyweb/frontend/js_src/lib/components/InitialContext/stats.tsspecifyweb/frontend/js_src/lib/components/InitialContext/systemInfo.tsspecifyweb/frontend/js_src/lib/components/SystemConfigurationTool/Hierarchy.tsxspecifyweb/frontend/js_src/lib/components/TreeView/CreateTree.tsxspecifyweb/frontend/js_src/lib/components/WbPlanView/navigator.tsspecifyweb/frontend/js_src/lib/tests/ajax/static/context/system_info.json
32f658b to
8cfef26
Compare
f4295ed to
b6c9475
Compare
Triggered by b6c9475 on branch refs/heads/issue-8387
Fixes #8387
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
New Features
Bug Fixes
Tests