Commit graph

483 commits

Author SHA1 Message Date
Jon Seager
8ced58039b
fix: add x icon to cancel button and saving spinner to edit forms
Replace both buttons with a centered "Saving..." spinner when the
form is submitting. Add x_mark icon to the cancel button for clarity.
2026-02-10 19:43:10 +00:00
Jon Seager
0434b127e0
test: add E2E chromedriver tests for edit forms
Cover text fields, numeric fields, +/- adjuster buttons, searchable
selects, image upload/replace/remove, deferred image save, and the
cancel button across roaster, gear, cafe, brew, and cup entities.

Add wait_for_url_not_contains helper to correctly detect post-submit
redirects when the edit page URL shares a prefix with the detail page.
2026-02-10 19:43:06 +00:00
Jon Seager
4ee8cf7964
fix: polish edit forms and detail pages
- Skip payload in tracing::instrument to avoid logging base64 image data
- Add blob: to CSP img-src for image preview support
- Add deferred_upload_with_preview macro for edit form image previews
  with Replace/Remove buttons and proper DOM cleanup on replacement
- Fix datastar-fetch finished handler (evt.detail.response is undefined
  for redirect scripts)
- Display brew time in M:SS format on edit form
- Add full-width Save Changes button with check icon and Cancel button
  to all edit forms
- Fix country flag emoji spacing on cafe and cup detail pages
- Add "View on Map" Google Maps link to cafe and cup detail pages
2026-02-10 19:43:03 +00:00
Jon Seager
9650735057
fix: wire edit forms for Datastar submission and recompute bag remaining
Add {contentType: 'form'} to all edit template @put() calls so form
inputs are submitted by name rather than as Datastar signals. Replace
the brew edit quick notes text input with toggle pill buttons. Recompute
bag remaining when amount is updated to account for brew deductions.
Add CLI tests for brew and cup update commands.
2026-02-10 19:43:00 +00:00
Jon Seager
cb28a6f8bb
fix: wire edit forms for Datastar form submission and add CLI tests
Add {contentType: 'form'} to all edit template @put() calls so form
inputs are submitted by name rather than as Datastar signals. Replace
the quick notes text input on the brew edit page with toggle pill
buttons matching the add form. Add CLI tests for brew and cup update
commands.
2026-02-10 19:42:58 +00:00
Jon Seager
5f99ca0953
feat: add CLI update commands for brews and cups
Add UpdateBrewCommand and UpdateCupCommand to the CLI with all
updatable fields. Add corresponding update() methods to BrewsClient
and CupsClient.
2026-02-10 19:42:55 +00:00
Jon Seager
931859938a
test: add integration and E2E tests for edit functionality
Add form-based PUT update tests via define_form_update_tests macro for all
7 entities. Add hand-written datastar update tests for roasters, roasts,
cafes, brews, and cups. Add brew/cup update API tests (CRUD + auth).
Add put_form, put_form_datastar, create_default_brew, create_default_cup
test helpers.
2026-02-10 19:42:52 +00:00
Jon Seager
1a1b28559c
feat: add edit page route handlers, template structs, and edit templates
Add edit page handlers for all 7 entities (roaster, roast, bag, brew,
cafe, cup, gear) with authentication, data pre-loading, and image URL
resolution. Register edit routes in app router. Add corresponding
template structs and HTML templates with pre-populated forms.
2026-02-10 19:42:49 +00:00
Jon Seager
94088f1f4b
feat: add edit button to all detail pages
Add edit_button and edit_delete_buttons macros to detail_cards.html.
All 7 entity detail pages now show an Edit button next to Delete when
authenticated. Each detail template struct receives a pre-computed
edit_url from the route handler.
2026-02-10 19:42:47 +00:00
Jon Seager
1c029f52f4
feat: add update endpoints for brews and cups
Add UpdateBrewSubmission and UpdateCupSubmission types with image
support. Register PUT handlers on /brews/{id} and /cups/{id} with
three-way response pattern (Datastar/form/JSON).
2026-02-10 19:42:45 +00:00
Jon Seager
bc449e520e
feat: upgrade update handlers to FlexiblePayload with three-way response
All five existing update handlers (roaster, roast, cafe, gear, bag) now
accept FlexiblePayload with UpdateSubmission types that separate image
data from domain structs. Each returns Datastar redirect scripts, form
redirects, or JSON depending on request type. Image save support added
to all update paths.
2026-02-10 19:42:43 +00:00
Jon Seager
77cb61f91b
feat: add UpdateBrew, UpdateCup structs and expand UpdateBag
Add domain update structs for brew and cup entities, add update()
methods to their repository traits and SQL implementations, and
expand UpdateBag with roast_id, roast_date, and amount fields.
2026-02-10 19:42:39 +00:00
Jon Seager
fbf5a288c1
feat: support HEIF/HEIC image uploads via client-side Canvas conversion
Convert all image files to JPEG on the client before uploading, allowing
iPhone HEIF/HEIC photos to work without server-side libheif dependency.
2026-02-10 17:56:48 +00:00
Jon Seager
bb4aa103fb
fix: add success logging for deferred image saves
Log at info level when a deferred image is successfully saved, matching
the project convention that every create/update operation logs with
entity context.
2026-02-10 17:50:46 +00:00
Jon Seager
dfd9814fa5
fix: add concurrency semaphore for image processing
Limit concurrent image processing tasks to 4 via a tokio::Semaphore on
AppState. Acquired before spawn_blocking in both upload_image() and
save_deferred_image() to prevent CPU/memory exhaustion from concurrent
image uploads.
2026-02-10 17:50:42 +00:00
Jon Seager
3675a2cdc6
fix: add decompression bomb protection and MIME type validation
Set image decoder limits (10000x10000 max dimensions, 256MB max alloc)
to prevent crafted images from causing OOM via decompression bombs.
Validate data URL MIME types against an allowlist (jpeg/png/webp)
before decoding, rejecting non-image content types early.
2026-02-10 17:50:38 +00:00
Jon Seager
082b582cb3
fix: move image processing off async runtime with spawn_blocking
CPU-intensive image operations (decode, Lanczos3 resize, JPEG encode)
were running directly on the async worker thread, blocking all other
requests for 100-500ms per upload. Wrap in spawn_blocking in both
upload_image() and save_deferred_image().
2026-02-10 17:50:34 +00:00
Jon Seager
cf56ac28f7
test: add integration and e2e tests for image API
Cover all image entry points: upload, get, thumbnail, delete, auth
guards, validation, datastar responses, deferred image saves via
roaster create, checkin (cafe/cup), and scan flows including the
matched-roast guard that prevents overwriting existing images.
2026-02-10 17:50:30 +00:00
Jon Seager
7bacd30854
feat: improve image loading states on detail pages
Replace "Uploading..." text with animated spinner when uploading via
thumbnail, and show placeholder icon while image loads from server.
2026-02-10 17:50:27 +00:00
Jon Seager
b28234b52f
feat: include entity images in backup, restore, and reset
Images were not included in the backup/restore system, so a backup
would lose all uploaded images and a reset would orphan them.

Add BackupImage with base64-encoded binary data to BackupData,
export/restore/reset the entity_images table, and verify it in
the empty-database check. Backward-compatible with existing v2
backups via #[serde(default)].
2026-02-10 17:50:23 +00:00
Jon Seager
c3781de30c
feat: add image upload to create and check-in forms
Add deferred image upload support to entity creation flows:

- Roaster, roast, gear, cafe forms save images on create via
  save_deferred_image helper
- Brew form accepts optional image upload
- Check-in form accepts optional cup photo
- Scan flow preserves captured image for new roasts and skips
  overwriting existing roast images
- Homepage updated with image-upload component registration
- Delete handlers for brews and cups clean up associated images
2026-02-10 17:50:20 +00:00
Jon Seager
4b3f03f5d3
feat: add entity image support with display on detail pages
Add image infrastructure, API, and detail page integration:

- EntityImage domain model with ImageRepository trait
- SQLite storage for images and thumbnails as BLOBs
- Image processing with data URL decoding and thumbnail generation
- REST API: upload, get, delete, thumbnail at /{entity_type}/{id}/image
- resolve_image_url helper for image fallback chains
- image-upload web component for direct upload on detail pages
- Image display with vignette overlay and lightbox viewer
- Template macros: image_thumbnail, readonly_image, lightbox_script
- All 7 detail pages updated with image thumbnails
- Brew images fall back to roast; cup images fall back to cafe then roast
- Delete handler macro extended with optional image cleanup
2026-02-10 17:50:13 +00:00
Jon Seager
3d61f71f1d
test(e2e): add homepage scan tests and fix stale element in checkin test
Add 3 homepage scan e2e tests covering all roaster/roast match
permutations (new+new, existing+new, existing+existing). Fix
StaleElementReference in checkin test by using JS clicks for
Datastar-managed DOM elements.
2026-02-10 11:36:16 +00:00
Jon Seager
264ef9c1fb
test: add e2e checkin test with new cafe and scanned roast
Cover the check-in flow where neither the cafe nor the roast exist
beforehand. The test searches for a cafe via location search (mocked
Foursquare), scans a coffee bag via text prompt (mocked OpenRouter),
and submits the check-in. Adds spawn_app_with_all_mocks helper.
2026-02-10 11:26:17 +00:00
Jon Seager
7c1fbb99b8
test: add e2e tests for data page, detail pages, bag close, and navigation
Cover tab switching, search, pagination, and sorting on the data list
page. Verify detail page rendering for roasters, roasts, bags, gear,
and cafes. Test the close-bag flow from the detail page. Check that
home, stats, and timeline pages load correctly with data.
2026-02-10 11:09:30 +00:00
Jon Seager
034630ade0
ci: add e2e browser test job to GitHub Actions 2026-02-10 10:45:12 +00:00
Jon Seager
104ebb410a
test: add e2e browser tests for core user flows
Roaster creation (basic + all fields), full brew chain through browser,
entity deletion with confirm dialog, AI extraction via text prompt with
mocked OpenRouter, and check-in wizard with saved cafe + existing roast.
2026-02-10 10:45:01 +00:00
Jon Seager
73976cbe51
feat(test): add e2e browser test helpers
BrowserSession wraps headless Chrome via thirtyfour. Auth helper injects
session cookies to bypass WebAuthn. Wait helpers handle Datastar's async
DOM updates (visibility, text, URL). Form helpers find visible elements
to avoid hidden duplicates on tabbed pages. Chromedriver is auto-spawned
on first use via a dedicated parked thread with PR_SET_PDEATHSIG so the
kernel kills it when the test binary exits.
2026-02-10 10:44:47 +00:00
Jon Seager
c2b252824d
feat(test): add e2e test infrastructure with thirtyfour
Add thirtyfour WebDriver client as dev-dependency, feature-gated behind
--features e2e so normal cargo test is unaffected. Add chromedriver and
chromium to the nix devShell.
2026-02-10 10:44:36 +00:00
Jon Seager
f6b51ccb38
refactor: reduce duplication in handlers, templates, and view structs
- Replace inline redirect scripts with existing render_redirect_script()
  in 6 create handlers
- Add delete_button macro to detail_cards.html, used by 6 detail pages
- Unify 3 map_with_legend macros into 1 with LegendEntry iteration
2026-02-10 09:37:49 +00:00
Jon Seager
092bdce164
test: add form submission tests for all entity create handlers
The PayloadSource::Form branch (redirect response) and form-specific
Submission type parsing were previously untested. Add 19 tests covering
form-encoded POST for all 8 entities, including Datastar+form combo and
edge cases for custom deserializers (TastingNotesInput, optional gear ID,
comma-separated quick notes, date string parsing).
2026-02-10 09:17:07 +00:00
Jon Seager
dfb89fab66
fix(db): set pragmas per-connection and use single pool connection
PRAGMAs executed on the pool only applied to one random connection out
of five. Move all settings to SqliteConnectOptions so every connection
gets them. Reduce max_connections to 1 to eliminate cross-connection WAL
snapshot staleness that caused 404s on newly created entities.
2026-02-09 20:36:40 +00:00
Jon Seager
436cf101d6
fix(stats): use muted colors for roast and consumption stat cards 2026-02-09 20:27:01 +00:00
Jon Seager
92b20396af
fix(ui): improve mobile card layout for list views
Right-align values in mobile card cells while keeping labels left-aligned.
Move tasting notes to a label-free strip at the bottom of roast cards.
2026-02-09 20:24:57 +00:00
Jon Seager
2473e1f377
fix(templates): wrap flag and country in span for correct mobile flex layout
The flag emoji and country name were separate flex items inside mobile
card td cells, causing the flag to float away from the country text.
Wrapping them in a single span keeps them together as one flex item.
2026-02-09 20:20:12 +00:00
Jon Seager
b00d235eee
refactor(ui): simplify detail page subtitles to breadcrumb links
Replace verbose subtitles with a consistent pattern across all 7 detail
pages: a linked entity type pointing to the data list page, followed by
the creation date.
2026-02-09 20:18:21 +00:00
Jon Seager
37687955d2
fix(templates): add space between flag emoji and country name 2026-02-09 20:13:30 +00:00
Jon Seager
9291c3fe8c
fix(scan): stack form buttons vertically on mobile
The Save Roaster & Roast button text was wrapping awkwardly on narrow
screens. Buttons now stack full-width on mobile and revert to inline
layout on sm: breakpoint.
2026-02-09 20:11:46 +00:00
Jon Seager
eff29b048c
chore: enable agent teams experiment in dev shell 2026-02-09 19:57:42 +00:00
Jon Seager
05a40a35c2
fix(ui): use fixed 200px card width on mobile and desktop
Replace viewport-relative w-[45vw] with fixed w-[200px] so brew and
bag cards maintain consistent width across breakpoints instead of
shrinking on narrow screens.
2026-02-09 19:57:36 +00:00
Jon Seager
08c1ef05cf
fix: use gear model column for brew card grinder display
The grinder_model field was computed by splitting the concatenated
"make model" string on the first space, which broke for multi-word
brand names like "Weber Workshops". Fetch g_grinder.model directly
from the database instead.
2026-02-09 19:57:09 +00:00
Jon Seager
da206c1938
feat(ui): add entity links to detail page cards
Add roaster and roast slug parameters to coffee_card and roaster_card
macros, rendering entity names as links to their detail pages. Add cafe
link in the cup detail page. Pass slug fields through template structs
and route handlers.
2026-02-09 19:56:47 +00:00
Jon Seager
3c273feb18
feat(a11y): add ARIA attributes, token colors, toast, and tab-switch links
Add aria-required to required inputs, role=alert to error messages,
aria-label to icon-only list nav buttons, and progressbar ARIA to bag
status bars. Replace hardcoded red/green colors with error/success
design tokens across all templates. Add toast notifications for entity
creation and tab-switch links for empty add-form states. Increase scan
upload body limit to 10MB.
2026-02-09 19:56:11 +00:00
Jon Seager
aad927085b
refactor: extract location JS into static file with nearby keyboard nav
Move locateUser and nearbyKeydown functions from an Askama macro into
static/js/location.js served as a deferred script. Add arrow key, Enter,
and Escape navigation for nearby cafe search results.
2026-02-09 19:54:49 +00:00
Jon Seager
f4411fdc76
feat(a11y): add role=img and sr-only data to map and chart components
Add ARIA role=img with descriptive labels to world-map SVG and
donut-chart SVG. Include a screen-reader-only data table in world-map
for country/count pairs.
2026-02-09 19:54:42 +00:00
Jon Seager
8f79c5aaf3
feat(a11y): add combobox ARIA and keyboard nav to searchable-select
Add role=combobox, aria-expanded, aria-controls, and role=listbox/option
attributes. Support arrow key navigation, Enter to select, and Escape
to dismiss. Add aria-label to clear button.
2026-02-09 19:54:33 +00:00
Jon Seager
004f92e340
feat(css): add error/success design tokens, touch targets, and active state
Add error and success color tokens with dark mode support, increase
btn-adjust touch target to 44px on mobile, and add .ss-active highlight
class for keyboard navigation in searchable components.
2026-02-09 19:54:22 +00:00
Jon Seager
e0e49f8125
docs: add cover image to README 2026-02-09 17:47:29 +00:00
Jon Seager
36540a3b90
docs: rewrite README with docker quick start and new defaults
Restructure the quick start to lead with Docker, add install-from-git
as a secondary option, update the config table to reflect the new
localhost defaults and auto-enabled insecure cookies, and consolidate
the Docker section into the quick start.
2026-02-09 17:24:15 +00:00
Jon Seager
8e72961f1a
ci(deploy): push latest tag to GHCR alongside commit SHA tag 2026-02-09 17:23:58 +00:00