Skip to content

refactor: Extract raw SQL from routers/git.py to db layer (Invariant #1) #451

Closed

Description

@vybe

Problem

src/backend/routers/git.py:315 executes raw SQL directly against the DB, bypassing the service/db layer. Violates Architectural Invariant #1 (Three-Layer Backend: Router → Service → DB).

db.execute_query("DELETE FROM agent_git_config WHERE agent_name = ?", (agent_name,))

Context: orphan cleanup when agent has a DB row but no git config in the container.

Scope

  • Add a delete_agent_git_config(agent_name) operation to src/backend/db/git.py (or equivalent operations class used by git_service).
  • Call it from routers/git.py instead of the raw db.execute_query(...).
  • No behavior change.

Out of scope

Process engine router SQL (routers/processes.py, routers/triggers.py) — the Process Engine is dormant and explicitly out of scope (see CLAUDE.md). Those violations stay as-is until Process Engine is resumed or removed.

Acceptance Criteria

References

Activity

  1. added
    priority-p2
    type-refactor
    on Apr 22, 2026
  2. vybe commented on Apr 27, 2026

    @vybe
    ContributorAuthor

    Closed by merged PR.

  3. added a commit that references this issue on Apr 30, 2026
  4. added
    complexity-low
    theme-devex
    on Jun 3, 2026
  5. added a commit that references this issue on Sep 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    complexity-lowpriority-p2theme-devextype-refactor

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions