cleanup: remove 2,369 lines of dead code

Removed backup files and unused legacy scanner function.
All code verified as unreferenced.
This commit is contained in:
Fimeg
2025-11-10 21:20:42 -05:00
parent 1f2b1b7179
commit c95cc7d91f
32 changed files with 5899 additions and 567 deletions

View File

@@ -1,6 +1,7 @@
package queries
import (
"context"
"database/sql"
"fmt"
"time"
@@ -324,3 +325,46 @@ func (q *AgentQueries) UpdateAgentUpdatingStatus(id uuid.UUID, isUpdating bool,
_, err := q.db.Exec(query, isUpdating, versionPtr, time.Now(), id)
return err
}
// CompleteAgentUpdate marks an agent update as successful and updates version
func (q *AgentQueries) CompleteAgentUpdate(agentID string, newVersion string) error {
query := `
UPDATE agents
SET
current_version = $2,
is_updating = false,
updated_at = CURRENT_TIMESTAMP
WHERE id = $1
`
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
result, err := q.db.ExecContext(ctx, query, agentID, newVersion)
if err != nil {
return fmt.Errorf("failed to complete agent update: %w", err)
}
rows, err := result.RowsAffected()
if err != nil || rows == 0 {
return fmt.Errorf("agent not found or version not updated")
}
return nil
}
// SetAgentUpdating marks an agent as updating with nonce
func (q *AgentQueries) SetAgentUpdating(agentID string, isUpdating bool, targetVersion string) error {
query := `
UPDATE agents
SET is_updating = $2, updating_to_version = $3, updated_at = CURRENT_TIMESTAMP
WHERE id = $1
`
_, err := q.db.Exec(query, agentID, isUpdating, targetVersion)
if err != nil {
return fmt.Errorf("failed to set agent updating state: %w", err)
}
return nil
}