14a821dc

Author: Michael Lynch <git@mtlynch.io>

Committer: Michael Lynch <mtlynch@noreply.codeberg.org>

Validate grocery sections with typed values (#75)

Add a Section type that trims leading and trailing whitespace and rejects empty section names. Include a MustCreateNewSection helper for known-valid test values and SQLite read paths where invalid persisted data should fail immediately.

Move section-bearing handler and store APIs to use typed section values, converting to raw strings only at user-input, rendering, and SQLite boundaries. Keep item-section JSON and template view models as handler-owned string representations so browser responses remain stable while application logic uses typed values.

Add a SQLite migration that trims legacy section names across grocery items, item-section mappings, stored list items, and section ordering. The migration rebuilds section_ordering through a temporary table keyed by the trimmed name so entries that collide after trimming collapse to the earliest sort order.

Testing:
- ./dev-scripts/run-go-tests
- ./dev-scripts/git-hooks/pre-commit
- nix flake check

Reviewed-on: https://codeberg.org/mtlynch/grosiree/pulls/75

Suite timing

Time to Start Worker time Duration Time to finish
Config 2s 8s 8s 10s
Eval 7s 30s 30s 37s
Build 11s 2m24s 33s 44s
Suite 2s 3m02s 42s 44s

Timeline

0s10s20s30s40s