Add GitService foundation + schema for git integration#8
Conversation
Self-Review FindingsCross-branch contamination: CLEANVerified full Schema consistency: PASSAll 3 locations (connection.py inline, models_metadata.py SA, migration 010) define the same 7 columns with matching types and defaults. Defects found and fixed (commit db8ee1f)1. 2. 3. Known limitations (not bugs, intentional or deferred)4. 5. |
Core git operations service with subprocess-based git commands wrapped in asyncio.to_thread(). Adds git columns to projects and tasks tables, config constants, Pydantic schema fields, route updates, and DI wiring. Phase 1 of 5 — no execution wiring yet, just the foundation. - GitService: validate_repo, branch/checkout/merge/delete, worktree create/remove, stage_and_commit, diff/status/log, dirty state detection with "is ours" heuristic, backup/discard/revert, push, PR - Migration 010: repo_path, git_base_branch, git_project_branch, git_worktree_path, git_state_json on projects; git_branch, git_commit_sha on tasks - Config: git.enabled, commit_author, branch_prefix, auto_pr, etc. - 33 unit tests using real temp repos (no git mocking) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tring - create_pr: catch subprocess.TimeoutExpired separately (doesn't inherit from OSError, would propagate uncaught if gh hangs) - get_log: use ASCII unit separator (\x1f) instead of pipe as delimiter to handle commit messages containing | characters - backup_dirty_state: clarify docstring that original branch is left clean Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The analytics PR (merged to main) added migration 010_add_usage_task_index.
Our migration was also numbered 010 with an incorrect down_revision
("009_task_events_fk_and_indexes" instead of "009"). Renumber to 011
and chain from "010" to maintain a linear migration history.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
db8ee1f to
fe22ba7
Compare
merge_branch() only checked UU and AA conflict markers. Added DD, AU, UA, DU, UD to cover all git unmerged states (both deleted, add/modify, delete/modify conflicts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Post-Rebase ReviewReviewed the full diff ( Conflict resolution
Defect found and fixed (commit 182570c)
Design limitation (not a bug, deferred)
Pre-existing issue on main (not this PR)
Cross-contamination check: CLEANAll 11 files are git-integration only. No analytics, external execution, API key, or other unrelated changes present. |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- CLAUDE.md: add git_service.py, analytics.py to structure, add git convention, update test counts (578 backend, 137 frontend) - architecture.md: update container tree (all 13 providers), expand schema to 10+ tables, add Git Integration section with phase status, add git-related gotchas, update dep map and test counts Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nd more - Extract shared JSON utilities to backend/utils/json_utils.py (#37) - Fix quadratic token growth in Claude agent via message pruning (#8) - Fix context forwarding race with per-dep transaction (#9) - Fix budget leak on plan parse failure by recording spend before re-raise (#11) - Fix verification feedback cap with proper sliding window (#17) - Include RUNNING tasks in cancel_project (#18) - Add retry limit check to review_task retry action (#19) - Switch to paragraph-based requirement numbering (#21) - Skip budget check for Ollama-only projects (#23) - Make HTTP client timeout configurable (#35) - Add timeout + budget skip to verifier and knowledge extractor (#36) - Truncate long output before sending to verifier (#38) - Add _reset_warned_models() with autouse fixture (#44) - 22 new tests covering all findings Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary
GitService— stateless git operations service wrapping subprocess calls viaasyncio.to_thread()with configurable timeoutprojects(repo_path, git_base_branch, git_project_branch, git_worktree_path, git_state_json) andtasks(git_branch, git_commit_sha)This is Phase 1 of 5 from the git integration plan. It adds the foundation (service + data model) without any execution wiring. Subsequent phases will integrate with the executor, add git tools for agents, API routes, and worktree isolation.
GitService capabilities
.orchestration/dir, branch prefix)ghCLI (graceful fallback)Config additions (
config.example.json)Test plan
tests/unit/test_git_service.py— all use real temp git repos, no mockingGenerated by Claude Code · Claude Opus 4.6