Files
mesh-delivery/modules/mesh-grants/internal/grants/needsyou.go
T
jschoubben e7779d2afd Open every grants condition's explanation as the operator-channel requires (issue 1966, recovery)
The channel refuses a raised condition whose explanation does not open with
"Needs you: " and its needs, so seven of grants' conditions, among them
first-view-unanswered, never reached the operator. One helper now writes both,
and every condition the unit tests say passes the channel's own check.

Claude-Session: https://claude.ai/code/session_01NcbgfFfQ4Z9UE5jK32PmE5
2026-11-08 23:27:39 +01:00

21 lines
794 B
Go

package grants
import (
"strings"
occ "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/clients/operatorchannelclient"
oc "git.novox.be/novox/mesh-contracts/operator-and-conversation/go/seats/operatorchannel"
)
// needsYou sets what a raised condition needs of the operator and its explanation: the channel takes a condition whose
// explanation opens with "Needs you: " and those very words (operatorchannelclient.EncodeCondition, novox/hq ADR 0253 §1),
// and refuses any other, so the operator would never see it. rest is the explanation after them.
func needsYou(c *oc.Condition, needs, rest string) {
c.Needs = needs
sep := ". "
if strings.HasSuffix(needs, "?") || strings.HasSuffix(needs, ".") {
sep = " "
}
c.Explanation = occ.NeedsYou + needs + sep + rest
}