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

@@ -36,7 +36,8 @@ function askMachine(again=false){
const required=ME.machine_question==='required', current=myMachine();
let m=null;
const choose=async(id,confirm=false)=>{
try{await api('/me/machine',{machine_id:id,confirm});m.close();await load(true);}
// Someone else on the machine is a question, not an error (Sentry DTF-WEB-1J).
try{await api('/me/machine',{machine_id:id,confirm},{expected:confirm?[]:[409]});m.close();await load(true);}
catch(e){
if(e.status===409&&!confirm&&await ask('Outra pessoa está nesta máquina',e.message,'Continuar mesmo assim'))return choose(id,true);
say(e.message,true);}};
@@ -69,6 +70,12 @@ function paintMyMachine(){
for(const id of ['my-machine','rail-machine'])$(id).onclick=()=>askMachine(true);
$('account-machine').onclick=()=>{$('account-menu').hidden=true;askMachine(true);};
// The machine that printed the order's approved proof: the order prints
// there too, and the server refuses any other (Sentry DTF-WEB-19, 1F).
function proofMachine(order){
const card=order.proof_card;
return card?.proof_result==='ok'&&card.machine_id?(board.machines||[]).find(m=>m.id===card.machine_id)||{id:card.machine_id,name:'máquina da prova'}:null;
}
// The machine is recorded when the card is pulled into Imprimindo.
function machineCard(order){
const box=node('div',undefined,'fact');box.append(node('span','Máquina','lbl'));
@@ -80,6 +87,11 @@ function machineCard(order){
box.append(node('b',current?current.name:'Aguardando máquina'),node('span',detail));
return box;
}
const proofAt=proofMachine(order);
if(proofAt){
box.append(node('b',proofAt.name),node('span','A máquina que imprimiu a prova #'+order.proof_card.number));
return box;
}
const select=node('select');select.setAttribute('aria-label','Máquina do pedido');
const auto=node('option','Sem máquina');auto.value='';select.append(auto);
const family=order.snapshot.items.some(i=>i.mode==='uvfile'||i.mode==='uv')?'uv':'textil';
@@ -273,7 +285,8 @@ function userForm(u){
label:editing?'Salvar':'Criar usuário',onsave:async()=>{
const picked=seller.value?{id:Number(seller.value),name:seller.selectedOptions[0].textContent.replace(/ \(não está mais no Tiny\)$/,'')}:null;
const body={name:name.value,email:email.value,role:role.value()==='superadmin'?'admin':role.value(),active:active.checked,password:pass.value||null,tiny_seller:picked};
await api(editing?'/users/'+u.id:'/users',body);
// An e-mail already in use is said in the form, not an error (Sentry DTF-WEB-1D).
await api(editing?'/users/'+u.id:'/users',body,{expected:[409]});
say(editing?'Usuário salvo.':'Usuário criado. Passe o e-mail e a senha inicial para a pessoa.');await loadUsers();
}});
}
@@ -647,17 +660,22 @@ async function pullTo(order, machineId){
if(ME?.role==='operador'){
const mine=myMachine();
if(!mine){askMachine(true);return;}
// Guidance, not an error: the pull goes to the session's machine (Sentry DTF-WEB-1A).
if(machineId&&machineId!==mine.id){
say('Você está na '+mine.name+': o que você puxa vai para ela.',true);return;
say('Você está na '+mine.name+': o que você puxa vai para ela.');return;
}
target=mine.id;
}else{
target=machineId||order.machine?.id||myMachine()?.id||null;
target=machineId||proofMachine(order)?.id||order.machine?.id||myMachine()?.id||null;
if(!target){
target=await choosePullMachine(order);
if(!target)return;
}
}
const proofAt=proofMachine(order);
if(proofAt&&target!==proofAt.id){
say('O #'+order.number+' imprime na '+proofAt.name+', a máquina que imprimiu a prova #'+order.proof_card.number+'.');return;
}
const machine=(board.machines||[]).find(row=>row.id===target);
// A lane drop, or a machine chosen before, may be one that does not print
// this product (by its first item, as app/machines.py product_family): said