← Back to Pull requests

feat(product_search_hub): store every photo of an AI food and keep them on its estimate (#763) #889

Closed
unknown closed this pull request without merging on Oct 25, 2026 19:20 UTC
View on GitHub
unknown unknown commented on Oct 25, 2026 19:08 UTC
Author

Slice 2 of #763 (Refs #763; S3 and S4 follow).

What changed

  • The AI food page started a private upload only for the first photo. FoodEstimateController.savePhotos now starts one for every photo, in parallel and in the user's order, through savePrivateFrontPhoto and so through the lasting upload queue of #849.

  • SavedFoodEstimate.photoUrls (JSON photo_urls, required key, as the no-compat rule asks; S1 never shipped in a release) keeps all their Storage addresses. The first photo stays the item's image.

  • InventoryItem.withFoodPhotos (next to withoutAiEstimate) sets both; ManualProductAiSearchResult.withItem keeps the AI page under the 300-line limit.

  • One "upload queued" snack covers all photos (Future.wait over their uploads).
  • Gates

  • test/features/product_search_hub, test/features/inventory, test/architecture: passed (new: two photos land on the estimate; the JSON round trip carries photo_urls)

  • flutter analyze, tool/ci_changed_file_lints.sh origin/master: no new issues

  • Integration tests: run by CI after the merge (food_estimate_vorrat_flow_test adds no photos)
  • Open review findings, not changed

  • A photo that fails to be kept (signed out, disk error) drops all photos from the item, as for one photo before; an earlier photo of the same save may still upload unreferenced. Signed-out fails on the first photo, so this needs a disk error mid-save.

  • Storage files of a deleted item are not removed: Storage rules forbid deletes since #733, same as for imageUrl today.

  • A later rebuild through buildFoodEstimateItem would drop photoUrls; S3 (level chip) must keep them.
  • No visible UI change, so no phone-test step.

    🤖 Generated with Claude Code

    Diff: 219 lines (+164 / -55) across 2 files Reviewer: claude[bot] Review duration: 11m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 219 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.323
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #889"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.7% (MEDIUM) · Higher = larger blast radius
    36.7%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.5% · Safe to merge
    14.5%
    Repository