fix(orchestration): expose queued Gate1 expiry and audited renewal
Deploy Canina / deploy (push) Successful in 4m51s

This commit is contained in:
devops authored and devops committed 2026-10-24 09:53:07 +00:00
1 parent 6e465663bd
commit 60a4e14b4b
12 files changed
+162 -12

No files matched your search

@@ -252,7 +252,13 @@ export class EditorialExecutionService {
throw new ForbiddenException('Artifact binding mismatch');
result = { kind, sha256: artifact.sha256, bytes, brief: parsed.brief };
}
const approval = await tx.orchestrationApprovalDecision.findFirst({
where: { taskId: t.id, gate: 1 }, orderBy: { createdAt: 'desc' },
});
const valid = approval?.decision === 'APPROVED' && approval.actorId !== 'pmo' && approval.expiresAt > new Date();
return {
displayState: t.state === 'READY' && !valid ? (approval?.decision === 'APPROVED' && approval.actorId !== 'pmo' && approval.expiresAt <= new Date() ? 'GATE1_RENEWAL_REQUIRED' : 'BLOCKED') : t.state,
gate1Validity: valid ? 'VALID' : 'BLOCKED',
taskId: t.id,
pilotKind: EDITORIAL_PILOT_KIND,
state: t.state,
@@ -0,0 +1,14 @@
import { EditorialExecutionService } from './editorial-execution';
describe('editorial expiry read/claim consistency',()=>{
it('rejects the actual expired claim while status explains blocked READY',async()=>{
jest.useFakeTimers().setSystemTime(new Date('2026-10-24T09:15:00Z'));
const t={id:'565ace1f-8cfc-4447-b978-66c36e7b767b',state:'READY',version:4,metadata:{commitSha:'a'.repeat(40)}};
const tx:any={$queryRaw:jest.fn().mockResolvedValue([]),orchestrationApprovalDecision:{findFirst:jest.fn().mockResolvedValue({decision:'APPROVED',actorId:'owner',expiresAt:new Date('2026-10-24T06:37:00Z')})},orchestrationArtifact:{findMany:jest.fn().mockResolvedValue([])}};
const s=new EditorialExecutionService({$transaction:async(fn:any)=>fn(tx)} as any);
jest.spyOn(s as any,'scope').mockResolvedValue(t);
const a={id:'pmo',role:'WORKFLOW_WORKER'};
await expect(s.claim(a,{taskId:t.id})).rejects.toMatchObject({status:403,message:'Valid independent Gate1 required'});
await expect(s.status(a,t.id)).resolves.toMatchObject({state:'READY',version:4,displayState:'GATE1_RENEWAL_REQUIRED',gate1Validity:'BLOCKED',artifact:null});
jest.useRealTimers();
});
});