fix: a refusal the server explains is a warning on the Kanban and is not sent from the Site
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 8m58s
Build and deploy / Secret scan and release gate (push) Successful in 6s
Build and deploy / Publish images (push) Successful in 1m26s

Of about 60 Sentry issues in two weeks, five were bugs: the rest were the
system working (a rule, a check, a limit explained to the person) or a
network drop. A 4xx with a sentence for the person is now a warning on the
Kanban, tagged recusa, still counted per kind, since a refusal the team keeps
meeting says a screen confuses; the Site sends none, the customer reads it.
A 4xx with a list of fields (what the page sent was wrong) and a 5xx stay
errors, as do JavaScript errors and the red messages that do not come from a
refusal.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-30 10:02:15 -03:00
parent 9fc4d4e906
commit eb7a92bb89
2 changed files with 32 additions and 1 deletions

View File

@@ -62,4 +62,27 @@ window.dtfObservability.apiError('/board', 503, 'O sistema está reiniciando.');
window.dtfObservability.uiError('O sistema está reiniciando.', 'kanban');
assert.equal(captured, null, 'a skipped restart 503 stays skipped');
// A refusal the server explains (a 4xx with a sentence) is no bug: on the
// Kanban a warning, on the Site nothing; a field list or a 5xx is an error
// (2026-11-30).
const refused = (app, status, detail) => {
// A fresh copy per app: a page starts Sentry once, for its own app.
vm.runInThisContext(readFileSync('web/observability.js', 'utf8'));
window.dtfObservability.start('https://key@o1.ingest.sentry.io/1', app);
captured = null;
window.dtfObservability.apiError('/orders/1/move', status, 'Puxe o pedido na mesma máquina.', detail);
return captured;
};
assert.equal(refused('kanban', 409, 'Puxe o pedido na mesma máquina.').options.level, 'warning');
assert.equal(refused('kanban', 409, 'Puxe o pedido na mesma máquina.').options.tags.recusa, 'sim');
assert.equal(refused('site', 409, 'Cupom não encontrado.'), null, 'a refusal on the Site is not sent');
assert.equal(refused('site', 422, [{loc: ['body', 'items'], msg: 'bad'}]).options.level, 'error');
assert.equal(refused('site', 500, 'Internal Server Error').options.level, 'error');
assert.equal(refused('kanban', 422, [{loc: ['body'], msg: 'bad'}]).options.level, 'error');
// Shown in red after it, the refusal is not sent again as a page error.
refused('site', 409, 'Cupom não encontrado.');
captured = null;
window.dtfObservability.uiError('Puxe o pedido na mesma máquina.', 'site');
assert.equal(captured, null, 'a refusal shown in red is not sent as an error');
console.log('observability web checks passed');