@@ -19,6 +19,8 @@ import ( |
| 19 | 19 | "github.com/tenseleyFlow/shithub/internal/auth/throttle" |
| 20 | 20 | "github.com/tenseleyFlow/shithub/internal/git/hooks" |
| 21 | 21 | "github.com/tenseleyFlow/shithub/internal/infra/storage" |
| 22 | + "github.com/tenseleyFlow/shithub/internal/issues" |
| 23 | + issuesdb "github.com/tenseleyFlow/shithub/internal/issues/sqlc" |
| 22 | 24 | repogit "github.com/tenseleyFlow/shithub/internal/repos/git" |
| 23 | 25 | reposdb "github.com/tenseleyFlow/shithub/internal/repos/sqlc" |
| 24 | 26 | "github.com/tenseleyFlow/shithub/internal/repos/templates" |
@@ -182,6 +184,20 @@ func Create(ctx context.Context, deps Deps, p Params) (Result, error) { |
| 182 | 184 | } |
| 183 | 185 | } |
| 184 | 186 | |
| 187 | + // Seed the issue subsystem state for the new repo: counter row + |
| 188 | + // default label set. Runs inside the create tx so a failed seed |
| 189 | + // rolls the whole repo back. Cheap (10 inserts), and folding it in |
| 190 | + // here keeps the "fresh repo is fully usable" invariant. Issues |
| 191 | + // orchestrator's SeedDefaultLabels swallows unique-violations so a |
| 192 | + // re-run is a no-op (defensive against partially-seeded migrations). |
| 193 | + iq := issuesdb.New() |
| 194 | + if err := iq.EnsureRepoIssueCounter(ctx, tx, row.ID); err != nil { |
| 195 | + return Result{}, fmt.Errorf("repos: issue counter: %w", err) |
| 196 | + } |
| 197 | + if err := issues.SeedDefaultLabels(ctx, tx, row.ID); err != nil { |
| 198 | + return Result{}, fmt.Errorf("repos: seed labels: %w", err) |
| 199 | + } |
| 200 | + |
| 185 | 201 | var commitOID string |
| 186 | 202 | if wantInit { |
| 187 | 203 | commitWhen := p.InitialCommitWhen |