fix(orchestration): provision explicit Stage owner Gate1 review access
Deploy Canina / deploy (push) Successful in 4m40s
Deploy Canina / deploy (push) Successful in 4m40s
Preserve independent proposer checks, canonical Admin UUID allowlist and deny ordinary admins. Revalidate pinned owner in read-only CI preflight; expose server-advertised card decisions and distinguish reservation from unknown real cost. Verified backend 42 HTTP/service/config tests and build; admin 18 relevant tests, app tsc and Vite build; 3 CI config tests and bash syntax.
This commit is contained in:
1 parent
bfb1841370
commit
3e78b89cc1
11 files changed
+172
-11
No files matched your search
@@ -116,3 +116,17 @@ it('separates human evidence from server workflow scope without inventing a mark
|
||||
expect(await screen.findByText('محدوده و معیارهای پذیرش گزارششده از سرور')).toBeInTheDocument();
|
||||
expect(screen.getByText('محدوده گردش کار سرور: در نمای امن در دسترس نیست.')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('shows advertised decisions directly on pending card and labels reservation not measured cost',async()=>{
|
||||
const ownerTask={...task,budgetLimitCents:20,availableActions:['APPROVE_GATE1','REJECT_GATE1','HOLD_GATE1']};
|
||||
vi.mocked(api.get).mockImplementation(async url=>({data:url.endsWith('/overview')?{items:[],measuredAt:'now',capabilities:{mutations:true}}:url.endsWith('/tasks')?[ownerTask]:ownerTask}));
|
||||
render(<OrchestrationCommandCenter/>);
|
||||
const card=await screen.findByRole('region',{name:'منتظر تصمیم شما'});
|
||||
expect(await within(card).findByRole('button',{name:'تأیید کار محدود در Gate1'})).toBeEnabled();
|
||||
expect(within(card).getByRole('button',{name:'رد کار در Gate1'})).toBeEnabled();
|
||||
expect(within(card).getByRole('button',{name:'تعویق تصمیم Gate1'})).toBeEnabled();
|
||||
expect(within(card).getByText('رزرو آزمایشی؛ هزینه واقعی نامشخص')).toBeInTheDocument();
|
||||
fireEvent.click(within(card).getByRole('button',{name:'تعویق تصمیم Gate1'}));
|
||||
expect(await screen.findByRole('region',{name:'جزئیات وظیفه'})).toBeInTheDocument();
|
||||
expect(api.post).not.toHaveBeenCalled(); expect(api.put).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -64,10 +64,10 @@ export default function OrchestrationCommandCenter() {
|
||||
{success&&<p role="status">{success}</p>}
|
||||
{section==='وظیفهها و تأییدها'&&capabilities.mutations&&<CreateOrchestrationTask onCreated={()=>void loadTasks()}/>}
|
||||
{section==='نمای کلی'&&<section aria-label="منتظر تصمیم شما" className="border-2 border-purple-300 bg-purple-50 rounded-2xl p-5 space-y-4">
|
||||
<h2 className="text-xl font-black">منتظر تصمیم شما</h2><p>تصمیم Gate1 برای کار محدود؛ تأیید بهمعنای انتشار یا اجرای Production نیست. اقدامها پس از دریافت جزئیات از سرور نمایش داده میشوند.</p>
|
||||
<h2 className="text-xl font-black">منتظر تصمیم شما</h2><p>تصمیم Gate1 برای کار محدود؛ تأیید بهمعنای انتشار یا اجرای Production نیست. دکمهها فقط اقدامهای مجاز اعلامشده توسط سرور هستند؛ برای بررسی و تصمیم، جزئیات را باز کنید.</p>
|
||||
<label>فیلتر تصمیمها<select aria-label="فیلتر تصمیمها" value={decisionFilter} onChange={e=>setDecisionFilter(e.target.value)} className="border rounded p-2 m-2"><option value="ALL">در انتظار و بهتعویقافتاده</option><option value="GATE1_PENDING">در انتظار تصمیم</option><option value="GATE1_HELD">بهتعویقافتاده</option></select></label>
|
||||
{!loading&&!error&&!tasks.some(t=>['GATE1_PENDING','GATE1_HELD'].includes(t.state)&&(decisionFilter==='ALL'||t.state===decisionFilter))&&<p>تصمیمی در این فیلتر منتظر نیست.</p>}
|
||||
{!loading&&!error&&tasks.filter(t=>['GATE1_PENDING','GATE1_HELD'].includes(t.state)&&(decisionFilter==='ALL'||t.state===decisionFilter)).map(t=><article key={t.id} className="bg-white border rounded-xl p-4 space-y-3"><button disabled={!!pending||busy} className="font-bold text-purple-700 underline" onClick={()=>void select(t)}>{t.title}</button><p>{label(t.department)} · {label(t.state)} · سقف بودجه: {t.budgetLimitCents??'نامشخص'} سنت</p>{selected?.id!==t.id&&<><p>محدوده: {typeof t.metadata?.scope==='string'?t.metadata.scope:'گزارش نشده؛ جزئیات را بررسی کنید'}</p><h3>معیارهای پذیرش</h3>{Array.isArray(t.metadata?.acceptanceCriteria)&&t.metadata.acceptanceCriteria.every(c=>typeof c==='string')?<ul className="list-disc list-inside">{(t.metadata.acceptanceCriteria as string[]).map((c,i)=><li key={i}>{c}</li>)}</ul>:<p>گزارش نشده؛ جزئیات را بررسی کنید</p>}</>}</article>)}
|
||||
{!loading&&!error&&tasks.filter(t=>['GATE1_PENDING','GATE1_HELD'].includes(t.state)&&(decisionFilter==='ALL'||t.state===decisionFilter)).map(t=><article key={t.id} className="bg-white border rounded-xl p-4 space-y-3"><button disabled={!!pending||busy} className="font-bold text-purple-700 underline" onClick={()=>void select(t)}>{t.title}</button><p>{label(t.department)} · {label(t.state)} · سقف بودجه: {t.budgetLimitCents??'نامشخص'} سنت</p><p>رزرو آزمایشی؛ هزینه واقعی نامشخص</p><div className="flex flex-wrap gap-2">{t.availableActions.filter(a=>['APPROVE_GATE1','REJECT_GATE1','HOLD_GATE1'].includes(a.id)).map(a=><Button key={a.id} disabled={!capabilities.mutations||!!pending||busy||!!actionBlockReason(t,a)} onClick={()=>void select(t)}>{actionLabel(a)}</Button>)}</div>{selected?.id!==t.id&&<><p>محدوده: {typeof t.metadata?.scope==='string'?t.metadata.scope:'گزارش نشده؛ جزئیات را بررسی کنید'}</p><h3>معیارهای پذیرش</h3>{Array.isArray(t.metadata?.acceptanceCriteria)&&t.metadata.acceptanceCriteria.every(c=>typeof c==='string')?<ul className="list-disc list-inside">{(t.metadata.acceptanceCriteria as string[]).map((c,i)=><li key={i}>{c}</li>)}</ul>:<p>گزارش نشده؛ جزئیات را بررسی کنید</p>}</>}</article>)}
|
||||
</section>}
|
||||
{section==='نمای کلی'&&!loading&&!error&&<section className="bg-white border rounded-2xl p-5 space-y-4"><h2 className="font-bold">فهرست وظیفههای ثبتشده</h2><p>{tasks.length} وظیفه از سرور دریافت شد. این فهرست نشاندهنده سلامت عامل یا وضعیت زنده اجرا نیست.</p><div className="flex flex-wrap gap-3">{[...new Set(tasks.map(t=>t.state))].map(state=><span key={state} className="border rounded-xl p-3">{label(state)}: {tasks.filter(t=>t.state===state).length}</span>)}</div></section>}
|
||||
{(['نمای کلی','وظیفهها و تأییدها','اجراها و خروجیها'] as Section[]).includes(section)&&<section className="bg-white border rounded-2xl p-5 space-y-4"><label>جستوجوی وظیفهها<input className="border rounded-lg p-2 m-2" value={search} onChange={e=>setSearch(e.target.value)}/></label>
|
||||
@@ -78,7 +78,7 @@ export default function OrchestrationCommandCenter() {
|
||||
<h3 className="font-bold">اقدامهای مجاز اعلامشده توسط سرور</h3>{!selected.availableActions.length&&<p>اقدامی اعلام نشده است. این نما فقط خواندنی است؛ مرورگر مجوز یا تغییر وضعیت ایجاد نمیکند.</p>}<div className="flex flex-wrap gap-2">{selected.availableActions.map(a=><Button key={a.id} disabled={!capabilities.mutations||!!actionBlockReason(selected,a)} title={!capabilities.mutations?'تغییرات از طرف سرور مجاز نیست':actionBlockReason(selected,a)} onClick={()=>open(selected,a)}>{actionLabel(a)}</Button>)}</div>
|
||||
<h3 className="font-bold">تصمیمهای تأیید تغییرناپذیر</h3><Json value={selected.decisions??[]}/>
|
||||
<h3 className="font-bold">اجراها و خروجیهای ثبتشده</h3>{!selected.runs?.length&&<p>اجرای ثبتشدهای وجود ندارد.</p>}{selected.runs?.map(r=><article key={r.id} className="border rounded-xl p-3 space-y-2"><h4>{r.id} · {label(r.status)}</h4><p>کامیت: {r.commitSha} · محیط: {r.environment}</p>{r.artifacts.map(a=><Json key={a.id} value={a}/>)}</article>)}
|
||||
<h3 className="font-bold">دفتر بودجه (سنت؛ نه مصرف تخمینی)</h3><Json value={selected.budgetLedger??[]}/><h3 className="font-bold">رویدادهای ممیزی بهترتیب</h3><Json value={selected.events??[]}/>
|
||||
<p>رزرو آزمایشی؛ هزینه واقعی نامشخص</p><h3 className="font-bold">دفتر بودجه (سنت؛ رزرو با هزینه واقعی متفاوت است)</h3><Json value={selected.budgetLedger??[]}/><h3 className="font-bold">رویدادهای ممیزی بهترتیب</h3><Json value={selected.events??[]}/>
|
||||
</section>}
|
||||
{snapshot&&<section className="bg-white border rounded-2xl p-5 space-y-4"><h2>{section}</h2><p>زمان دریافت از سرور: {snapshot.measuredAt}</p>{!snapshot.items.length&&<p>رکوردی از سرور دریافت نشد.</p>}<div className="grid md:grid-cols-2 gap-3">{snapshot.items.map(item=><article key={item.id} className="border rounded-xl p-4"><h3 className="font-bold">{item.title??item.id}</h3><dl>{Object.entries(item).filter(([k])=>k!=='id'&&k!=='title').map(([k,v])=><div key={k} className="flex justify-between gap-3"><dt>{label(k)}</dt><dd>{String(v??'نامشخص')}</dd></div>)}</dl></article>)}</div><p>تغییر تنظیمات فقط با فرمان مجاز سرور ممکن است؛ مرورگر فرمانی ایجاد نمیکند.</p></section>}
|
||||
{section==='توقف اضطراری'&&!capabilities.killSwitch&&<p>کنترل توقف اضطراری در این نسخه در دسترس نیست؛ مسیر سرور اجازه تغییر نمیدهد.</p>}
|
||||
|
||||
Reference in new issue
Block a user