Commit Graph

127 Commits

Author SHA1 Message Date
Ponshu Developer d72587ac19 security: .env.exampleの実APIキーをダミー値に差し替え
MAITA_API_KEY・EIJI_API_KEYに本物のGemini APIキーが入っていた。
ダミー値(AIzaSy_YOUR_GEMINI_KEY_HERE)に置換。
実キーはGoogle Cloud Consoleでローテーション要。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-23 00:07:38 +09:00
Ponshu Developer 1a84163654 fix: use_build_context_synchronously 解消
_reanalyze で nav / messenger を async gap 前にキャプチャするよう移動。
showDialog の context 引数を ignore 対象行に統合。
dart analyze: No issues found

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 08:20:42 +09:00
Ponshu Developer 2e770ff98d refactor: ハードコード色をAppColorsセマンティックカラーに置換
- pending_analysis_banner: Colors.orange.* → appColors.warning(グラデーション・影・バッジ)
- activity_stats: Colors.orange → appColors.warning(残回数少ない警告色・テキスト)
- scan_screen: Colors.grey → appColors.textTertiary(蔵元/産地テキスト)
- sake_no_match_state: Colors.grey[400/600] → appColors.textTertiary(空状態アイコン・テキスト)
- camera_screen: Colors.greenAccent → appColors.success(解析開始ボタン)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 08:18:48 +09:00
Ponshu Developer e7bb4e494c chore: update releases.json for v1.0.43
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 22:40:49 +09:00
Ponshu Developer 5bcacfffa3 chore: bump version to v1.0.43+50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:26:18 +09:00
Ponshu Developer 9fba57621a fix: quotaLockout Provider化・色トークン整備・依存バージョン固定
- quotaLockoutProvider (NotifierProvider) を新規作成し、カメラ・詳細画面で共有
  - camera_analysis_mixin: quotaLockoutTime フィールドを削除、429時にProviderへ設定
  - camera_screen: ref.watch(quotaLockoutProvider) でシャッターボタンUI更新
  - sake_detail_screen: _quotaLockoutTime フィールドを削除、Providerに移行
  - 画面遷移後もロックアウト状態が保持されるP1バグを解消
- camera_screen: Colors.red/grey → appColors.error/textTertiary に置換
- camera_screen: ギャラリー保存SnackBarから例外文字列 $e を除去
- camera_screen: SnackBarAction textColor Colors.yellow → appColors.brandAccent
- pubspec.yaml: flutter_riverpod ^3.1.0, riverpod_annotation 3.0.0-dev.3,
  riverpod_generator 3.0.0-dev.11 を固定(バージョン未固定による意図しないアップグレードを防止)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 14:18:27 +09:00
Ponshu Developer dd9b814174 refactor: TextEditingControllerリーク解消・エラー正規化・デザイントークン整備
- sake_detail_screen: _showTagEditDialog/TextEditDialog/BreweryEditDialog に
  try/finally + controller.dispose() を追加(メモリリーク修正)
- sake_detail_screen: State フィールドを build() より前に移動
- 生例外の SnackBar 露出を人間可読メッセージに正規化(6ファイル・10箇所)
- camera_analysis_mixin: Colors.orange を appColors.warning に置換、
  ガミフィケーション色を brandAccent/success/textTertiary に統一
- sake_detail_screen: ハードコード hex 色グラデーションをトークン化
- scan_screen / pdf_preview_screen / add_set_item_dialog: 絵文字 debugPrint を除去
- sake_basic_info_section: unnecessary_non_null_assertion (warning) を解消
- license_service: revoked 永続キャッシュの意図をコメントで明確化
- dart analyze: warning 0 / error 0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 23:48:32 +09:00
Ponshu Developer 5d8689b7ee merge: claude/sync-cursor-history-cSlsP — SakeItem setter廃止 + セマンティックカラー置換
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-17 13:09:56 +09:00
Claude a62bcd1d11
refactor: ハードコード色をAppColorsセマンティックカラーに置換
意図的な箇所(カメラUI・AppBar白テキスト・ハート色・Proバッジ等)はKEEP。
以下のUIロジックに影響しない7ファイルのみ変更:

- Colors.grey.shade400/[400] → appColors.iconSubtle (アイコン、無効状態)
- Colors.grey.shade300 → appColors.divider (プレースホルダー背景)
- Colors.grey → appColors.textSecondary / iconSubtle / divider (文脈別)
- Colors.grey[200] → appColors.surfaceSubtle (プログレスバー背景)
- Colors.orange → appColors.warning (警告スナックバー)
- Colors.green / Colors.red → appColors.success / error (完了・失敗スナックバー)

_createBackup()にappColorsをasync前にキャプチャするFlutterベストプラクティスを適用。
コメント化されていたデッドコメントも同時削除。

https://claude.ai/code/session_01DWQpnqrQWwxVKKWSL9kDPp
2026-04-16 23:50:39 +00:00
Claude 8ebd233305
refactor: SakeItemのdisplayData setter危険性を排除し、テストを追加
- SakeItem.applyUpdates()を追加(displayData/hiddenSpecsを1回のsave()でアトミックに更新)
- displayData/hiddenSpecs setterに@Deprecatedを付与(save()忘れによるデータ消失防止)
- sakenowa_auto_matching_service.dartをapplyUpdates()に移行(setterの直接使用を撲滅)
- SakeAnalysisResult.fromJson()のユニットテストを新規追加(tasteStatsクランプ・欠損補完等)
- SakeItem.ensureMigrated()のユニットテストを追加

https://claude.ai/code/session_01DWQpnqrQWwxVKKWSL9kDPp
2026-04-16 23:40:48 +00:00
Ponshu Developer 05c27d9cdf chore: update download page to v1.0.42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 21:12:18 +09:00
Ponshu Developer cc5175ebae refactor: ExposureSliderPainter を別ファイルに切り出し
camera_screen.dart の末尾にあった _ExposureSliderPainter (60行) を
lib/screens/camera_exposure_painter.dart に分離。
動作変更なし。718行 → 659行。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 21:08:30 +09:00
Ponshu Developer b7f5edf9a9 chore: update download page to v1.0.41
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 18:01:03 +09:00
Ponshu Developer ac2a54d07a feat: AI使用回数トラッキング + クォータ上限時ドラフト保存
- ApiUsageService: SharedPreferences で Gemini 日次使用回数を追跡
  - UTC 08:00(=日本時間 17:00)でリセット
  - 上限 20回/日(プロジェクトあたりの無料枠)
- DraftReason enum: offline / quotaLimit / congestion を区別
- camera_analysis_mixin: 解析前にクォータを事前チェック
  - 上限到達時は Draft 保存してカメラを閉じる(写真は失われない)
  - 429 エラー時も同様に Draft 保存(従来はエラー表示のみで写真消失)
  - API 呼び出し成功時(キャッシュ除く)にカウントアップ
- pending_analysis_screen: ドラフト理由を各アイテムに表示
  - クォータ: リセット時刻つきの警告(オレンジ)
  - 混雑 / オフライン: 理由別メッセージ
- ActivityStats: AI 使用状況 bento カードを追加
  - 今日のAI解析 X / 20回 + プログレスバー
  - 残り5回以下でオレンジ、上限到達で赤

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 17:58:00 +09:00
Ponshu Developer d39db78c80 chore: update download page to v1.0.40
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:04:01 +09:00
Ponshu Developer 4e6ff6d6e9 chore: bump version to 1.0.40+47
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:01:27 +09:00
Ponshu Developer 68723a884e feat: 記録日時を一覧カードと詳細画面に表示
- sake_list_item: カード末尾に相対日付を追加
  今日 / 昨日 / N日前 / M/D / YYYY/M/D
- sake_basic_info_section: 蔵元行直下にカレンダーアイコン + 「YYYY年M月D日に記録」を追加
  セット商品は非表示
- metadata.createdAt(非null保証)を使用、追加フィールド不要

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 14:01:17 +09:00
Ponshu Developer fad896e817 chore: update download page to v1.0.39 (actual APK sizes)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 13:40:23 +09:00
Ponshu Developer 26183e458e chore: update download page to v1.0.39
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 13:27:01 +09:00
Ponshu Developer cad2855b6e chore: bump version to 1.0.39+46
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 13:24:58 +09:00
Ponshu Developer aa933cf1e3 refactor: P2/P3-Step1 — camera_screen Mixin分離 + license storeURL修正
P2:
- license_screen.dart: storeUrl を store.posimai.soar-enrich.com に統一(TODO解消)

P3 Step1:
- camera_analysis_mixin.dart 新規作成: analyzeImages() + _performSakenowaMatching()
  を CameraAnalysisMixin<T extends ConsumerStatefulWidget> on ConsumerState<T> に切り出し
- camera_screen.dart: 1031行 → 718行(-313行)
  不要なimport 10個削除、Mixin適用、フィールド/メソッド移動

Note: Dart ライブラリプライベート制約のため Mixin の公開 API は
capturedImages / quotaLockoutTime / analyzeImages(アンダースコアなし)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 13:20:53 +09:00
Ponshu Developer ef2d940b6a docs: add DESIGN.md for UI/UX principles and customization guidelines
Made-with: Cursor
2026-04-16 13:10:48 +09:00
Ponshu Developer e82f66e44e fix: prevent EXP farming on cache hits + fix tasteStats validation
- SakeAnalysisResult.isFromCache flag added (not serialized to JSON)
- Both cache-hit paths return result.asCached() to signal caller
- camera_screen: EXP +10 only awarded on fresh API calls, not cache hits
- camera_screen: show '解析済みの結果を使用(経験値なし)' on cache hit
- camera_screen: clear _capturedImages after successful analysis
- camera_screen: catch(_) -> catch(e) with debugPrint logging
- SakeAnalysisResult.fromJson: auto-fill missing tasteStats keys with 3,
  clamp all values to 1-5 range to prevent broken charts
- Bump version 1.0.37+44 -> 1.0.38+45

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 10:46:42 +09:00
Ponshu Developer ee7e3b2646 fix: increase curl upload timeout 300s -> 900s for large APK uploads
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-16 09:28:51 +09:00
Ponshu Developer 3c3458ffb8 fix: restore detail spec inference while keeping name/brand/prefecture OCR-strict
- name, brand, prefecture: still OCR-strict (no completion/inference)
- alcoholContent, polishingRatio, tasteStats etc: restored from label + sake knowledge
- Overly strict 'no knowledge at all' rule was causing all detail specs to return null
- Sync fallback prompt with same policy
- Bump version 1.0.36+43 -> 1.0.37+44

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 15:52:50 +09:00
Ponshu Developer 3643ab7690 fix: replace sommelier role with OCR system role to prevent brand name hallucination
- Rewrote prompt: 'ソムリエ' role -> pure OCR system role
- Explicit prohibition on brand name completion/correction
  (e.g. label shows 東魁 -> output 東魁, never 東魁盛)
- prefecture: output null if not written on label; inference from brand knowledge forbidden
- tasteStats: default to mid-value 3 instead of 'reasonable estimate' (was encouraging hallucination)
- Added concrete examples for white-deer, kubota, tokai cases
- Bumped version 1.0.35+42 -> 1.0.36+43

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:53:47 +09:00
Ponshu Developer cb152ef78a fix: remove unused apkInfo variable in release_to_gitea.ps1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:41:28 +09:00
Ponshu Developer 23ba95d326 fix: restore badgeColor null-assert (dart analyze false positive)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:37:25 +09:00
Ponshu Developer 4f2f438b84 chore: bump version to 1.0.35+42
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:35:46 +09:00
Ponshu Developer 69b446ee17 fix: address code review findings - crash fixes, proxy OCR accuracy, lint cleanup
- tools/proxy/server.js: add systemInstruction + temperature 0 (fixes brand name hallucination e.g. Tokai->Tokaisou)
- gemini_service.dart: add cache read/write to proxy path (was missing, cache was dead code in production)
- camera_screen.dart: guard cameras.first crash when no camera available, add mounted checks in gallery loop
- sake_detail_screen.dart: remove unused gemini_service import, add ignore comment for showDialog context lint
- sake_basic_info_section.dart: remove redundant null-assert operators flagged by dart analyze
- dev_menu_screen.dart: remove unused gemini_service import
- 6 service files: remove emoji from log strings (project rule compliance, 60+ instances)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 13:30:00 +09:00
Ponshu Developer b3e1f5d0a3 chore: Phase 1 code quality improvements - POSIMAI_BASE_URL explicit, no emoji in logs, model comment update
Made-with: Cursor
2026-04-12 13:23:52 +09:00
Ponshu Developer 0caf370302 security: remove internal Tailscale IP from APK binary (v1.0.34)
secrets.dart: change AI_PROXY_URL defaultValue from 'http://100.76.7.3:8080'
to empty string. Consumer APKs use useProxy=false and never reach this code
path, so there is zero functional impact. Internal network topology is no
longer embedded in distributed binaries.

Made-with: Cursor
2026-04-12 11:47:35 +09:00
Ponshu Developer 7a20f161dd fix: replace WebClient with curl.exe for APK upload (5min timeout)
WebClient.UploadData() has no configurable timeout and was silently
timing out on 89MB uploads over Tailscale. curl.exe (built-in on
Windows 10+) is used instead with --max-time 300 (5 minutes).

Made-with: Cursor
2026-04-12 10:08:19 +09:00
Ponshu Developer 2890b6cb6f refactor: replace disk cache with in-memory session cache (v1.0.33)
Analysis cache redesign:
- Remove Hive persistence from AnalysisCacheService entirely
- Use Map<String, SakeAnalysisResult> in-memory instead of Hive boxes
- Cache now lives only for the duration of an app session; restart always
  produces a fresh analysis — no stale misidentifications can persist
- Remove Hive init(), TTL/cleanupExpired(), getCachedByBrand() dead code
- API surface unchanged: callers (gemini_service, dev_menu) need no edits
- main.dart: delete legacy Hive boxes (analysis_cache_v1, brand_index_v1)
  from disk on startup for existing users
- dev_menu_screen: update cache description text to reflect new behavior

Rationale:
- Camera captures always produce unique files -> cache hit rate was ~0%
- Each user supplies their own Gemini API key -> no shared cost benefit
- Persistent wrong results (e.g. misrecognized brand names) could survive
  up to 30 days under the old design
- Different sake editions photographed separately have different hashes
  and were never affected by the cache in the first place

Made-with: Cursor
2026-04-12 08:13:18 +09:00
Ponshu Developer 3d934deb56 fix: address remaining code audit findings and bump to v1.0.32
- migration_service: runMigration() now returns bool; main.dart only
  advances migration_version when migration succeeds
- sakenowa_service: add 30s timeout to all 6 http.get calls
- gemini_service: add 60s timeout to Direct API generateContent call
- gemini_service: guard response.body error log with kDebugMode
- Remove emoji from debugPrint in core service/screen files
  (gemini_service, analysis_cache_service, network_service,
   draft_service, camera_screen)

Made-with: Cursor
2026-04-12 07:25:24 +09:00
Ponshu Developer cb71ab91de fix: handle Vercel CLI stderr as ErrorRecord in release script
- Set ErrorActionPreference to Continue before vercel commands to prevent
  PowerShell from treating Vercel CLI stderr output (version banner) as
  a terminating error and jumping to the catch block prematurely
- Strip ANSI cursor-movement escape codes from output before regex matching
  the Production URL (--no-color does not remove cursor movement sequences)
- Convert all 2>&1 output to strings via .ToString() before processing

Made-with: Cursor
2026-04-12 00:39:35 +09:00
Ponshu Developer c8ffe2626f refactor: apply critical code review fixes
- draft_service: GeminiService is now passed as a required parameter
  to analyzeDraft/analyzeAllDrafts instead of being directly instantiated,
  ensuring consistent Riverpod-managed injection
- gemini_provider: correct misleading comment (rate limiting is due to
  static field, not Provider; Provider enables future safe refactoring)
- analysis_cache_service: cleanupExpired now also removes orphaned brand
  index entries from _brandIndexBox after deleting expired _box entries
- analysis_cache_service: keysToDelete type corrected from List<dynamic>
  to List<String>, removing unnecessary as String cast
- analysis_cache_service: _normalizeBrandName comment clarified to note
  that .toLowerCase() only affects ASCII characters, not Japanese text
- camera_screen: add explicit ignore comment with rationale for
  showDialog after async gap (mounted check immediately precedes it)
- camera_screen: remove leaked Cursor instruction comment from line 96

Made-with: Cursor
2026-04-12 00:24:57 +09:00
Ponshu Developer 94f7ee20ea refactor: code quality improvements based on critical review
Made-with: Cursor
2026-04-12 00:09:09 +09:00
Ponshu Developer 2074f85da8 fix: show correct file size (decimal) on download page
Made-with: Cursor
2026-04-11 22:39:11 +09:00
Ponshu Developer d688dfa5bd chore: bump version to 1.0.30+37
Made-with: Cursor
2026-04-11 15:47:00 +09:00
Ponshu Developer cd57171670 fix: strengthen AI label recognition prompt and repo cleanup
Made-with: Cursor
2026-04-11 15:46:44 +09:00
Ponshu Developer 4096c67356 chore: update download page and add build script for v1.0.29
Made-with: Cursor
2026-04-11 15:13:04 +09:00
Ponshu Developer cccea8dd7a chore: bump version to 1.0.29+36
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 12:19:11 +09:00
Ponshu Developer f8ceb0bf02 fix: ソムリエ画面UIを統一 — カードスタイル・padding・重複ヘッダー削除
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 12:11:21 +09:00
Ponshu Developer ba5660c1cb fix: release_to_gitea.ps1にAPKバージョン一致チェックを追加
pubspec.yamlのversionとAPKの埋め込みversionNameが異なる場合は
エラーで中断する。「バージョン上げ前ビルド→リリース」ミスを防ぐ。

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 09:45:16 +09:00
Ponshu Developer 402c6b6448 chore: update download page to v1.0.28
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 09:19:31 +09:00
Ponshu Developer 675e67e3c1 refactor: デッドコード削除 — analyzeSakeHybrid/analyzeSakeText
- gemini_service.dart: 未使用の analyzeSakeHybrid / analyzeSakeText を削除
  (どこからも呼ばれておらず、画像直接解析 analyzeSakeLabel のみ使用中)
- main.dart: isProVersion を「現在未使用」コメントに更新
- version: 1.0.28+35

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 09:19:03 +09:00
Ponshu Developer c7168e831c chore: update download page to v1.0.27
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:58:42 +09:00
Ponshu Developer d23ee8ed77 fix: AI解析プロンプトの銘柄名補完バグを修正
- 銘柄名(name)と蔵元名(brand)はラベルの文字をそのまま使うよう明示
  「東魁」→「東魁盛」のような知識補完を禁止する指示を追加
- 全3プロンプト(画像解析・ハイブリッド・テキストのみ)に適用
- version: 1.0.27+34

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:58:02 +09:00
Ponshu Developer f3d6a92799 chore: v1.0.26 リリース完了 — APKアップロード・ダウンロードページ更新
- releases.json: v1.0.26 のダウンロードURLに更新
- release_to_gitea.ps1: consumer命名に統一 (lite/pro分割廃止)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-11 08:23:10 +09:00