summaryrefslogtreecommitdiff
path: root/internal/executor
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-03-23 06:50:10 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-03-23 06:50:10 +0000
commitbc62c3545bbcf3f9ccc508cdc43ce9ffdb5dfad0 (patch)
treee8ca80b85d63d695707bc27fd0cdda0cfbcb6fac /internal/executor
parent2c8ec3e53a0f4c6f2d16e94a95fcdce706717091 (diff)
feat: populate RepositoryURL from project registry in executor (ADR-007)
- Add GetProject to Store interface used by executor - Resolve RepositoryURL from project registry when task.RepositoryURL is empty - Call SeedProjects at server startup so the project registry is populated - Add GetProject stub to minimalMockStore in executor tests Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/executor')
-rw-r--r--internal/executor/executor.go15
-rw-r--r--internal/executor/executor_test.go1
2 files changed, 16 insertions, 0 deletions
diff --git a/internal/executor/executor.go b/internal/executor/executor.go
index 972c254..440294c 100644
--- a/internal/executor/executor.go
+++ b/internal/executor/executor.go
@@ -32,6 +32,7 @@ type Store interface {
UpdateTaskAgent(id string, agent task.AgentConfig) error
UpdateExecutionChangestats(execID string, stats *task.Changestats) error
RecordAgentEvent(e storage.AgentEvent) error
+ GetProject(id string) (*task.Project, error)
}
// LogPather is an optional interface runners can implement to provide the log
@@ -268,6 +269,13 @@ func (p *Pool) executeResume(ctx context.Context, t *task.Task, exec *storage.Ex
p.mu.Unlock()
}()
+ // Populate RepositoryURL from Project registry if missing (ADR-007).
+ if t.RepositoryURL == "" && t.Project != "" {
+ if proj, err := p.store.GetProject(t.Project); err == nil && proj.RemoteURL != "" {
+ t.RepositoryURL = proj.RemoteURL
+ }
+ }
+
err = runner.Run(ctx, t, exec)
exec.EndTime = time.Now().UTC()
@@ -701,6 +709,13 @@ func (p *Pool) execute(ctx context.Context, t *task.Task) {
priorExecs, priorErr := p.store.ListExecutions(t.ID)
t = withFailureHistory(t, priorExecs, priorErr)
+ // Populate RepositoryURL from Project registry if missing (ADR-007).
+ if t.RepositoryURL == "" && t.Project != "" {
+ if proj, err := p.store.GetProject(t.Project); err == nil && proj.RemoteURL != "" {
+ t.RepositoryURL = proj.RemoteURL
+ }
+ }
+
// Run the task.
err = runner.Run(ctx, t, exec)
exec.EndTime = time.Now().UTC()
diff --git a/internal/executor/executor_test.go b/internal/executor/executor_test.go
index 9dfd860..1f4e92f 100644
--- a/internal/executor/executor_test.go
+++ b/internal/executor/executor_test.go
@@ -1057,6 +1057,7 @@ func (m *minimalMockStore) UpdateExecutionChangestats(execID string, stats *task
return nil
}
func (m *minimalMockStore) RecordAgentEvent(_ storage.AgentEvent) error { return nil }
+func (m *minimalMockStore) GetProject(_ string) (*task.Project, error) { return nil, nil }
func (m *minimalMockStore) lastStateUpdate() (string, task.State, bool) {
m.mu.Lock()