feat: enable creator notification command
CI / test (pull_request) Successful in 11s
CI / test (push) Successful in 11s

This commit was merged in pull request #10.
This commit is contained in:
m
2026-08-16 19:19:00 +03:00
parent 6e0040fe89
commit c6139699a9
16 changed files with 622 additions and 18 deletions
+12
View File
@@ -1,6 +1,7 @@
package domain
import (
"encoding/hex"
"errors"
"strings"
@@ -71,11 +72,22 @@ func allowedOperation(proposal commitcontract.ActionProposal, context Authorizat
return subject.ProspectiveItemID != "" && subject.ExpectedRevision > 0 &&
subject.FromState == continuity.ProspectiveDelivered && subject.ToState == continuity.ProspectiveSatisfied &&
strings.TrimSpace(subject.EvidenceRef) != ""
case context.Grant.Class == authority.GrantClassCreator && proposal.CapabilityID == commitcontract.CapabilityProspectiveNotification && proposal.Operation == commitcontract.OperationDeliverProspectiveNotification:
subject := proposal.NotificationSubject
return subject.ProspectiveItemID != "" && subject.ExpectedRevision > 0 &&
subject.TemplateCode == commitcontract.ProspectiveDeliveredTemplateV1 && subject.BindingID != "" && subject.BindingRevision > 0 &&
strings.TrimSpace(subject.RenderedTitle) != "" && len(subject.RenderedTitle) <= 160 &&
strings.TrimSpace(subject.RenderedMessage) != "" && len(subject.RenderedMessage) <= 2048 && validDigest(subject.RequestDigest)
default:
return false
}
}
func validDigest(value string) bool {
decoded, err := hex.DecodeString(value)
return err == nil && len(decoded) == 32 && value == strings.ToLower(value)
}
// Execute records UNKNOWN_OUTCOME rather than silently retrying an ambiguous
// external mutation.
func Execute(action commitcontract.AuthorizedAction, attemptID commitcontract.ActionAttemptID, executor ports.Executor) (commitcontract.ActionAttempt, error) {