Skip to content

Cantis/issue4#7

Open
cantis wants to merge 7 commits intomainfrom
cantis/issue4
Open

Cantis/issue4#7
cantis wants to merge 7 commits intomainfrom
cantis/issue4

Conversation

@cantis
Copy link
Owner

@cantis cantis commented Jan 2, 2026

Add the faction settings, update tests. closes #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.
@cantis cantis requested a review from Copilot January 2, 2026 18:24
Copy link

Copilot AI left a 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Faction Setting & Mode

1 participant