Download this file
| 1 | package ownermode |
| 2 | |
| 3 | import ( |
| 4 | "amadan.net/oficina/equipo/internal/equipo/planning" |
| 5 | "amadan.net/oficina/equipo/internal/release" |
| 6 | "amadan.net/oficina/equipo/internal/runnerproto" |
| 7 | "gorm.io/gorm" |
| 8 | ) |
| 9 | |
| 10 | func AutoCandidate(tx *gorm.DB, c planning.ConnectionRecord, r runnerproto.ConnectionReport, m release.Manifest, eligible func(*gorm.DB, planning.ConnectionRecord, runnerproto.ConnectionReport) (bool, error)) (bool, bool, error) { |
| 11 | // Only an owner-mode report can become a coordinator; no release |
| 12 | // certifies any other. |
| 13 | if !r.OwnerMode { |
| 14 | return false, false, nil |
| 15 | } |
| 16 | if r.ProviderVersion != map[string]string{"claude": m.Claude, "codex": m.Codex}[r.Provider] || r.LauncherVersion != m.LauncherVersion || r.BwrapVersion != m.BwrapVersion || r.PolicyVersion != m.PolicyVersion || r.Kind != "subscription" { |
| 17 | return false, true, nil |
| 18 | } |
| 19 | ok, err := eligible(tx, c, r) |
| 20 | return ok, true, err |
| 21 | } |
| 22 | |