From bc00b567187774df629c9e03ea5937544b7a8dc7 Mon Sep 17 00:00:00 2001 From: devops Date: Fri, 23 Oct 2026 20:46:03 +0000 Subject: [PATCH] Repair Persian RTL orchestration panel and honest unavailable states Preserve bounded command safety and snapshot provenance; render structured Persian records without translating human evidence. Validated app/node TypeScript, Vite build and 394 tests across 64 files in private Node 22 runner. --- .../CreateOrchestrationTask.test.tsx | 12 +-- .../components/CreateOrchestrationTask.tsx | 8 +- .../OrchestrationPresentation.test.tsx | 10 ++ .../components/OrchestrationPresentation.tsx | 11 ++ .../src/components/RouterUsagePanel.tsx | 23 ++-- .../src/components/RuntimeReadPanel.test.tsx | 34 +++--- .../src/components/RuntimeReadPanel.tsx | 28 ++--- .../pages/OrchestrationCommandCenter.test.tsx | 101 +++++++----------- .../src/pages/OrchestrationCommandCenter.tsx | 73 +++++++------ .../src/pages/PersianOrchestration.test.tsx | 30 ++++++ .../src/pages/selectionSafety.test.tsx | 10 +- .../src/pages/workflowSafety.test.tsx | 30 +++--- .../src/services/orchestration.test.ts | 25 ++--- .../admin-panel/src/services/orchestration.ts | 51 ++++----- .../src/services/routerUsage.test.tsx | 8 +- 15 files changed, 244 insertions(+), 210 deletions(-) create mode 100644 frontend/admin-panel/src/components/OrchestrationPresentation.test.tsx create mode 100644 frontend/admin-panel/src/components/OrchestrationPresentation.tsx create mode 100644 frontend/admin-panel/src/pages/PersianOrchestration.test.tsx diff --git a/frontend/admin-panel/src/components/CreateOrchestrationTask.test.tsx b/frontend/admin-panel/src/components/CreateOrchestrationTask.test.tsx index 7a8310ba..165db64b 100644 --- a/frontend/admin-panel/src/components/CreateOrchestrationTask.test.tsx +++ b/frontend/admin-panel/src/components/CreateOrchestrationTask.test.tsx @@ -5,12 +5,12 @@ import CreateOrchestrationTask from './CreateOrchestrationTask'; vi.mock('../services/api',()=>({default:{post:vi.fn()}})); it('submits exact bounded PREPARE contract only after valid commit and budget',async()=>{ vi.mocked(api.post).mockResolvedValue({data:{id:'new'}});const done=vi.fn();render(); - expect(screen.getByRole('button',{name:'Create bounded task'})).toBeDisabled(); - for(const [label,value] of Object.entries({'Task key':'audit-1','Title':'Audit schema','Department':'SEO','Commit SHA (40 lowercase hex)':'a'.repeat(40),'Budget cap in cents':'500','Scope':'Audit staging only','Acceptance criteria (one per line)':'Schema checked\nEvidence attached'}))fireEvent.change(screen.getByLabelText(label),{target:{value}}); - for(const value of ['19','10001','20.5']){fireEvent.change(screen.getByLabelText('Budget cap in cents'),{target:{value}});expect(screen.getByRole('button',{name:'Create bounded task'})).toBeDisabled();} - fireEvent.change(screen.getByLabelText('Budget cap in cents'),{target:{value:'500'}}); - fireEvent.click(screen.getByRole('button',{name:'Create bounded task'})); - await screen.findByText('Task created by backend.'); + expect(screen.getByRole('button',{name:'ایجاد وظیفه محدود'})).toBeDisabled(); + for(const [label,value] of Object.entries({'کلید یکتای وظیفه':'audit-1','عنوان':'Audit schema','دپارتمان':'SEO','شناسه کامیت (۴۰ نویسه هگز کوچک)':'a'.repeat(40),'سقف بودجه به سنت':'500','محدوده':'Audit staging only','معیارهای پذیرش (هر معیار در یک خط)':'Schema checked\nEvidence attached'}))fireEvent.change(screen.getByLabelText(label),{target:{value}}); + for(const value of ['19','10001','20.5']){fireEvent.change(screen.getByLabelText('سقف بودجه به سنت'),{target:{value}});expect(screen.getByRole('button',{name:'ایجاد وظیفه محدود'})).toBeDisabled();} + fireEvent.change(screen.getByLabelText('سقف بودجه به سنت'),{target:{value:'500'}}); + fireEvent.click(screen.getByRole('button',{name:'ایجاد وظیفه محدود'})); + await screen.findByText('وظیفه توسط سرور ایجاد شد.'); expect(api.post).toHaveBeenCalledWith('/admin/orchestration/tasks',{key:'audit-1',title:'Audit schema',department:'SEO',operationMode:'PREPARE',budgetLimitCents:500,metadata:{commitSha:'a'.repeat(40),scope:'Audit staging only',acceptanceCriteria:['Schema checked','Evidence attached']}}); expect(done).toHaveBeenCalledOnce(); }); diff --git a/frontend/admin-panel/src/components/CreateOrchestrationTask.tsx b/frontend/admin-panel/src/components/CreateOrchestrationTask.tsx index 8872a89b..d5a6108b 100644 --- a/frontend/admin-panel/src/components/CreateOrchestrationTask.tsx +++ b/frontend/admin-panel/src/components/CreateOrchestrationTask.tsx @@ -7,9 +7,9 @@ export default function CreateOrchestrationTask({onCreated}:{onCreated:()=>void} const [busy,setBusy]=useState(false);const [error,setError]=useState('');const [success,setSuccess]=useState(''); const input:CreateTaskInput={key:fields.key,title:fields.title,department:fields.department,operationMode:'PREPARE',budgetLimitCents:Number(fields.budget),metadata:{commitSha:fields.commitSha,scope:fields.scope,acceptanceCriteria:fields.criteria.split('\n')}}; const valid=Object.values(fields).every(value=>value.trim())&&!proposalError(input); - return
Create bounded work
{e.preventDefault();if(!valid||busy||success)return;setBusy(true);setError('');setSuccess('');try{await orchestration.create(input);setSuccess('Task created by backend.');onCreated()}catch(error){setError(error instanceof Error?error.message+' — Refresh and reconcile the task key before resubmitting.':'Create failed; reconcile task key before retry')}finally{setBusy(false)}}}> - {([['key','Task key'],['title','Title'],['department','Department'],['commitSha','Commit SHA (40 lowercase hex)'],['budget','Budget cap in cents'],['scope','Scope'],['criteria','Acceptance criteria (one per line)']] as const).map(([key,label])=>