Documentation
¶
Overview ¶
Package fakegithub provides a scriptable GitHub HTTP server for integration tests and local load-replay runs.
Options are applied in declaration order. Options that cannot produce a meaningful server configuration panic immediately (for example, negative rate limits, non-positive token TTLs, nil hooks, and incomplete App authentication).
RateLimitStep scripts are consumed once per response in their resource family: REST and GraphQL advance independently. An unscripted conditional 304 refunds its provisional one-unit REST charge; a scripted 304 does not refund because the scripted remaining value is authoritative. Installation token endpoints use GitHub's separate App bucket, so they are exempt from REST/GraphQL rate-step consumption while still participating in the shared concurrency ceiling.
App-hook deliveries are listed newest first. Webhook emission uses the fake's internal HTTP client, records GitHub-side delivery state even when the target rejects the request, and is available only inside this internal module.
Index ¶
- Constants
- type Actor
- type Base
- type ChangedFile
- type CheckRun
- type ControlDelivery
- type Fixture
- type HookDelivery
- type IssueComment
- type Option
- func WithAdditionalFixtures(fixtures ...Fixture) Option
- func WithAppAuthentication(appID int64, publicKey *rsa.PublicKey) Option
- func WithAppBearerToken(token string) Option
- func WithFixture(fixture Fixture) Option
- func WithGraphQLRateSteps(steps ...RateLimitStep) Option
- func WithInstallationTokenTTL(ttl time.Duration) Option
- func WithNow(now func() time.Time) Option
- func WithRESTRateSteps(steps ...RateLimitStep) Option
- func WithRateLimits(rest, graphql int64) Option
- func WithRequestHook(hook func(method string, path string, count int, fixture *Fixture)) Option
- func WithResponseDelay(delay time.Duration) Option
- type PullRequest
- type PullRequestBranch
- type PullRequestReview
- type RateLimitStep
- type Repository
- type RepositoryRule
- type ReviewComment
- type ReviewRequest
- type ReviewThread
- type Server
- func (s *Server) Authorizations() []string
- func (s *Server) CheckRunWebhookPayload(action string, checkRunID int64) (map[string]any, error)
- func (s *Server) CheckSuiteWebhookPayload(action string, headSHA string) (map[string]any, error)
- func (s *Server) Concurrent() int
- func (s *Server) Deliveries() []HookDelivery
- func (s *Server) DropWebhook(targetURL string, event string, payload any) (string, error)
- func (s *Server) DropWebhookWithGUID(targetURL string, event string, guid string, payload any) (string, error)
- func (s *Server) EmitWebhook(ctx context.Context, targetURL, event string, payload any) (string, error)
- func (s *Server) EmitWebhookWithGUID(ctx context.Context, targetURL string, event string, guid string, payload any) (string, error)
- func (s *Server) GraphQLRemaining() int64
- func (s *Server) IssueCommentCreatedWebhookPayload(number int, commentID int64) (map[string]any, error)
- func (s *Server) IssueCommentDeletedWebhookPayload(number int, commentID int64) (map[string]any, error)
- func (s *Server) IssueCommentEditedWebhookPayload(number int, commentID int64) (map[string]any, error)
- func (s *Server) MaxConcurrent() int
- func (s *Server) NotModifiedCount(method, path string) int
- func (s *Server) PullRequestReviewCommentWebhookPayload(action string, number int) (map[string]any, error)
- func (s *Server) PullRequestReviewRequestRemovedWebhookPayload(number int, reviewer ReviewRequest) (map[string]any, error)
- func (s *Server) PullRequestReviewRequestedWebhookPayload(number int, reviewer ReviewRequest) (map[string]any, error)
- func (s *Server) PullRequestReviewThreadWebhookPayload(action string, number int) (map[string]any, error)
- func (s *Server) PullRequestReviewWebhookPayload(action string, number int) (map[string]any, error)
- func (s *Server) PullRequestWebhookPayload(action string, number int) (map[string]any, error)
- func (s *Server) PushWebhookPayload(ref string, before string, after string) (map[string]any, error)
- func (s *Server) RedeliveryRequests() []int64
- func (s *Server) Remaining() int64
- func (s *Server) RequestCount(method, path string) int
- func (s *Server) ScriptNotFound(method, path string, count int)
- func (s *Server) ScriptNotFoundOnRequest(method string, path string, requestNumber int)
- func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *Server) SetFixture(fixture Fixture)
- func (s *Server) TokenMaxConcurrent() int
- func (s *Server) TokenRequests() int
- type Stack
- type StackPullRequest
- type StackRef
- type TruthBranch
- type TruthCheckRun
- type TruthCheckRunSnapshot
- type TruthCheckSuite
- type TruthCommit
- type TruthFaultSnapshot
- type TruthFixtureSnapshot
- type TruthIssueComment
- type TruthMutation
- type TruthPullRequest
- type TruthPullRequestSnapshot
- type TruthPush
- type TruthRepository
- type TruthReview
- type TruthReviewComment
- type TruthReviewThread
- type TruthReviewThreadSnapshot
- type TruthSnapshot
- type TruthStack
Constants ¶
const ( ControlEmitPath = "/_ghsync/emit" // ControlTruthPath exposes the fake's mutation truth to the local oracle. ControlTruthPath = "/_ghsync/truth" // ControlFaultPath configures flag-gated API failures for load tests. ControlFaultPath = "/_ghsync/faults" )
ControlEmitPath is a development-only control surface used by the load verifier to ask the standalone fake to record and emit a signed delivery.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Actor ¶ added in v0.3.0
type Actor struct {
Kind string `json:"kind"`
NodeID string `json:"node_id"`
Login string `json:"login"`
}
Actor preserves the GraphQL author union, including non-user participants and deleted authors (Kind "deleted" with empty identity fields).
type Base ¶
Base identifies a pull request or stack base ref and commit.
func (Base) MarshalJSON ¶ added in v0.3.0
MarshalJSON emits GitHub's wire representation for an unresolved commit: the ref remains present while sha is null.
type ChangedFile ¶ added in v0.3.0
type ChangedFile struct {
Path string `json:"filename"`
PreviousPath string `json:"previous_filename,omitempty"`
ChangeType string `json:"status"`
}
ChangedFile is fixture truth for one pull-request changed-file node. The prior path is served by REST because GitHub's GraphQL type omits it.
type CheckRun ¶
type CheckRun struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
HeadSHA string `json:"head_sha"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
DetailsURL string `json:"details_url"`
AppSlug string `json:"-"`
StartedAt *time.Time `json:"started_at"`
CompletedAt *time.Time `json:"completed_at"`
}
CheckRun is fixture truth for one check run.
func (CheckRun) MarshalJSON ¶
MarshalJSON emits GitHub's nested App shape.
type ControlDelivery ¶
type ControlDelivery struct {
Event string `json:"event"`
GUID string `json:"guid,omitempty"`
Payload json.RawMessage `json:"payload"`
Drop bool `json:"drop,omitempty"`
}
ControlDelivery is one signed delivery emitted (or GitHub-side dropped) after a truth mutation has been applied.
type Fixture ¶
type Fixture struct {
Owner string
Repo string
Repository Repository
Repositories []Repository
RepoRules []RepositoryRule
Stacks []Stack
PullRequests []PullRequest
CheckRuns []CheckRun
// Contents is keyed by exact Git ref/SHA and repository-relative path.
Contents map[string]map[string]string
}
Fixture is the complete mutable upstream truth served by a Server.
func DefaultFixture ¶
func DefaultFixture() Fixture
DefaultFixture is a canned repo modeled on the S-142 scenario from the product prototype: a five-layer stack with one merged layer.
func EmptyFixture ¶
func EmptyFixture(repository Repository) Fixture
EmptyFixture returns a single-repository fixture suitable for recording replay. The repository listing is populated so installation backfill can enroll it before traffic begins.
type HookDelivery ¶
type HookDelivery struct {
ID int64 `json:"id"`
GUID string `json:"guid"`
DeliveredAt time.Time `json:"delivered_at"`
Redelivery bool `json:"redelivery"`
Status string `json:"status"`
StatusCode int `json:"status_code"`
Event string `json:"event"`
Action string `json:"action"`
InstallationID int64 `json:"installation_id"`
RepositoryID int64 `json:"repository_id"`
}
HookDelivery is the fake's public /app/hook/deliveries representation.
type IssueComment ¶ added in v0.3.0
type IssueComment struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Author Actor `json:"author"`
Body string `json:"body,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
IssueComment is fixture truth for ordinary PR issue-comment participation. Body exists only so webhook constructors can produce schema-valid payloads; authoritative participation fetches never request or persist it.
type Option ¶
type Option func(*Server)
Option customizes the fake server for a scenario.
func WithAdditionalFixtures ¶
WithAdditionalFixtures adds independently addressable repositories to the installation. It is used to seed --copies replay namespaces before backfill.
func WithAppAuthentication ¶
WithAppAuthentication configures the public key and issuer expected by the installation-token endpoint.
func WithAppBearerToken ¶
WithAppBearerToken allows the standalone development fake to accept the static token ghsyncd uses for App deliveries-API gap healing.
func WithFixture ¶
WithFixture replaces the initial fixture after the base server is built.
func WithGraphQLRateSteps ¶
func WithGraphQLRateSteps(steps ...RateLimitStep) Option
WithGraphQLRateSteps scripts successive GraphQL response budgets.
func WithInstallationTokenTTL ¶
WithInstallationTokenTTL sets the fake token lifetime.
func WithRESTRateSteps ¶
func WithRESTRateSteps(steps ...RateLimitStep) Option
WithRESTRateSteps scripts successive REST response budgets.
func WithRateLimits ¶
WithRateLimits sets independent REST-request and GraphQL-point limits.
func WithRequestHook ¶
WithRequestHook mutates fixture truth at a deterministic request boundary. Tests use it to expose mutable-pagination races without timing sleeps.
func WithResponseDelay ¶
WithResponseDelay delays every counted API request.
type PullRequest ¶
type PullRequest struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
Draft bool `json:"draft"`
AuthorLogin string `json:"-"`
ReviewDecision string `json:"review_decision"`
MergeableState string `json:"mergeable_state"`
Head PullRequestBranch `json:"head"`
Base Base `json:"base"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"-"`
MergedAt *time.Time `json:"-"`
Stack *StackRef `json:"stack"`
ReviewThreads []ReviewThread `json:"-"`
ReviewRequests []ReviewRequest `json:"-"`
Reviews []PullRequestReview `json:"-"`
Comments []IssueComment `json:"-"`
ChangedFiles []ChangedFile `json:"-"`
ChangedFilesTotal int `json:"-"`
ChangedFilesOmitted bool `json:"-"`
}
PullRequest is fixture truth for REST and GraphQL pull responses.
type PullRequestBranch ¶
PullRequestBranch identifies one pull request branch.
type PullRequestReview ¶ added in v0.3.0
type PullRequestReview struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Author Actor `json:"author"`
State string `json:"state"`
SubmittedAt *time.Time `json:"submitted_at,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
CommitOID string `json:"commit_oid,omitempty"`
}
PullRequestReview is fixture truth for an identity-keyed review fact.
type RateLimitStep ¶
type RateLimitStep struct {
Limit int64
Remaining int64
ResetAt time.Time
Cost int64
StatusCode int
RetryAfter time.Duration
Secondary bool
}
RateLimitStep scripts one response's server-authoritative rate state. Secondary distinguishes GitHub's documented secondary-limit response shape from ordinary primary-budget exhaustion. RetryAfter may be zero to exercise GitHub's headerless secondary-limit fallback.
type Repository ¶
type Repository struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Owner string `json:"-"`
Name string `json:"name"`
FullName string `json:"full_name"`
DefaultBranch string `json:"default_branch"`
DefaultBranchSHA string `json:"-"`
Archived bool `json:"archived"`
UpdatedAt time.Time `json:"updated_at"`
PushedAt time.Time `json:"pushed_at"`
}
Repository is fixture truth for repository endpoints.
func (Repository) MarshalJSON ¶
func (r Repository) MarshalJSON() ([]byte, error)
MarshalJSON emits GitHub's nested owner shape.
type RepositoryRule ¶
type RepositoryRule struct {
ID int64 `json:"id"`
Name string `json:"name"`
Target string `json:"target"`
Enforcement string `json:"enforcement"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Rules []map[string]any `json:"rules"`
}
RepositoryRule is fixture truth for one repository rule.
type ReviewComment ¶
type ReviewComment struct {
ID string `json:"id"`
Body string `json:"body"`
UpdatedAt time.Time `json:"updated_at"`
AuthorLogin string `json:"author_login"`
}
ReviewComment is fixture truth for one review comment.
type ReviewRequest ¶ added in v0.3.0
type ReviewRequest struct {
Kind string `json:"kind"`
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Login string `json:"login"`
}
ReviewRequest is fixture truth for one RequestedReviewer union member. Login carries a user login for kind=user and a team slug for kind=team. The bot, mannequin, and nil kinds exist to exercise the documented v1 exclusion policy; they are not projected as user or team requests.
type ReviewThread ¶
type ReviewThread struct {
ID string `json:"id"`
IsResolved bool `json:"is_resolved"`
IsOutdated bool `json:"is_outdated"`
Path string `json:"path"`
Line *int `json:"line,omitempty"`
Comments []ReviewComment `json:"comments"`
}
ReviewThread is fixture truth for one GraphQL review thread.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server implements http.Handler for the API surface and can emit webhooks. All mutable state is guarded so tests can mutate the fixture mid-scenario.
func (*Server) Authorizations ¶
Authorizations returns the latest bounded window of API Authorization headers in request order.
func (*Server) CheckRunWebhookPayload ¶
CheckRunWebhookPayload builds a production-shaped check_run payload from the current fixture and a canonical octokit example.
func (*Server) CheckSuiteWebhookPayload ¶
CheckSuiteWebhookPayload builds a production-shaped check_suite payload for one fixture head SHA from a canonical octokit example.
func (*Server) Concurrent ¶
Concurrent reports requests currently inside the fake's concurrency accounting. Tests use it only to establish deterministic burst boundaries.
func (*Server) Deliveries ¶
func (s *Server) Deliveries() []HookDelivery
Deliveries returns the recorded delivery-list skeletons newest first.
func (*Server) DropWebhook ¶
DropWebhook records a GitHub-side delivery without sending it to ingress. C-R4 tests use this to model an outage/drop and then verify redelivery.
func (*Server) DropWebhookWithGUID ¶
func (s *Server) DropWebhookWithGUID( targetURL string, event string, guid string, payload any, ) (string, error)
DropWebhookWithGUID records a GitHub-side delivery with an explicit GUID without sending it to ingress. The gap-healing sweep can later request it.
func (*Server) EmitWebhook ¶
func (s *Server) EmitWebhook(ctx context.Context, targetURL, event string, payload any) (string, error)
EmitWebhook signs and POSTs a webhook delivery to targetURL, returning the globally unique delivery GUID it generated. Non-2xx responses are errors, mirroring GitHub's delivery-failure semantics.
func (*Server) EmitWebhookWithGUID ¶
func (s *Server) EmitWebhookWithGUID( ctx context.Context, targetURL string, event string, guid string, payload any, ) (string, error)
EmitWebhookWithGUID emits a delivery with an explicit GUID. Tests use it to model GitHub retries and verify GUID deduplication; an empty GUID generates a new UUID just like EmitWebhook.
func (*Server) GraphQLRemaining ¶
GraphQLRemaining reports the simulated GraphQL point budget left.
func (*Server) IssueCommentCreatedWebhookPayload ¶ added in v0.3.0
func (s *Server) IssueCommentCreatedWebhookPayload( number int, commentID int64, ) (map[string]any, error)
IssueCommentCreatedWebhookPayload builds a schema-valid PR-associated issue_comment.created delivery.
func (*Server) IssueCommentDeletedWebhookPayload ¶ added in v0.3.0
func (s *Server) IssueCommentDeletedWebhookPayload( number int, commentID int64, ) (map[string]any, error)
IssueCommentDeletedWebhookPayload builds a schema-valid PR-associated issue_comment.deleted delivery.
func (*Server) IssueCommentEditedWebhookPayload ¶ added in v0.3.0
func (s *Server) IssueCommentEditedWebhookPayload( number int, commentID int64, ) (map[string]any, error)
IssueCommentEditedWebhookPayload builds a schema-valid PR-associated issue_comment.edited delivery.
func (*Server) MaxConcurrent ¶
MaxConcurrent reports the highest counted API concurrency observed.
func (*Server) NotModifiedCount ¶
NotModifiedCount reports conditional requests satisfied with 304.
func (*Server) PullRequestReviewCommentWebhookPayload ¶
func (s *Server) PullRequestReviewCommentWebhookPayload( action string, number int, ) (map[string]any, error)
PullRequestReviewCommentWebhookPayload builds a production-shaped pull_request_review_comment payload from the current fixture and a canonical octokit example.
func (*Server) PullRequestReviewRequestRemovedWebhookPayload ¶ added in v0.3.0
func (s *Server) PullRequestReviewRequestRemovedWebhookPayload( number int, reviewer ReviewRequest, ) (map[string]any, error)
PullRequestReviewRequestRemovedWebhookPayload builds a production-shaped pull_request.review_request_removed payload for a requested user or team.
func (*Server) PullRequestReviewRequestedWebhookPayload ¶ added in v0.3.0
func (s *Server) PullRequestReviewRequestedWebhookPayload( number int, reviewer ReviewRequest, ) (map[string]any, error)
PullRequestReviewRequestedWebhookPayload builds a production-shaped pull_request.review_requested payload for a requested user or team.
func (*Server) PullRequestReviewThreadWebhookPayload ¶
func (s *Server) PullRequestReviewThreadWebhookPayload( action string, number int, ) (map[string]any, error)
PullRequestReviewThreadWebhookPayload builds a production-shaped pull_request_review_thread payload from the current fixture and a canonical octokit example.
func (*Server) PullRequestReviewWebhookPayload ¶
func (s *Server) PullRequestReviewWebhookPayload( action string, number int, ) (map[string]any, error)
PullRequestReviewWebhookPayload builds a production-shaped pull_request_review payload from the current fixture and a canonical octokit example.
func (*Server) PullRequestWebhookPayload ¶
PullRequestWebhookPayload builds a production-shaped pull_request payload from the current fixture and a canonical octokit example.
func (*Server) PushWebhookPayload ¶
func (s *Server) PushWebhookPayload( ref string, before string, after string, ) (map[string]any, error)
PushWebhookPayload builds a production-shaped push payload for a fixture branch. Empty before or after values use the fixture's default-branch SHA.
func (*Server) RedeliveryRequests ¶
RedeliveryRequests reports the delivery IDs requested through the fake redelivery endpoint.
func (*Server) RequestCount ¶
RequestCount reports the number of exact method/path requests.
func (*Server) ScriptNotFound ¶
ScriptNotFound makes the next count exact method/path requests return 404. It is used to exercise C-C4 without mutating unrelated fixture entities.
func (*Server) ScriptNotFoundOnRequest ¶
ScriptNotFoundOnRequest makes one absolute request ordinal for an exact method/path return 404. It allows pagination tests to fail page N without failing the entry request for the listing resource.
func (*Server) ServeHTTP ¶
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP applies scripts, authentication, concurrency, and rate accounting before routing a fake GitHub request.
func (*Server) SetFixture ¶
SetFixture swaps the served state; tests use this to script scenarios.
func (*Server) TokenMaxConcurrent ¶
TokenMaxConcurrent reports the highest active-request count observed while an installation-token exchange was active.
func (*Server) TokenRequests ¶
TokenRequests reports installation-token exchanges.
type Stack ¶
type Stack struct {
ID int64 `json:"id"`
Number int `json:"number"`
NodeID string `json:"node_id"`
URL string `json:"url"`
Base Base `json:"base"`
Open bool `json:"open"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
PullRequests []StackPullRequest `json:"pull_requests"` // bottom → top
}
Stack is fixture truth for the gh-stack preview API.
type StackPullRequest ¶
type StackPullRequest struct {
Number int `json:"number"`
State string `json:"state"`
Draft bool `json:"draft"`
MergedAt *time.Time `json:"merged_at"`
UpdatedAt time.Time `json:"updated_at"`
Head PullRequestBranch `json:"head"`
}
StackPullRequest is one ordered stack layer.
type StackRef ¶
type StackRef struct {
ID int64 `json:"id"`
Number int `json:"number"`
Size int `json:"size"`
Position int `json:"position"`
Base Base `json:"base"`
}
StackRef is the preview stack reference embedded in a pull request.
type TruthBranch ¶
type TruthCheckRun ¶
type TruthCheckRun struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
HeadSHA string `json:"head_sha"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion,omitempty"`
DetailsURL string `json:"details_url"`
AppSlug string `json:"app_slug,omitempty"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
type TruthCheckRunSnapshot ¶
type TruthCheckRunSnapshot struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
HeadSHA string `json:"head_sha"`
Name string `json:"name"`
Status string `json:"status"`
Conclusion string `json:"conclusion"`
DetailsURL string `json:"details_url"`
AppSlug string `json:"app_slug"`
StartedAt *time.Time `json:"started_at,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
}
type TruthCheckSuite ¶
type TruthCheckSuite struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
HeadSHA string `json:"head_sha"`
Status string `json:"status"`
Conclusion string `json:"conclusion,omitempty"`
AppSlug string `json:"app_slug,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type TruthCommit ¶
type TruthFaultSnapshot ¶
type TruthFixtureSnapshot ¶
type TruthFixtureSnapshot struct {
Repository Repository `json:"repository"`
PullRequests []TruthPullRequestSnapshot `json:"pull_requests"`
Stacks []Stack `json:"stacks"`
CheckRuns []TruthCheckRunSnapshot `json:"check_runs"`
ReviewThreads []TruthReviewThreadSnapshot `json:"review_threads"`
}
type TruthIssueComment ¶ added in v0.3.0
type TruthIssueComment struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
AuthorKind string `json:"author_kind"`
AuthorNodeID string `json:"author_node_id,omitempty"`
AuthorLogin string `json:"author_login,omitempty"`
Body string `json:"body,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type TruthMutation ¶
type TruthMutation struct {
Kind string `json:"kind"`
Action string `json:"action,omitempty"`
Repository TruthRepository `json:"repository"`
PullRequest *TruthPullRequest `json:"pull_request,omitempty"`
Review *TruthReview `json:"review,omitempty"`
IssueComment *TruthIssueComment `json:"issue_comment,omitempty"`
ReviewThread *TruthReviewThread `json:"review_thread,omitempty"`
ReviewComment *TruthReviewComment `json:"review_comment,omitempty"`
CheckSuite *TruthCheckSuite `json:"check_suite,omitempty"`
CheckRun *TruthCheckRun `json:"check_run,omitempty"`
Commit *TruthCommit `json:"commit,omitempty"`
Push *TruthPush `json:"push,omitempty"`
Stack *TruthStack `json:"stack,omitempty"`
}
TruthMutation is the replay compiler's fixture-mutation wire contract. It deliberately lives in fakegithub so the standalone fake can apply mutations without importing the replay compiler (which itself uses the fake's production-shaped payload builders).
type TruthPullRequest ¶
type TruthPullRequest struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
Draft bool `json:"draft"`
Merged bool `json:"merged"`
AuthorLogin string `json:"author_login"`
ReviewDecision string `json:"review_decision,omitempty"`
MergeableState string `json:"mergeable_state,omitempty"`
Head TruthBranch `json:"head"`
Base TruthBranch `json:"base"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
ClosedAt *time.Time `json:"closed_at,omitempty"`
MergedAt *time.Time `json:"merged_at,omitempty"`
}
type TruthPullRequestSnapshot ¶
type TruthPullRequestSnapshot struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Number int `json:"number"`
Title string `json:"title"`
State string `json:"state"`
Draft bool `json:"draft"`
AuthorLogin string `json:"author_login"`
ReviewDecision string `json:"review_decision"`
MergeableState string `json:"mergeable_state"`
Head PullRequestBranch `json:"head"`
Base Base `json:"base"`
UpdatedAt time.Time `json:"updated_at"`
Stack *StackRef `json:"stack"`
ReviewRequests []ReviewRequest `json:"review_requests"`
Reviews []PullRequestReview `json:"reviews"`
Comments []IssueComment `json:"comments"`
ChangedFiles []ChangedFile `json:"changed_files"`
ChangedFilesTotal int `json:"changed_files_total"`
ChangedFilesOmitted bool `json:"changed_files_omitted"`
CodeownersPath string `json:"codeowners_path,omitempty"`
CodeownersSource string `json:"codeowners_source,omitempty"`
CodeownersState string `json:"codeowners_state"`
}
type TruthRepository ¶
type TruthRepository struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
Owner string `json:"owner"`
Name string `json:"name"`
DefaultBranch string `json:"default_branch"`
DefaultBranchSHA string `json:"default_branch_sha"`
UpdatedAt time.Time `json:"updated_at"`
}
func (TruthRepository) FullName ¶
func (r TruthRepository) FullName() string
type TruthReview ¶
type TruthReview struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
State string `json:"state"`
Body string `json:"body,omitempty"`
AuthorLogin string `json:"author_login"`
AuthorKind string `json:"author_kind,omitempty"`
AuthorNodeID string `json:"author_node_id,omitempty"`
CommitSHA string `json:"commit_sha,omitempty"`
SubmittedAt time.Time `json:"submitted_at"`
UpdatedAt time.Time `json:"updated_at,omitzero"`
}
type TruthReviewComment ¶
type TruthReviewComment struct {
ID int64 `json:"id"`
NodeID string `json:"node_id"`
ReviewID int64 `json:"review_id,omitempty"`
Body string `json:"body,omitempty"`
Path string `json:"path"`
Line *int `json:"line,omitempty"`
AuthorLogin string `json:"author_login"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type TruthReviewThread ¶
type TruthReviewThreadSnapshot ¶
type TruthReviewThreadSnapshot struct {
PullRequest int `json:"pull_request"`
ID string `json:"id"`
IsResolved bool `json:"is_resolved"`
IsOutdated bool `json:"is_outdated"`
Path string `json:"path"`
Line *int `json:"line,omitempty"`
Comments []ReviewComment `json:"comments"`
UpdatedAt time.Time `json:"updated_at"`
}
type TruthSnapshot ¶
type TruthSnapshot struct {
Repositories []TruthFixtureSnapshot `json:"repositories"`
Faults TruthFaultSnapshot `json:"faults"`
}
TruthSnapshot is the complete final-oracle state exposed by ControlTruthPath. Only repositories touched by replay mutations are included, so a standalone fake may retain unrelated development fixtures.
type TruthStack ¶
type TruthStack struct {
ID int64 `json:"id"`
Number int `json:"number"`
Base TruthBranch `json:"base"`
PullRequests []int `json:"pull_requests"`
PullRequestStates []TruthPullRequest `json:"pull_request_states"`
Synthetic bool `json:"synthetic,omitempty"`
}