Address Gadfly review: gofmt, memoize bed grid, unify clamp
Build image / build-and-push (push) Successful in 15s

- gofmt domain.go struct alignment.
- Memoize the bed grid line arrays so a high-frequency plop drag doesn't
  rebuild them each pointermove.
- Route the non-snapping placement/move paths through snapLocalToBedGrid
  with step 0 (pure clamp), removing the duplicated inline clamps in
  GardenCanvas.onPlace and PlopOverlay (drop the dead clampLocal helper).
- Factor snapLocalToBedGrid's per-axis snap-and-clamp into one local fn.
- Correct the gardenFromInput doc: grid size is defaulted from 0 on update.
- Fix inconsistent indentation of the Inspector Notes field.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01JdQpdYYsTgtkJBxbcpAszi
This commit is contained in:
2026-07-19 03:06:42 -04:00
co-authored by Claude Opus 4.8
parent 3f4d5627d8
commit 677dbf0756
6 changed files with 51 additions and 47 deletions
+3 -1
View File
@@ -166,7 +166,9 @@ func (s *Service) DeleteGarden(ctx context.Context, actorID, gardenID int64) err
// gardenFromInput validates and normalizes input into a domain.Garden (without
// identity/ownership fields). With applyDefaults, absent dimensions/unit are
// filled in (create); without it, every field must be supplied (update).
// filled in (create); without it, dimensions and unit must be supplied (update).
// The grid size is the exception: 0 always means "unset" and is defaulted on both
// paths, so an older client that omits it can't wipe the column to an invalid 0.
func gardenFromInput(in GardenInput, applyDefaults bool) (*domain.Garden, error) {
name := strings.TrimSpace(in.Name)
if name == "" || len(name) > maxGardenNameLen {