Extract Grammaratur, Dregarnuhr, Geduldh, Mestionora, Ordoschnellic, Schutzaria, Kunstzeal and Seheweit behind compatible application contracts. Include accumulated editor resilience, navigation and theme UX, remote CLI, storage/schema and DR groundwork, tests and design/operations documentation. Verified: uncached full Go suite; go vet ./...; race tests for all eight components; 11 targeted Chromium tests; Node suites; 19 Python CLI tests; reproducible editor build. No push, release tag or deployment in this checkpoint.
23 lines
838 B
Go
23 lines
838 B
Go
package schutzaria
|
|
|
|
import "errors"
|
|
|
|
var ErrApprovalTransition = errors.New("invalid approval request transition")
|
|
|
|
func ValidApprovalDecision(decision string) bool {
|
|
return decision == "approved" || decision == "rejected" || decision == "changes_requested"
|
|
}
|
|
|
|
// ApprovalNextState preserves the existing request state machine only.
|
|
// It does not verify reviewer authority, expiry, quorum, source revisions or
|
|
// audience. The caller owns those checks and the transactional CAS/write.
|
|
func ApprovalNextState(state string, currentGeneration, generation int64, decision string) (string, error) {
|
|
if generation < 1 || state != "pending" || currentGeneration != generation || !ValidApprovalDecision(decision) {
|
|
return "", ErrApprovalTransition
|
|
}
|
|
if decision == "changes_requested" {
|
|
return "rejected", nil
|
|
}
|
|
return decision, nil
|
|
}
|