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 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 GitHub collaborator API role_name to ActorRole. Custom repository roles are not resolved here; they map to RoleNone, matching the bash routing gate and keeping dispatch semantics restrictive until custom roles are handled platform-wide.
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 {
Command string `json:"command,omitempty"`
Body string `json:"body"`
Instruction string `json:"instruction,omitempty"`
}
Comment describes a comment_added transition.
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 or change proposal.
type EntityKind ¶
type EntityKind string
EntityKind identifies work items vs change proposals.
const ( EntityWorkItem EntityKind = "work_item" EntityChangeProposal EntityKind = "change_proposal" )
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"`
}
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" )