A failed state-label change was dropped at three points: the forge.Forge interface returned nothing, forgeext logged the extension's gRPC error instead of returning it, and the forgerpc client and server discarded the response error. SetStateLabel now returns an error on the interface and on NoopForge, forgeext propagates the extension's error, and the forgerpc server carries it in the response envelope while the client returns it, matching the other forgerpc handlers. The proto is unchanged: a gRPC error rides the status and SetStateLabelResponse is already an empty message. TestSetStateLabelFailureReachesTheCaller pins the full chain: an extension whose SetStateLabel RPC fails, through forgeext and the forgerpc client/server, to the caller receiving the error. Refs #280
72 lines
1.9 KiB
Go
72 lines
1.9 KiB
Go
package forge
|
|
|
|
import (
|
|
"context"
|
|
"log/slog"
|
|
)
|
|
|
|
// NoopForge is a zero-op Forge implementation used when forge polling is disabled ("none", "off", or "disabled").
|
|
type NoopForge struct {
|
|
log *slog.Logger
|
|
}
|
|
|
|
// NewNoop returns a NoopForge instance.
|
|
func NewNoop(log *slog.Logger) Forge {
|
|
if log == nil {
|
|
log = slog.New(slog.DiscardHandler)
|
|
}
|
|
return &NoopForge{log: log}
|
|
}
|
|
|
|
func (n *NoopForge) AssignedIssues(ctx context.Context, owner, repo, assignee string) ([]Issue, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (n *NoopForge) IssuesWithLabel(ctx context.Context, owner, repo, label string) ([]Issue, error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (n *NoopForge) Comment(ctx context.Context, owner, repo string, number int, body string) (int64, error) {
|
|
return 0, nil
|
|
}
|
|
|
|
func (n *NoopForge) CloseIssue(ctx context.Context, owner, repo string, number int, comment string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) React(ctx context.Context, owner, repo string, number int, reaction string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) SetStateLabel(ctx context.Context, owner, repo string, number int, label string, knownLabels []string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) CreatePR(ctx context.Context, owner, repo, title, head, base, body string) (int, error) {
|
|
return 0, nil
|
|
}
|
|
|
|
func (n *NoopForge) ClosePR(ctx context.Context, owner, repo string, number int, comment string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) MergePR(ctx context.Context, owner, repo string, number int) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) PRState(ctx context.Context, owner, repo string, number int) (string, error) {
|
|
return "closed", nil
|
|
}
|
|
|
|
func (n *NoopForge) AcceptInvitations(ctx context.Context, repos []RepoRef) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) VerifyPush(ctx context.Context, owner, repo string) error {
|
|
return nil
|
|
}
|
|
|
|
func (n *NoopForge) LinkBranch(ctx context.Context, owner, repo string, issueNumber int, branch string) error {
|
|
return nil
|
|
}
|