feat(approvals): add a People page, leave channel approvals unchanged, make a binding's target optional (#2072)

This commit is contained in:
sam committed 2026-11-21 21:37:42 +11:00
1 parent b9a60e03a3
commit 4b494bf75b
8 files changed
+214 -10

No files matched your search

-2
View File
@@ -93,8 +93,6 @@ func (b Binding) complete() error {
missing = "action"
case len(bytes.TrimSpace(b.Input)) == 0:
missing = "arguments"
case b.Target.Kind == "" || b.Target.ID == "":
missing = "target"
case b.Approvers == nil:
missing = "approvers"
case b.Expires.IsZero():
+11 -2
View File
@@ -64,6 +64,7 @@ func TestBindingDigestCoversTheWholeAction(t *testing.T) {
{"the action", func(b *Binding) { b.Action = "forward" }},
{"the arguments", func(b *Binding) { b.Input = jsontext.Value(`{"to":"b@example.com","body":"hi"}`) }},
{"the target's id", func(b *Binding) { b.Target.ID = "outbox" }},
{"a target removed", func(b *Binding) { b.Target = connectors.Target{} }},
{"the target's environment", func(b *Binding) { b.Target.Environment = "dev" }},
{"the effect", func(b *Binding) { b.Effect.Reversibility = connectors.Recoverable }},
{"the approvers", func(b *Binding) { b.Approvers = []string{bob} }},
@@ -103,8 +104,6 @@ func TestBindingDigestCoversTheWholeAction(t *testing.T) {
{"connector", func(b *Binding) { b.Connector = "" }},
{"action", func(b *Binding) { b.Action = "" }},
{"arguments", func(b *Binding) { b.Input = nil }},
{"target kind", func(b *Binding) { b.Target.Kind = "" }},
{"target id", func(b *Binding) { b.Target.ID = "" }},
{"approvers", func(b *Binding) { b.Approvers = nil }},
{"expiry", func(b *Binding) { b.Expires = time.Time{} }},
}
@@ -262,6 +261,16 @@ func TestRunApprovedRunsOnlyWhatWasApprovedAndOnlyOnce(t *testing.T) {
},
wantDiscard: "its target changed",
},
{
name: "a target appeared where there was none",
change: func(f *approvalFixture) {
b := baseBinding()
b.Target = connectors.Target{}
f.action.Binding, _ = json.Marshal(b)
f.action.BindingDigest, _ = b.Digest()
},
wantDiscard: "its target changed",
},
{
name: "the target changed and would now run unattended",
change: func(f *approvalFixture) {