Documentation
¶
Overview ¶
Package normevent defines forge-neutral NormalizedEvent types for harness CEL dispatch (ADR 0061). Schema: docs/normative/normalized-event/v1/.
Index ¶
- func ComputeChangeProposalIsFork(headRepo, baseRepo string) bool
- func IsWriteAuthorized(role ActorRole) bool
- type Actor
- type ActorKind
- type ActorRole
- type ChangeProposal
- type Comment
- type ConversationCategory
- type ConversationState
- type Entity
- type EntityKind
- type Event
- type LabelChange
- type LinkedChangeProposal
- type Review
- type Source
- type SourceSystem
- type State
- type Transition
- type TransitionKind
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeChangeProposalIsFork ¶
ComputeChangeProposalIsFork reports whether a change proposal is fork-based. Missing head or base repo metadata is treated as fork (fail-closed) so CEL guards like !event.state.change_proposal.is_fork stay trustworthy.
func IsWriteAuthorized ¶
IsWriteAuthorized reports whether actor.role satisfies ADR 0054 dispatch gate.
Types ¶
type Actor ¶
type Actor struct {
ID string `json:"id"`
Kind ActorKind `json:"kind"`
Role ActorRole `json:"role"`
IsEntityAuthor bool `json:"is_entity_author"`
}
Actor is the user or service account that caused the transition.
type ActorRole ¶
type ActorRole string
ActorRole is the effective repository permission level (ADR 0054).
func MapGitHubPermission ¶
MapGitHubPermission maps a GitHub base role to ActorRole. The GitHub client resolves custom repository roles to a base role before this mapping; unrecognized values map to RoleNone.
func MapGitLabAccessLevel ¶ added in v0.46.0
MapGitLabAccessLevel maps a GitLab project membership access level to the normalized repository permission role used by the authorization contract.
type ChangeProposal ¶
type ChangeProposal struct {
ID int `json:"id"`
HeadRepo string `json:"head_repo"`
BaseRepo string `json:"base_repo"`
HeadRef string `json:"head_ref"`
BaseRef string `json:"base_ref"`
HeadSHA string `json:"head_sha,omitempty"`
AuthorID string `json:"author_id"`
IsFork bool `json:"is_fork"`
}
ChangeProposal carries branch/repo context for PR/MR workloads.
type Comment ¶
type Comment struct {
ID string `json:"id,omitempty"`
ParentID string `json:"parent_id,omitempty"`
Command string `json:"command,omitempty"`
Body string `json:"body"`
Instruction string `json:"instruction,omitempty"`
}
Comment describes a comment_* transition. ID and ParentID are backend-native message ids (ADR 0086): GitHub comment id/node_id and normalized parent_id; Slack ts and thread_ts. For conversation comment events both are required; ParentID is always the thread-root id (equal to ID when this message is the root).
type ConversationCategory ¶ added in v0.37.0
type ConversationCategory struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Slug string `json:"slug,omitempty"`
Format string `json:"format,omitempty"`
}
ConversationCategory is the exclusive category of a conversation.
type ConversationState ¶ added in v0.37.0
type ConversationState struct {
Category ConversationCategory `json:"category"`
}
ConversationState is conversation-level metadata (ADR 0086).
type Entity ¶
type Entity struct {
Kind EntityKind `json:"kind"`
ID int `json:"id"`
Key string `json:"key,omitempty"`
URL string `json:"url"`
LinkedChangeProposal *LinkedChangeProposal `json:"linked_change_proposal,omitempty"`
}
Entity is the target work item, change proposal, or conversation.
type EntityKind ¶
type EntityKind string
EntityKind identifies work items, change proposals, or conversations. Threads are not a separate entity kind; reply association uses transition.comment.parent_id (ADR 0086).
const ( EntityWorkItem EntityKind = "work_item" EntityChangeProposal EntityKind = "change_proposal" EntityConversation EntityKind = "conversation" )
type Event ¶
type Event struct {
Repo string `json:"repo"`
Entity Entity `json:"entity"`
Transition Transition `json:"transition"`
Actor Actor `json:"actor"`
State State `json:"state"`
Source Source `json:"source"`
}
Event is a forge-neutral routing input for fullsend dispatch.
type LabelChange ¶
type LabelChange struct {
Name string `json:"name"`
Action string `json:"action"` // added | removed
}
LabelChange describes a label add/remove transition.
type LinkedChangeProposal ¶
LinkedChangeProposal links a work item to an associated change proposal.
type Source ¶
type Source struct {
System SourceSystem `json:"system"`
RawType string `json:"raw_type"`
RawAction string `json:"raw_action,omitempty"`
}
Source describes the native forge event.
type SourceSystem ¶
type SourceSystem string
SourceSystem identifies event provenance.
const ( SystemGitHub SourceSystem = "github" SystemGitLab SourceSystem = "gitlab" SystemJira SourceSystem = "jira" SystemManual SourceSystem = "manual" SystemSchedule SourceSystem = "schedule" )
type State ¶
type State struct {
Labels []string `json:"labels"`
ChangeProposal *ChangeProposal `json:"change_proposal,omitempty"`
Conversation *ConversationState `json:"conversation,omitempty"`
}
State is a snapshot of entity metadata at event time.
type Transition ¶
type Transition struct {
Kind TransitionKind `json:"kind"`
Label *LabelChange `json:"label,omitempty"`
Comment *Comment `json:"comment,omitempty"`
Review *Review `json:"review,omitempty"`
}
Transition describes what changed on the entity.
type TransitionKind ¶
type TransitionKind string
TransitionKind is the semantic lifecycle transition.
const ( TransitionOpened TransitionKind = "opened" TransitionReopened TransitionKind = "reopened" TransitionEdited TransitionKind = "edited" TransitionSynchronized TransitionKind = "synchronized" TransitionUpdated TransitionKind = "updated" TransitionClosed TransitionKind = "closed" TransitionMerged TransitionKind = "merged" TransitionMarkedReady TransitionKind = "marked_ready" TransitionLabelChanged TransitionKind = "label_changed" TransitionCommentAdded TransitionKind = "comment_added" TransitionCommentEdited TransitionKind = "comment_edited" TransitionCommentDeleted TransitionKind = "comment_deleted" TransitionReviewSubmitted TransitionKind = "review_submitted" )