Wire Marvin tasks adapter into the daemon

main constructs the Marvin adapter (command overridable via
ANTIDRIFT_MARVIN_CMD) and injects it. Adds a web test asserting the
planning state payload carries today's tasks.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-31 22:07:20 -04:00
parent c4eb870808
commit e832a2da85
2 changed files with 40 additions and 0 deletions
+32
View File
@@ -13,6 +13,7 @@ import (
"antidrift/internal/domain"
"antidrift/internal/evidence"
"antidrift/internal/session"
"antidrift/internal/tasks"
"github.com/gin-gonic/gin"
)
@@ -230,6 +231,37 @@ func TestServesStaticAssets(t *testing.T) {
}
}
type stubProvider struct {
list []tasks.Task
}
func (s stubProvider) Today(ctx context.Context) ([]tasks.Task, error) {
return s.list, nil
}
func TestPlanningStatePayloadCarriesTasks(t *testing.T) {
s := newTestServer(t)
s.ctrl.SetTasks(stubProvider{list: []tasks.Task{{ID: "a", Title: "Write the spec", Day: "2026-05-31"}}})
r := s.Router()
if w := post(t, r, "/planning", ""); w.Code != http.StatusOK {
t.Fatalf("/planning code %d", w.Code)
}
deadline := time.Now().Add(2 * time.Second)
for time.Now().Before(deadline) {
if tv := s.ctrl.State().Tasks; tv != nil && tv.Status == "ready" {
break
}
time.Sleep(5 * time.Millisecond)
}
js := s.stateJSON()
if !strings.Contains(js, `"tasks"`) {
t.Fatalf("planning payload missing tasks object: %s", js)
}
if !strings.Contains(js, `"title":"Write the spec"`) {
t.Fatalf("planning payload missing task title: %s", js)
}
}
func TestCommitmentCarriesAllowedClassesAndRoutesWork(t *testing.T) {
s := newTestServer(t)
r := s.Router()