← Back to Pull requests

fix: mensagem acionavel no limite de 3 ajustes pendentes (F-04) #230

Closed
unknown closed this pull request without merging on Nov 22, 2026 07:31 UTC
View on GitHub
unknown unknown commented on Nov 22, 2026 06:26 UTC
Author

Causa

request_my_quote_adjustment bloqueia o 4º pedido de ajuste pendente com raise exception using errcode = 'P0001', message = 'too_many_pending_adjustments' (site-supabase/supabase/migrations/20260923120000_audit_security_reliability_hardening.sql:205).

O cliente via o texto cru too_many_pending_adjustments no alerta, porque rpcError (src/lib/customerAccount.ts:90-92) faz throw new Error(error?.message) e CustomerQuotePage.tsx imprime adjustmentError direto. Sem o back-office (PF-03) não havia sequer como liberar o limite. Era o que sustentava F-04 em PARCIAL 30.

O que mudou

  • src/lib/customerAccount.ts — novo ADJUSTMENT_PENDING_LIMIT_MESSAGE e tradução do P0001 em requestMyQuoteAdjustment; qualquer outra mensagem da RPC continua propagada crua.

  • src/pages/CustomerQuotePage.tsx — o alerta mostra o link "Falar com a equipe" (/contato) só quando a recusa é o limite.

  • src/lib/customerAccount.rpc.test.ts — 2 testes novos.

  • analise-prs/funcionalidades.csv — F-04 → COMPLETA/100.

  • docs/AUDITORIA_PLANEJADO_X_IMPLEMENTADO_20261120.md — PF-04 → COMPLETO; contagem de DIVERGÊNCIA 9 → 8.
  • Verificado de verdade

    | Comando | Resultado |
    | --- | --- |
    | npx vitest run | 78 arquivos, 580 testes, todos passando |
    | npx tsc -b --pretty false | RC=0 |
    | npx eslint nos 3 arquivos tocados | RC=0 |
    | node scripts/validate-closure-ledger.mjs | 230 referências válidas |

    Mutação: removida a linha if (error.message?.includes('too_many_pending_adjustments')), o teste "traduz o limite de 3 ajustes pendentes em mensagem acionável" falha (×). Restaurado → 6/6 passando.

    Não é Regra 8: só front + docs, sem DDL.
    <!-- devin-review-badge-begin -->

    ---

    <a href="https://app.devin.ai/review/adm01-debug/promo_brindes_v1/pull/230" 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: 258 lines (+193 / -65) across 3 files Reviewer: adm01-debug Review duration: 64m
    All Vouch review confidence checks passed
    Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 258 lines diff across 3 files
    0.39
    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.332
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #230"
    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: 39.2% (MEDIUM) · Higher = larger blast radius
    39.2%
    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: 15.5% · Safe to merge
    15.5%