Skip to content

v0.3.0 - Guided Onboarding, Local-Only Mode, AI Streaming & Self-Hosting Polish

Choose a tag to compare

@NathanP278 NathanP278 released this 01 Dec 07:04
· 24 commits to main since this release

Added

  • Animated 5-Step Guided Onboarding Wizard:
    • Added a beginner-friendly, interactive onboarding flow (OnboardingWizard + OnboardingWizardGate) covering Units & Privacy Mode, Goal & Pace, Everyday Snapshot, Food Style & Allergies, and a celebratory Daily Plan reveal with optional Quick Tweak.
    • Protects existing v0.2.x upgraders from interruption via multi-table data detection (foodLogs, weightLogs, customRecipes, or customized userGoals), reconciles the Home first-run banner, and adds a Redo Guided Setup action in Settings.
  • First-Class Local-Only Privacy Mode:
    • Added reactive per-device Local-Only Mode in Settings and Step 1 of Onboarding, plus runtime server enforcement via LOCAL_ONLY=true (Docker/Node.js) or NEXT_PUBLIC_LOCAL_ONLY=true (build-time).
    • Enforces HTTP 403 with Cache-Control: no-store across /api/db/sync, /api/ai/*, and /api/weight/* when server Local-Only is enabled, hides cloud/AI chrome cleanly, bypasses the passphrase boot gate, and provides an opt-in Allow online food search (Open Food Facts / USDA) toggle.
  • Full Metric & Imperial Unit System:
    • Added canonical unit conversion (src/lib/nutrition/unit-conversion.ts) supporting Metric (kg / cm) and Imperial (lb / ft·in) across the Goals Calculator, Weigh-In Drawer, Trends Charts, Home, and Onboarding while keeping canonical metric storage (weightKg, heightCm) and full v0.2.x backup compatibility.
  • Diary Timeline | Meals Toggle & Meal Categories:
    • Added a shared DiaryEntriesView (Timeline | Meals segmented toggle persisted across Home / and /log), compact meal pills (Breakfast, Lunch, Dinner, Snack), per-meal calorie subtotals, + quick-add buttons per meal section, and meal assignment across all logging drawers.
  • Two-Way Apple Health iOS Shortcut Sync:
    • Added POST /api/weight/import (accepting weight_kg or weight_lb, optional date/recorded_at/tz, and idempotent daily upserts) alongside echo-loop prevention on GET /api/weight/latest (excluding imported apple_health rows by default), automatic browser timezone prefill, and copy-paste setup guides in Settings.
  • Live AI Streaming Progress & Latency Optimization:
    • Added bounded SSE streaming (readCompletionStream with 1 MiB ceiling and stall-only watchdog) and NDJSON progress events (connecting → analyzing → receiving_output with live chunk counts + cancel button) for Meal Scan and Meal Ideas.
    • Added Gemini reasoning_effort: 'low' tuning for faster vision/JSON turnaround, dietary/allergy profile injection into Meal Ideas prompts, and a fast-fail 20s noRetry AI health probe.
  • Pre-Built Multi-Arch GHCR Docker Images & Optional Diagnostics Logging:
    • Added .github/workflows/publish-image.yml publishing multi-platform (linux/amd64, linux/arm64) images to ghcr.io/nathanp278/opencalory.
    • Added opt-in rotating metadata-only JSONL server diagnostics (OPENCALORY_LOG_FILE, disabled with zero I/O when unset) with strict secret/payload exclusion.

Fixed

  • UTF-8 Encoding Hygiene: Repaired double-encoded mojibake punctuation across 17 source/test files and added an automated regression test (src/__tests__/encoding-hygiene.test.ts).
  • Cloud Sync Ephemeral Guard & Sanitized Error Logging: Blocked accidental writes to ephemeral /tmp storage on Vercel when Turso is unconfigured, and upgraded /api/db/sync error logs with sanitized libSQL cause chains, err.code, and redacted ZodError summaries.
  • Reverse-Proxy Session Auth Hardening: Added OPENCALORY_PUBLIC_ORIGIN validation and proxy-aware Secure cookie detection (hasValidRequestOrigin, shouldUseSecureCookie) on /api/auth/sync-session.
  • Open Food Facts Resilience: Added automatic fallback on legacy OFF 5xx/timeout errors to the search.openfoodfacts.org Search-a-licious index (with Lucene query escaping) followed by bounded v2/product detail lookups (up to 6 valid non-obsolete barcodes) and clean empty-result handling.
  • React 19 Hook Purity & Lint Compliance: Eliminated all react-hooks/set-state-in-effect and react-hooks/refs errors across TrendsPage, ThemeProvider, InfoPopover, and AnimatedNumber.

Changed

  • Whole-Codebase Cleanup & Consolidation:
    • Decomposed OnboardingWizard into focused step subcomponents (onboarding-steps.tsx), extracted AiServiceError into a leaf module to break the circular AI import, and split requireNotServerLocalOnly into src/lib/config/server-local-only.ts so client bundles never import next/server.
    • Consolidated weight conversion constants (KG_TO_LB) across charts and CSV export, pushed excludeSources filtering into SQL for getLatestWeightLog, extracted shared MealScanProgressPill and CopySnippetButton UI components, and deduplicated RFC-4180 CSV/number helpers across scripts/catalog-adapters/.