fix: the Kanban says the proof machine before a pull, folder downloads cut by the network wait for the next pass, expected refusals stay out of Sentry (DTF-WEB-16..1K, DTF-API-C)
All checks were successful
Build and deploy / Validate source (push) Successful in 6s
Build and deploy / Integration suite on a real stack (push) Successful in 7m37s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m25s

- 19/1F: the board carries the approved proof's machine; the pull and the
  order's machine field keep to it and say why.
- 17/1E: a network drop while a download or an answer arrives counts as
  unreachable/offline, warned first like the others.
- 16: no folder picker (Safari): said in a line.
- 1A, 1J/1K, 1D, 18: guidance and expected refusals (pull to another machine,
  someone already on the machine, e-mail in use, coupon) are not errors.
- 1B: an empty file is refused on the page.
- API-C: the Tiny's rate limit reaches Sentry only if it repeats.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-25 09:46:26 -03:00
parent 449b45b520
commit 5db8661a1a
8 changed files with 77 additions and 19 deletions

View File

@@ -56,8 +56,9 @@
const retry=response.headers.get('Retry-After');
if(retry!=null)error.retryAfter=retry;
// A status the caller expects (a resumed upload that expired) is handled
// there, not reported.
if(!(options.expected||[]).includes(response.status))
// there, not reported. `expected` may also be a test of status and text.
const expected=options.expected;
if(!(typeof expected==='function'?expected(response.status,error.message):(expected||[]).includes(response.status)))
window.dtfObservability?.apiError?.(path,response.status,error.message,data.detail);
throw error;
}
@@ -152,6 +153,9 @@
// One message line under the steps. Its tone says what it is: a refusal or
// a missing field is an error (red), a cart that changed a warning, a
// created order a confirmation, the rest information.
// A code the customer typed wrong, or one no longer valid (app/coupons.py):
// they fix it, it is no error (Sentry DTF-WEB-18).
const couponRefusal=(status,text)=>status===422&&/^(Cupom |Este cupom |Você já usou este cupom)/.test(text||'');
function message(text, tone='info') {
status.textContent = text; status.dataset.tone = text ? tone : '';
if (tone === 'error' && text) window.dtfObservability?.uiError?.(text, 'site');
@@ -553,11 +557,11 @@
localStorage.setItem('dtf-request-key',requestKey);
localStorage.setItem('dtf-request-body',requestBody);
}
const quote = await api('/quotes',{request_key:requestKey,...content,timings});
const quote = await api('/quotes',{request_key:requestKey,...content,timings},{expected:couponRefusal});
quotedCart=initialCart;localStorage.setItem('dtf-quote-cart',quotedCart);
draftId=quote.id; localStorage.setItem('dtf-quote',draftId);
await refresh(true);
} catch(error) { message(error.message,'error'); }
} catch(error) { message(error.message,couponRefusal(error.status,error.message)?'warn':'error'); }
finally { busy=false; pintaEntrega(); }
};
// `go`: the customer asked to pay, so the cart page moves to the payment page.