Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PRStateSnapshot ¶
type PRStateSnapshot struct {
URL string `json:"url"`
Number int `json:"number"`
Repository string `json:"repository"`
Author string `json:"author"`
Title string `json:"title"`
IsDraft bool `json:"isDraft"`
CreatedAt time.Time `json:"createdAt"`
HeadCommitSHA string `json:"headCommitSHA,omitempty"`
PipelineStatus pullrequest.PipelineStatus `json:"pipelineStatus"`
LastActivityCheck time.Time `json:"lastActivityCheck"`
Reviews map[string]ReviewSnapshot `json:"reviews"`
Seen bool `json:"seen"`
}
PRStateSnapshot is a serializable representation of the mutable state of an open pull request. It is used to persist and restore state across process restarts so that the application behaves correctly without re-querying GitHub for information it already knew.
Activities are intentionally excluded: they are always re-fetched from the GitHub API using LastActivityCheck as the fetch window.
func ToSnapshot ¶
func ToSnapshot(pr *pullrequest.PullRequest) PRStateSnapshot
ToSnapshot exports the current mutable state of the PR into a serializable form. The resulting snapshot can be persisted and later passed to ReconstitutePRFromSnapshot to rebuild the aggregate without re-fetching from GitHub.
func ToSnapshots ¶
func ToSnapshots(prs []*pullrequest.PullRequest) []PRStateSnapshot
func (PRStateSnapshot) ReconstitutePRFromSnapshot ¶
func (s PRStateSnapshot) ReconstitutePRFromSnapshot() (*pullrequest.PullRequest, error)
ReconstitutePRFromSnapshot rebuilds a PullRequest aggregate from a previously saved snapshot. Unlike NewPullRequest, this function restores all fields directly without raising domain events — it is restoring known state, not discovering new facts.
Only open PRs are ever persisted to a snapshot; closed and merged PRs are removed from the tracking repository before saving. Status is therefore always StatusOpen on reconstitution.
type ReviewSnapshot ¶
type ReviewSnapshot struct {
State pullrequest.ReviewState `json:"state"`
SubmittedAt time.Time `json:"submittedAt"`
}
ReviewSnapshot is a serializable representation of a single reviewer's latest review state on a pull request.