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

@@ -27,14 +27,14 @@ class WorkerDrainTest(unittest.TestCase):
class RefusedDeliveryTest(unittest.TestCase):
"""A delivery the provider refuses reaches Sentry (logging.error) on its
first failure and every tenth after (#42, 2026-11-18)."""
def tick_with(self, attempts):
def tick_with(self, attempts, refusal=None):
job = {'id': 1, 'provider': 'tiny', 'event_key': 'o:paid:tiny', 'payload': {}, 'attempts': attempts}
conn = mock.MagicMock()
conn.execute.return_value.fetchone.return_value = job
connect = mock.MagicMock()
connect.return_value.__enter__.return_value = conn
refusing = mock.MagicMock()
refusing.deliver.side_effect = RuntimeError('Forma de recebimento não está habilitada')
refusing.deliver.side_effect = refusal or RuntimeError('Forma de recebimento não está habilitada')
with mock.patch.object(worker, 'connect', connect), \
mock.patch.dict(worker.adapters, {'tiny': refusing}), \
mock.patch.object(worker.logging, 'error') as error:
@@ -46,6 +46,12 @@ class RefusedDeliveryTest(unittest.TestCase):
self.assertEqual(self.tick_with(9).call_count, 1)
self.assertEqual(self.tick_with(4).call_count, 0)
def test_a_rate_limit_is_reported_only_when_it_repeats(self):
from app.tiny import TinyRateLimit
limit = TinyRateLimit('Tiny rate limit reached; the outbox will retry')
self.assertEqual(self.tick_with(0, limit).call_count, 0)
self.assertEqual(self.tick_with(9, limit).call_count, 1)
if __name__ == '__main__':
unittest.main()