feat: appove and go

This commit is contained in:
thanhnv
2026-07-19 09:37:16 +07:00
parent 13fae3e6c3
commit 709b6cccd6
24 changed files with 1245 additions and 70 deletions
@@ -102,6 +102,29 @@ test('operations owner request remains visible and actionable for an independent
});
});
test('project reviewer cannot see or decide another project approval', async () => {
await withTempGovernance(async () => {
const svc = new ApprovalsService();
const submitted = svc.submit({
action: 'goal.workspace.execute',
target: 'project-alpha',
risk: 'high',
sensitive: true,
reason: 'project alpha patch',
payload: { goal_id: 'goal-alpha', project_id: 'project-alpha' },
}, { ...projectAdmin, project: 'project-alpha' }) as { proposal: { id: string } };
const otherProjectReviewer = { ...approver, project: 'project-beta' };
const reviewerInbox = svc.list(otherProjectReviewer, 'pending') as { count: number; proposals: Array<{ id: string }> };
assert.equal(reviewerInbox.count, 0);
assert.equal(reviewerInbox.proposals.length, 0);
await assert.rejects(
svc.decide({ id: submitted.proposal.id, decision: 'approve', reason: 'wrong project' }, otherProjectReviewer),
ForbiddenException,
);
});
});
test('approval inbox denies forged JWT in strict mode without deciding proposal', async () => {
await withTempGovernance(async ({ inbox }) => {
const svc = new ApprovalsService();