B2: on every branch-moved of a watched branch, and at its start for every watched branch's head, the bridge reads the head through the seat git's verb branch, as a kept call that waits on the holder's return while the branch is watched, and writes one head-moved (repository, branch, head, before the head held in its state heads, start) on its stream forge; a head equal to the one held writes nothing. It reads no pull request, no tree, no file and no protection: the merged and pushed messages, their inputs and the state inputs, the call of git.pull, the finding branch-unprotected with its held finding writer, and the ten-second redelivery go. A move whose head cannot be read is left unacknowledged for the bus to deliver again. B3: the pull-message path (Convert, the open pull requests at start and reconnect, the forge-delete message), the groups (internal/groups' group part, forge.group.merged, end-asks, bridge_groups, bridge_group_end_again), bridge_merged_message with the forge-made reader, the checker's owed and the merge act of a switched key (with the switch's bookkeeping read) go, with their consumes, invokes, states and requires. The gate's owed path stays (H-A-71), its catch-up from the gate's verb groups gone with that verb. The two meet in main.go and the package compiles only with both, as it did not since B1. The unit suites pass; the whole test (integration) is rewritten in B4. Builds: design 47 H §739, §764 (the forge bridge; the branch protection); lead answers H-A-23, H-A-27, H-A-48, H-A-71 Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
29 lines
921 B
Go
29 lines
921 B
Go
// Package bridge reads the seat git's branch-moved and the acts owed to the forge, and makes the messages the forge
|
|
// bridge writes on its stream forge: head-moved (design 47 H §739) and owed.ended.
|
|
package bridge
|
|
|
|
import (
|
|
"errors"
|
|
"fmt"
|
|
"regexp"
|
|
)
|
|
|
|
// ErrUnreadable is wrapped by every error that says an event cannot be turned into a message; it is never
|
|
// redelivered.
|
|
var ErrUnreadable = errors.New("unreadable event")
|
|
|
|
// Message is a message for the stream forge: the event name (forge.<owner>.<name>.<escaped branch>.head-moved) and its
|
|
// JSON body.
|
|
type Message struct {
|
|
Event string
|
|
Data []byte
|
|
// Said is what the bridge did that the log says, beside writing the message; empty for none.
|
|
Said string
|
|
}
|
|
|
|
var sha40 = regexp.MustCompile(`^[0-9a-f]{40}$`)
|
|
|
|
func unreadable(subject, why string, args ...any) error {
|
|
return fmt.Errorf("%w: %s: %s", ErrUnreadable, subject, fmt.Sprintf(why, args...))
|
|
}
|