fix(platform): guard approval transitions
This commit is contained in:
@@ -24,3 +24,14 @@
|
||||
## Concerns
|
||||
|
||||
- Approval status values are accepted as non-empty strings to preserve the existing status model; a future workflow may want an explicit state-transition policy (for example, only `pending -> approved|rejected`).
|
||||
|
||||
## Fix round 1: P1 approval transition guard
|
||||
|
||||
### RED / GREEN
|
||||
|
||||
- RED: approval accepted arbitrary non-empty states, updated every matching identity regardless of its current status, and did not compare the JWT operator with the applicant. The new tests reproduced invalid state acceptance, repeat processing, self-approval, and a concurrent second decision after a pending read.
|
||||
- GREEN: only `approved` and `rejected` requests proceed. The approval must still be `pending`, the applicant cannot decide it, and the update predicate is `identity AND status = pending`. A zero-row conditional update is rejected and does not append an operation audit.
|
||||
|
||||
### Verification
|
||||
|
||||
- `go test ./internal/logic/platform -run 'TestApproveAudit' -count=1 -v` — PASS
|
||||
|
||||
Reference in New Issue
Block a user