Agent: what a day of live use asked for #127

Merged
steve merged 4 commits from feat/agent-live-test-fixes into main 2026-08-23 04:29:22 +00:00
Showing only changes of commit ac9f6e8c63 - Show all commits
+12 -6
View File
@@ -212,10 +212,13 @@ func TestFillRegionRejectsNonFiniteRegion(t *testing.T) {
} }
} }
// TestFillRegionOutsideObjectPlantsNothing covers a region that misses the object // TestFillRegionOutsideObjectIsRefused covers a region that misses the object
// entirely. clampTo inverts such a region rather than emptying it, and an // entirely. clampTo inverts such a region rather than emptying it; it used to
// inverted region must plant nothing — not one plop at some point off the bed. // plant nothing and report success, which read as "done" to a caller that had
func TestFillRegionOutsideObjectPlantsNothing(t *testing.T) { // aimed at the wrong coordinates — the agent, mixing up the garden frame and
// the bed's local one. Now it is an error, and still never one plop at some
// point off the bed.
func TestFillRegionOutsideObjectIsRefused(t *testing.T) {
ctx := context.Background() ctx := context.Background()
s := newTestService(t, openConfig()) s := newTestService(t, openConfig())
owner := seedUser(t, s, "[email protected]") owner := seedUser(t, s, "[email protected]")
@@ -225,12 +228,15 @@ func TestFillRegionOutsideObjectPlantsNothing(t *testing.T) {
// Wholly east of the bed: clampTo gives MinX=500, MaxX=50. // Wholly east of the bed: clampTo gives MinX=500, MaxX=50.
created, err := s.FillRegion(ctx, owner, bed.ID, rect(500, -50, 600, 50), plant.ID, nil, FillClump, nil) created, err := s.FillRegion(ctx, owner, bed.ID, rect(500, -50, 600, 50), plant.ID, nil, FillClump, nil)
if err != nil { if !errors.Is(err, domain.ErrInvalidInput) {
t.Fatalf("FillRegion: %v", err) t.Errorf("FillRegion outside the bed: err = %v, want ErrInvalidInput", err)
} }
if len(created) != 0 { if len(created) != 0 {
t.Errorf("filled %d plops for a region outside the bed, want 0: %+v", len(created), created) t.Errorf("filled %d plops for a region outside the bed, want 0: %+v", len(created), created)
} }
if full, _ := s.GardenFull(ctx, owner, g.ID, nil); len(full.Plantings) != 0 {
t.Errorf("the bed holds %d plops after a refused fill", len(full.Plantings))
}
} }
// seedFillBed makes a plantable bed of the given size centered in a big garden. // seedFillBed makes a plantable bed of the given size centered in a big garden.