-
Notifications
You must be signed in to change notification settings - Fork 0
Cantis/issue4 #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Fixes #4
…late services - Implement integration tests for force_service.py covering CRUD operations, lance management, miniature assignment, active force invariants, and import/export functionality. - Add unit tests for force_service.py focusing on basic CRUD operations, edge cases, and error handling. - Create integration tests for lance_template_service.py including CRUD operations, pattern matching, and import/export scenarios. - Develop unit tests for lance_template_service.py emphasizing CRUD operations, pattern matching, and error handling during imports.
…fill next available ID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive faction support to the miniature inventory system, including UI filtering, database schema updates, and an extensive test suite covering the service layer.
Key Changes:
- Added faction field to miniature model with database migration support
- Implemented faction filtering in miniature list view with distinct faction query
- Created comprehensive test infrastructure with 55 new tests split between unit and integration
- Added intelligent unique ID gap-filling algorithm for miniature creation
- Enhanced session management with eager loading patterns to prevent detached instance errors
Reviewed changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/models/miniature.py | Added nullable faction field (String 64) to miniature model |
| app/services/miniature_service.py | Added get_next_unique_id() function, faction filtering, and get_distinct_factions() |
| app/blueprints/miniatures.py | Integrated faction dropdown with custom input, passed factions to templates |
| app/blueprints/forces.py | Preserved faction filter parameters when redirecting after miniature operations |
| app/templates/miniatures/list.html | Added faction filter button group and preserved faction in all URL parameters |
| app/templates/miniatures/add.html | Added faction dropdown with custom input, prefilled next_id, default status to "New" |
| app/templates/miniatures/edit.html | Added faction dropdown with custom input capability |
| app/services/force_service.py | Added thread safety documentation, standardized error messages, included faction in exports |
| app/services/lance_template_service.py | Fixed export timestamp field name, added eager loading before expunge |
| tests/conftest.py | Created comprehensive fixture infrastructure with clear_seed_data, dynamic series generation |
| tests/test_miniatures.py | Added 8 new tests for unique_id gap-filling and faction saving |
| tests/test_force_service_unit.py | Created 19 unit tests for force operations |
| tests/test_force_service_integration.py | Created 16 integration tests with realistic data |
| tests/test_lance_template_service_unit.py | Created 9 unit tests for template operations |
| tests/test_lance_template_service_integration.py | Created 11 integration tests for pattern matching |
| tests/TEST_RESULTS.md | Documented test results, known issues, and fixes applied |
| pyproject.toml | Bumped version to 1.0.1, added pytest plugins and configuration |
| Docs/TESTING.md | Created comprehensive testing guide with examples |
| .github/workflows/tests.yml | Added CI/CD workflow with unit, integration, and parallel test jobs |
Comments suppressed due to low confidence (1)
app/services/force_service.py:1
- The result dictionary key 'imported_count' is inconsistent with the actual key returned by import_force_from_json(), which uses 'imported_miniatures'. This will cause a KeyError at runtime.
"""Force management service for MechBay.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Add the faction settings, update tests. closes #4