From f77de40b7ffdd488d3157868968bcf1ecf65578a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 27 Oct 2026 09:16:00 -0300 Subject: [PATCH] =?UTF-8?q?feat:=20Gest=C3=A3o=20only=20pulls=20cards=20ba?= =?UTF-8?q?ck,=20with=20a=20reason=20(Dropstar's=20rule=20D-20)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropstar's internal rules of 2026-10-26: the coordination pulls back, never forward, always with a reason. The Gestão profile now sends orders to Correção from any stage and steps them back, and no longer moves them forward. Admin, Dropstar's own login, keeps every move but Finalizado, which stays the Revisor's (D-29). Co-Authored-By: Claude Opus 5.5 --- app/core/auth.py | 20 +++++++++++++------- docs/CONTEXT.md | 8 +++++--- tests/test_moves.py | 9 ++++++--- web/kanban.html | 2 +- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/app/core/auth.py b/app/core/auth.py index b9b892b..7697e72 100644 --- a/app/core/auth.py +++ b/app/core/auth.py @@ -132,17 +132,21 @@ CAPABILITIES = { 'integrations': {'superadmin'}, } -# Who moves which card (Dropstar's flow, 2026-10-23): the designer the -# artwork, the operator the printing, and only the Revisor (and we, the -# superadmin, for support) to Finalizado, so nobody releases their own print. -# Admin and Gestão make every other move, Correção included. A step back -# undoes a mistaken move: open to whoever may make the move it undoes. +# Who moves which card (Dropstar's flow, 2026-10-23, and their rules of +# 2026-10-26): the designer the artwork, the operator the printing, and only +# the Revisor (and we, the superadmin, for support) to Finalizado, so nobody +# releases their own print (D-29). Gestão, the coordination, pulls back and +# never forward, always with a reason (D-20): a step back, or Correção. Admin, +# Dropstar's own login, makes every other move. A step back undoes a mistaken +# move: open to whoever may make the move it undoes. MOVES = { 'designer': {('rec', 'tra'), ('rec', 'cor'), ('tra', 'cor'), ('cor', 'rec'), ('cor', 'tra')}, 'operador': {('tra', 'imp'), ('imp', 'rev')}, 'revisor': {('rev', 'fin')}, } -MANAGERS = ('superadmin', 'admin', 'gestao') +ADMINS = ('superadmin', 'admin') +COORDINATION = ('gestao',) +MANAGERS = ADMINS + COORDINATION RELEASERS = ('revisor', 'superadmin') MOVERS = MANAGERS + tuple(MOVES) @@ -154,7 +158,9 @@ def may_move(role, from_state, to_state, back=False): return role in MANAGERS or (to_state, from_state) in MOVES.get(role, ()) if to_state == 'fin': return role in RELEASERS - return role in MANAGERS or (from_state, to_state) in MOVES.get(role, ()) + if to_state == 'cor' and role in COORDINATION: + return True + return role in ADMINS or (from_state, to_state) in MOVES.get(role, ()) def may_reorder(role, state): diff --git a/docs/CONTEXT.md b/docs/CONTEXT.md index 296395b..bd31cee 100644 --- a/docs/CONTEXT.md +++ b/docs/CONTEXT.md @@ -416,9 +416,11 @@ what (MOVES): the Designer Arte recebida to Arte conferida, asks for corrections and brings the new art back to Arte recebida or Arte conferida; the Operador Arte conferida to Imprimindo to Revisão; only the Revisor (and the superadmin, for support) Revisão to Finalizado, so nobody releases their -own print; Admin and Gestão every other move, including Imprimindo or -Revisão to Correção and Correção straight to Revisão. A step back belongs to -whoever makes the move it undoes, and to Admin and Gestão. Tiny: Arte +own print; Gestão, the coordination, only pulls back, always with a reason +(rule D-20 of Dropstar's internal rules, 2026-10-26): Correção from any +stage, or a step back; Admin, Dropstar's own login, every other move, +including Correção straight to Revisão. A step back belongs to whoever makes +the move it undoes, and to Admin and Gestão. Tiny: Arte conferida sets "Preparando envio" and Finalizado "Pronto para envio", for delivery orders too; nothing for Imprimindo, Correção or Revisão. Prova OK still comes before Finalizado. The customer's portal shows the same steps. diff --git a/tests/test_moves.py b/tests/test_moves.py index 069dd33..d2713ae 100644 --- a/tests/test_moves.py +++ b/tests/test_moves.py @@ -21,9 +21,12 @@ class MovesTest(unittest.TestCase): self.assertEqual(moves('operador'), {('tra', 'imp'), ('imp', 'rev')}) self.assertEqual(moves('revisor'), {('rev', 'fin')}) self.assertEqual(moves('vendedor'), set()) - # Gestão sends to Correção and brings back, straight to Revisão too. - for pair in (('imp', 'cor'), ('cor', 'rev'), ('rev', 'cor'), ('tra', 'imp'), ('rec', 'tra')): - self.assertTrue(may_move('gestao', *pair), pair) + # Gestão, the coordination, pulls back and never forward (D-20): Correção + # from any stage, and steps back. Admin, Dropstar's login, moves forward too. + self.assertEqual(moves('gestao'), {('rec', 'cor'), ('tra', 'cor'), ('imp', 'cor'), ('rev', 'cor')}) + for pair in (('tra', 'imp'), ('rec', 'tra'), ('cor', 'rev'), ('cor', 'tra'), ('imp', 'rev')): + self.assertFalse(may_move('gestao', *pair), pair) + self.assertTrue(may_move('admin', *pair), pair) def test_only_the_revisor_releases_to_finalizado(self): for role in ROLES: diff --git a/web/kanban.html b/web/kanban.html index 27ad249..dd91196 100644 --- a/web/kanban.html +++ b/web/kanban.html @@ -102,7 +102,7 @@