feat(orchestration): expose owner Gate1 queue and audited hold decisions
Deploy Canina / deploy (push) Successful in 3m9s
Deploy Canina / deploy (push) Successful in 3m9s
This commit is contained in:
1 parent
65a6fe1f0c
commit
8cedc2cd67
10 files changed
+141
-7
No files matched your search
@@ -198,6 +198,13 @@ export class PrepareWorkflowService {
|
||||
const fingerprint = JSON.stringify({ id, dto, a });
|
||||
if (await this.replay(tx, dto.idempotencyKey, fingerprint)) return t;
|
||||
this.version(t, dto);
|
||||
if (dto.toState === 'GATE1_HELD') {
|
||||
if (a.role !== 'SUPER_ADMIN' || t.metadata.createdBy === a.id || t.state !== 'GATE1_PENDING')
|
||||
throw new ForbiddenException('Independent Gate1 reviewer and pending proposal required');
|
||||
if (typeof dto.reason !== 'string' || !dto.reason.trim() || dto.reason.length > 2000)
|
||||
throw new BadRequestException('Hold requires reason of 1..2000 characters');
|
||||
return this.event(tx, t, 'GATE1_HELD', a, dto.idempotencyKey, 'PREPARE_GATE1_HELD', fingerprint);
|
||||
}
|
||||
if (t.metadata.createdBy !== a.id && a.role !== 'SUPER_ADMIN')
|
||||
throw new ForbiddenException('Proposal owner required');
|
||||
if (
|
||||
@@ -252,7 +259,7 @@ export class PrepareWorkflowService {
|
||||
this.version(t, dto);
|
||||
if (t.metadata.createdBy === a.id)
|
||||
throw new ForbiddenException('Independent reviewer required');
|
||||
if (t.state !== 'GATE1_PENDING')
|
||||
if (!['GATE1_PENDING', 'GATE1_HELD'].includes(t.state))
|
||||
throw new ConflictException('Gate1 pending required');
|
||||
await tx.orchestrationApprovalDecision.create({
|
||||
data: {
|
||||
@@ -538,9 +545,11 @@ export class PrepareWorkflowService {
|
||||
safe &&
|
||||
a?.role === 'SUPER_ADMIN' &&
|
||||
t.metadata?.createdBy !== a.id &&
|
||||
t.state === 'GATE1_PENDING'
|
||||
)
|
||||
['GATE1_PENDING', 'GATE1_HELD'].includes(t.state)
|
||||
) {
|
||||
actions.push('APPROVE_GATE1', 'REJECT_GATE1');
|
||||
if (t.state === 'GATE1_PENDING') actions.push('HOLD_GATE1');
|
||||
}
|
||||
return {
|
||||
...t,
|
||||
metadata: safe
|
||||
|
||||
Reference in new issue
Block a user