← Back to Pull requests

feat: hardening de dados, erros e estados (itens 67/68/70/73/74/75/76) #310

Open
unknown opened this pull request with 212 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 22, 2026 19:40 UTC
Author

Causa / por quê


Bloco 3 do plano frontend: reforçar tratamento de dados, erros e estados de tela. Sem regressões de funcionalidade.

O que muda


  • 67/68 useAuth.tsx: getSession com .catch/.finally (loading nunca trava); value memoizado; signOut limpa queryClient, canais do supabase e preferências locais (achievements).

  • 70 OrderDetailModal.tsx: banner de erro ao falhar carregar paradas (antes silenciava); clipboard de código de entrega com await+try/catch.

  • 73 useAchievementsSystem.tsx: JSON.parse protegido por try/catch e chaves por usuário (achievements:<userId>).

  • 74 useServiceWorker.ts: listener controllerchange registrado uma única vez via useEffect com cleanup (antes acumulava a cada chamada).

  • 75/76 phone.ts: novo helper toWhatsAppUrl (garante DDI 55 / E.164). BatchActionsToolbar e MapHUD usam o helper; BatchActionsToolbar usa order.shareLink em vez de track.lalamove.com/<id>; clipboard com try/catch + toast de erro.
  • Verificado


  • tsc --noEmit -p tsconfig.app.json: 0 erros.

  • npm run build: sucesso.

  • vitest run: 1069/1069 (69 arquivos) verdes.

  • eslint nos 7 arquivos tocados: 0 erros (só warnings pré-existentes de imports não usados).

  • Nenhuma PR aberta toca os mesmos arquivos de front.

  • <!-- devin-review-badge-begin -->

    ---

    <a href="https://app.devin.ai/review/adm01-debug/lalamove_v2/pull/310" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
    <!-- devin-review-badge-end -->

    Diff: 212 lines (+159 / -53) across 2 files Reviewer: devin-ai-integration[bot] Review duration: 3m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.37) × (1 − Review Confidence (0.39)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.37 · 212 lines diff across 2 files
    0.37
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 68% · Reviewer familiarity: 35%
    38%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.321
    Real PR Conversation Timeline
    1 comments
    "Review active on #310"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 38.8% 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.5% (MEDIUM) · Higher = larger blast radius
    36.5%
    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: 38.8% · Lower = rushed or shallow review
    38.8%
    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: 22.3% · Safe to merge
    22.3%