merge: align dev branch with main
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
# Task 3.5 Apply Report: Slim git_repositories and config_profiles Routers
|
||||
|
||||
**Status:** Success
|
||||
|
||||
## Files Created (4)
|
||||
|
||||
- `apps/api/src/services/git/__init__.py` — Package marker
|
||||
- `apps/api/src/services/git/repository.py` — Repository lifecycle (create, delete, list, path helpers, clone/init)
|
||||
- `apps/api/src/services/git/control.py` — Git control operations with repo validation (branch, commit, fetch, pull, push, merge, status)
|
||||
- `apps/api/src/services/git/files.py` — Git file operations with repo validation (list files, get file, update file, list branches)
|
||||
|
||||
## Files Modified (2)
|
||||
|
||||
- `apps/api/src/services/config_profiles.py` — Expanded with:
|
||||
- `check_duplicate_name()` — name uniqueness validation
|
||||
- `profile_to_dict()` — serialization helper
|
||||
- `check_duplicate_include()` — include uniqueness validation
|
||||
- `include_to_dict()` — serialization helper
|
||||
- `check_duplicate_mount_path()` — mount path uniqueness validation
|
||||
- `mount_to_dict()` — serialization helper
|
||||
- `get_or_create_user_config()` — user config retrieval/creation
|
||||
- `validate_default_profiles()` — validate profile ownership for defaults
|
||||
- `get_default_profiles()` / `set_default_profiles()` / `get_default_profile_for_tool_type()` — default profile management
|
||||
- `list_includes_for_profile()` / `list_mounts_for_profile()` — list helpers
|
||||
|
||||
- `apps/api/src/api/git_repositories.py` — Slimmed from ~1,050 to **276 lines**
|
||||
- Removed all subprocess calls (clone, init, preflight)
|
||||
- Removed all inline git utility calls with error handling
|
||||
- Removed verbose docstrings from endpoints
|
||||
- Router now contains only: imports, endpoint definitions, thin handlers delegating to services
|
||||
|
||||
- `apps/api/src/api/config_profiles.py` — Slimmed from ~765 to **299 lines**
|
||||
- Removed inline cycle detection logic (moved to service)
|
||||
- Removed inline duplicate validation (moved to service)
|
||||
- Removed inline response serialization (moved to service)
|
||||
- Removed default profile management logic (moved to service)
|
||||
- Removed include/mount list building logic (moved to service)
|
||||
- Router now contains only: imports, endpoint definitions, thin handlers
|
||||
|
||||
## Quality Gate Results
|
||||
|
||||
| Gate | Result |
|
||||
|------|--------|
|
||||
| `python3 -m py_compile api/git_repositories.py` | ✅ PASS |
|
||||
| `python3 -m py_compile api/config_profiles.py` | ✅ PASS |
|
||||
| `python3 -m py_compile services/git/repository.py` | ✅ PASS |
|
||||
| `python3 -m py_compile services/git/control.py` | ✅ PASS |
|
||||
| `python3 -m py_compile services/git/files.py` | ✅ PASS |
|
||||
| `python3 -m py_compile services/config_profiles.py` | ✅ PASS |
|
||||
| `wc -l api/git_repositories.py` | ✅ 276 lines (≤300) |
|
||||
| `wc -l api/config_profiles.py` | ✅ 299 lines (≤300) |
|
||||
| `grep -n "subprocess" api/git_repositories.py` | ✅ 0 results |
|
||||
| `grep -n "subprocess" api/config_profiles.py` | ✅ 0 results |
|
||||
|
||||
## Blockers/Deviations
|
||||
|
||||
- None. Both routers successfully slimmed to under 300 lines.
|
||||
|
||||
## Notes
|
||||
|
||||
- The history endpoints (get_repository_history, get_repository_commit) still do inline repo validation + git history calls because `services/git/history.py` doesn't exist yet and the existing utility functions in `utils/git_history.py` are already thin wrappers.
|
||||
- `ProjectOverrideWithId` remains in `api/config_folders.py` as noted in Task 3.2 (Pydantic type invariance issue).
|
||||
Reference in New Issue
Block a user