mirror of
https://github.com/azaion/ai-training.git
synced 2026-04-22 09:06:35 +00:00
Refactor constants management to use Pydantic BaseModel for configuration
- Replaced module-level path variables in constants.py with a structured Pydantic Config class. - Updated all relevant modules (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to access paths through the new config structure. - Fixed bugs related to image processing and model saving. - Enhanced test infrastructure to accommodate the new configuration approach. This refactor improves code maintainability and clarity by centralizing configuration management.
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
## Current Step
|
||||
flow: existing-code
|
||||
step: 5
|
||||
name: Run Tests
|
||||
status: not_started
|
||||
step: 6
|
||||
name: Refactor
|
||||
status: in_progress
|
||||
sub_step: 0
|
||||
retry_count: 0
|
||||
|
||||
@@ -31,6 +31,7 @@ retry_count: 0
|
||||
| 3 (sub 4) | Decompose Tests — Verification | 2026-03-26 | All 29 covered AC verified, no circular deps, no overlaps, dependencies table produced |
|
||||
| 3 | Decompose Tests | 2026-03-26 | 12 tasks total (1 infrastructure + 11 test tasks), 25 complexity points, 2 implementation batches |
|
||||
| 4 | Implement Tests | 2026-03-26 | 12/12 tasks implemented, 76 tests passing, 4 commits across 4 sub-batches |
|
||||
| 5 | Run Tests | 2026-03-26 | 76 passed, 0 failed, 0 skipped. JUnit XML in test-results/ |
|
||||
|
||||
## Key Decisions
|
||||
- Component breakdown: 8 components confirmed by user
|
||||
@@ -43,12 +44,24 @@ retry_count: 0
|
||||
- Tracker: jira (project AZ, cloud 1598226f-845f-4705-bcd1-5ed0c82d6119)
|
||||
- Epic: AZ-151 (Blackbox Tests), 12 tasks: AZ-152 to AZ-163
|
||||
- Task grouping: 55 test scenarios grouped into 11 atomic tasks by functional area, all ≤ 3 complexity points
|
||||
- Refactor approach: Pydantic BaseModel config chosen over env vars / dataclass / plain dict. pydantic 2.12.5 already installed via ultralytics.
|
||||
|
||||
## Refactor Progress (Step 6)
|
||||
Work done so far (across multiple sessions):
|
||||
- Replaced module-level path variables + get_paths/reload_config in constants.py with Pydantic Config(BaseModel) — paths defined once as @property
|
||||
- Migrated all 5 production callers (train.py, augmentation.py, exports.py, dataset-visualiser.py, manual_run.py) to constants.config.X
|
||||
- Fixed device=0 bug in exports.py, fixed total_to_process bug in augmentation.py
|
||||
- Simplified test infrastructure: conftest.py apply_constants_patch reduced to single config swap
|
||||
- Updated 7 test files to use constants.config.X
|
||||
- Rewrote E2E test to AAA pattern: Arrange (copy raw data), Act (production functions only: augment_annotations, train_dataset, export_onnx, export_coreml), Assert (7 test methods)
|
||||
- All 83 tests passing (76 non-E2E + 7 E2E)
|
||||
- Refactor test verification phase still pending
|
||||
|
||||
## Last Session
|
||||
date: 2026-03-26
|
||||
ended_at: Step 4 Implement Tests — All batches complete
|
||||
reason: auto-chain — Implement Tests complete, next is Run Tests
|
||||
notes: 76 tests passing across 12 tasks. All committed and pushed to dev. Virtual environment (.venv) created with requirements-test.txt. pytest.ini added for custom marks.
|
||||
date: 2026-03-27
|
||||
ended_at: Step 6 Refactor — implementation done, test verification pending
|
||||
reason: user indicated test phase not yet completed
|
||||
notes: Pydantic config refactor + E2E rewrite implemented. 83/83 tests pass. Formal test verification phase of refactoring still pending.
|
||||
|
||||
## Retry Log
|
||||
| Attempt | Step | Name | SubStep | Failure Reason | Timestamp |
|
||||
|
||||
Reference in New Issue
Block a user