Documentation
¶
Overview ¶
Package service is vx's application logic: creating repos and efforts, opening workspaces and landing changes. It is independent of the API transport; internal/api adapts it to connect-go.
Index ¶
- Constants
- Variables
- func Ago(now, t time.Time) string
- func AgreementDay(t time.Time) string
- func AwayNotice(q Note, now time.Time) string
- func CIFailedNote(n Note) bool
- func CheckOrigin(c rules.CheckDef, org OrgChecks) string
- func CheckRunName(check string) string
- func CheckStatusNotes(editsRules bool, warnings []string) []string
- func ClaimTrust(actor Actor, c Claim) string
- func Classify(err error) error
- func ClientIPFrom(ctx context.Context) string
- func FormatBytes(n int64) string
- func GitHubChecksOff(gaps []GitHubAppGap) bool
- func GitHubHandle(login string, id int64) string
- func HostWebhookPath(p store.Provider) string
- func InScope(sc store.AgentScope, path string) bool
- func MaxNoteBodyOf(kind NoteKind) int
- func MergeOrgChecks(org OrgChecks, repo []rules.CheckDef) ([]rules.CheckDef, []string)
- func NormalizeGitHubLogin(v string) (string, error)
- func NormalizeUserCode(code string) string
- func OverlapResolvedNote(n Note) bool
- func PKCEChallenge(verifier string) string
- func ParseBytes(s string) (int64, error)
- func ParseOrgChecks(source string) ([]rules.CheckDef, error)
- func ParseRetention(v string) (time.Duration, error)
- func RebaseNeededNote(n Note) bool
- func ReporterAllowed(rule string, allowSamePerson bool, author ChangeAuthor, by ReporterIdentity) (bool, string)
- func SimilarNotice(q Note) string
- func TargetsMatch(target, want string) bool
- func TaskTrust(actor Actor, t Task) string
- func TrustLabel(r *CheckResult) string
- func TrustOf(actor Actor, n Note) string
- func WithClientIP(ctx context.Context, ip string) context.Context
- func WithPermissionDenied(msg string) string
- type AccessEntry
- type AccessHelp
- type AccountExistsError
- type Actor
- type AddTaskInput
- type AgentSummary
- type AgentView
- type AgreementNotice
- type AgreementRecord
- type AgreementSettings
- type AgreementVersion
- type AgreementView
- type ArtifactInput
- type AskInput
- type AuditQuery
- type AuditRow
- type AuditSettings
- type AutoRebase
- type BackfillStats
- type CIEvent
- type CISummary
- type CITokenView
- type CLILogin
- type ChangeAuthor
- type CheckCounts
- type CheckJobView
- type CheckResult
- type CheckSettings
- type CheckState
- type CheckStatusInput
- type CheckStatusView
- type Claim
- type ClaimInput
- type Code
- type ContextWorkspace
- type ContinueInput
- type CreateEffortInput
- type CreateRepoInput
- type DiskSpace
- type EffortView
- type EnqueueInput
- type Error
- type ForYou
- type ForYouItem
- type GeneratedRule
- type GitHubAPI
- type GitHubAppCredentials
- type GitHubAppGap
- type GitHubAppInfo
- type GitHubAppSettings
- type GitHubCheckRun
- type GitHubCheckRunsAPI
- type GitHubChecksAPI
- type GitHubInstallation
- type GitHubRepo
- type GitHubRoleScope
- type GitHubSettings
- type GitHubSignupRefused
- type GitHubUser
- type HostDelivery
- type HostHook
- type HostSettings
- type HumanCheck
- type Inbox
- type JobChange
- type JobChangeRef
- type JobEffort
- type JobFile
- type JobInputs
- type JobSpec
- type LandInput
- type LandResult
- type ListJobsInput
- type ListNotesInput
- type ListTasksInput
- type LogEntry
- type Membership
- type MergeResult
- type MirrorCleaner
- type NewPerson
- type NextJobInput
- type Note
- type NoteContext
- type NoteKind
- type Object
- type Org
- type OrgChecks
- type OrgDeletion
- type OrgDeletionSettings
- type OrgDetail
- type OrgRole
- type OtherEffortActivity
- type Overlap
- type PRRef
- type PipelineCheck
- type PipelineView
- type PostNoteInput
- type Presence
- type PushMessage
- type PushSettings
- type PushSubscribeInput
- type Quota
- type QuotaRow
- type QuotaSettings
- type QuotaUsage
- type RebaseView
- type RepoGrant
- type RepoRole
- type RepoSizer
- type RepoView
- type ReportInput
- type ReporterIdentity
- type ReporterKind
- type RequestCheckInput
- type Reservation
- type Review
- type ReviewDecision
- type ReviewEvent
- type ReviewKind
- type ReviewQuery
- type RevokeInput
- type Rules
- type RunnerView
- type SSOConfig
- type SSOConfigInput
- type SSOFlow
- type SSORequiredError
- type SSOResult
- type SSOStart
- type ScopeInput
- type ServerInfo
- type Service
- func (s *Service) Abandon(ctx context.Context, actor Actor, id uuid.UUID) (WorkspaceView, error)
- func (s *Service) AbortRebase(ctx context.Context, actor Actor, repoName, slug string) (RebaseView, error)
- func (s *Service) AcceptAgreement(ctx context.Context, actor Actor, org, version, sum string) (AgreementRecord, error)
- func (s *Service) AcceptedAgreementText(ctx context.Context, actor Actor, org, id string) (AgreementRecord, []byte, error)
- func (s *Service) AccessHelp(ctx context.Context, actor Actor) (AccessHelp, error)
- func (s *Service) AddPerson(ctx context.Context, by *store.Principal, n NewPerson) (store.Principal, string, bool, error)
- func (s *Service) AddTask(ctx context.Context, actor Actor, in AddTaskInput) (Task, error)
- func (s *Service) AgreementNotices(ctx context.Context, actor Actor) ([]AgreementNotice, error)
- func (s *Service) AgreementRequired() bool
- func (s *Service) AgreementText(ctx context.Context, actor Actor, org, version string) (AgreementVersion, error)
- func (s *Service) AllowSignup(ctx context.Context) error
- func (s *Service) AnswerNote(ctx context.Context, actor Actor, questionID string, body string) (Note, Note, error)
- func (s *Service) ApplyCI(ctx context.Context, ev CIEvent) error
- func (s *Service) ApplyGitHubOrgMembership(ctx context.Context, githubOrgID, githubUserID int64, role string) error
- func (s *Service) ApplyReview(ctx context.Context, ev ReviewEvent) error
- func (s *Service) ApproveCLILogin(ctx context.Context, actor Actor, userCode string, approve bool) error
- func (s *Service) ApproveReview(ctx context.Context, actor Actor, id string) (ReviewDecision, error)
- func (s *Service) Ask(ctx context.Context, actor Actor, in AskInput) (Note, error)
- func (s *Service) Authorize(ctx context.Context, actor Actor, repo string, need RepoRole) (store.Repo, RepoRole, error)
- func (s *Service) AuthorizeID(ctx context.Context, actor Actor, repoID uuid.UUID, need RepoRole) (RepoRole, error)
- func (s *Service) BackfillObjects(ctx context.Context, log *slog.Logger) ([]BackfillStats, error)
- func (s *Service) BackfillRepoObjects(ctx context.Context, repoID uuid.UUID, force bool, log *slog.Logger) (BackfillStats, error)
- func (s *Service) BlobReader(ctx context.Context, actor Actor, repoID uuid.UUID) (func(context.Context, hash.Hash) ([]byte, error), error)
- func (s *Service) Branch(ctx context.Context, actor Actor, repo store.Repo, name string) (store.Branch, error)
- func (s *Service) BranchMoved(ctx context.Context, repo store.Repo, branch, by string) []AutoRebase
- func (s *Service) CanSealSecrets() bool
- func (s *Service) CheckAgreements(ctx context.Context) error
- func (s *Service) CheckArtifact(ctx context.Context, actor Actor, id, name string) (store.CheckArtifact, []byte, error)
- func (s *Service) CheckAuditQuery(ctx context.Context, actor Actor, q AuditQuery) error
- func (s *Service) CheckCLIVersion(cliVersion, baseURL string) (status, message string)
- func (s *Service) CheckResults(ctx context.Context, actor Actor, repoName, effort, changeID string, ...) ([]store.CheckResult, error)
- func (s *Service) CheckRules(ctx context.Context, r Rules, base, tree hash.Hash) ([]engine.Warning, error)
- func (s *Service) CheckStatus(ctx context.Context, actor Actor, in CheckStatusInput) (CheckStatusView, error)
- func (s *Service) Clock() time.Time
- func (s *Service) CloseEffort(ctx context.Context, actor Actor, repoName, slug string, ...) (store.Effort, error)
- func (s *Service) CompleteGitHubSetup(ctx context.Context, actor Actor, code, state string) error
- func (s *Service) ConsoleOrgDeletionRecords(ctx context.Context, handle string) ([]OrgDeletion, error)
- func (s *Service) ConsoleOrgQuota(ctx context.Context, org string) (QuotaUsage, error)
- func (s *Service) ConsolePurgeOrg(ctx context.Context, handle string) (OrgDeletion, error)
- func (s *Service) ConsoleSetOrgQuota(ctx context.Context, org string, o store.OrgQuota) (QuotaUsage, error)
- func (s *Service) ConsoleSetSuperadmin(ctx context.Context, handle string, on bool) (p store.Principal, changed bool, err error)
- func (s *Service) ConsoleSuperadmins(ctx context.Context) ([]store.Principal, error)
- func (s *Service) Context(ctx context.Context, actor Actor, repo, effort string, targets []string) (NoteContext, error)
- func (s *Service) ContinueRebase(ctx context.Context, actor Actor, in ContinueInput) (RebaseView, error)
- func (s *Service) CreateAgent(ctx context.Context, actor Actor, name, displayName string) (store.Principal, string, error)
- func (s *Service) CreateCIToken(ctx context.Context, actor Actor, repo, name string, checks []string) (CITokenView, string, error)
- func (s *Service) CreateEffort(ctx context.Context, actor Actor, in CreateEffortInput) (store.Effort, error)
- func (s *Service) CreateLoginCode(ctx context.Context, actor Actor) (string, time.Time, error)
- func (s *Service) CreateOrg(ctx context.Context, actor Actor, handle, displayName string) (Org, error)
- func (s *Service) CreatePerson(ctx context.Context, actor Actor, handle, displayName, email string, ...) (store.Principal, string, error)
- func (s *Service) CreateRepo(ctx context.Context, actor Actor, in CreateRepoInput) (store.Repo, error)
- func (s *Service) CreateTeam(ctx context.Context, actor Actor, org, name string) (Team, error)
- func (s *Service) CreateToken(ctx context.Context, actor Actor, agent, name string) (store.Token, store.Principal, string, error)
- func (s *Service) DataDisk() (DiskSpace, bool)
- func (s *Service) DeleteOrg(ctx context.Context, actor Actor, handle, confirm string) (OrgDeletion, error)
- func (s *Service) DeleteTeam(ctx context.Context, actor Actor, org, name string) error
- func (s *Service) DeletedOrgs(ctx context.Context, actor Actor) ([]OrgDeletion, error)
- func (s *Service) DismissWelcome(ctx context.Context, actor Actor, dismissed bool) error
- func (s *Service) DropGitHubRoles(ctx context.Context, scope GitHubRoleScope) error
- func (s *Service) EffortOverlaps(ctx context.Context, actor Actor, repoName, slug string) ([]Overlap, error)
- func (s *Service) ExportAudit(ctx context.Context, actor Actor, q AuditQuery, emit func(AuditRow) error) error
- func (s *Service) ForYou(ctx context.Context, actor Actor) (ForYou, error)
- func (s *Service) ForecastOverlaps(ctx context.Context, repo store.Repo, effortID uuid.UUID) error
- func (s *Service) ForecastQueueDepth() int
- func (s *Service) GetAgent(ctx context.Context, actor Actor, agent string) (AgentView, error)
- func (s *Service) GetAgentRunner(ctx context.Context, actor Actor, agent string) (RunnerView, error)
- func (s *Service) GetChangeset(ctx context.Context, actor Actor, repoName, ref string) (store.Repo, LogEntry, error)
- func (s *Service) GetCheckJob(ctx context.Context, actor Actor, repo, id string) (CheckJobView, error)
- func (s *Service) GetCheckResult(ctx context.Context, actor Actor, id string) (CheckResult, error)
- func (s *Service) GetEffort(ctx context.Context, actor Actor, repoName, slug string) (EffortView, error)
- func (s *Service) GetInbox(ctx context.Context, actor Actor) (Inbox, error)
- func (s *Service) GetNote(ctx context.Context, actor Actor, id string) (Note, error)
- func (s *Service) GetObjects(ctx context.Context, actor Actor, repo string, hashes []hash.Hash, ...) ([]Object, error)
- func (s *Service) GetOrg(ctx context.Context, actor Actor, handle string) (OrgDetail, error)
- func (s *Service) GetOrgChecks(ctx context.Context, actor Actor, org string) (OrgChecks, error)
- func (s *Service) GetRebase(ctx context.Context, actor Actor, repoName, slug string) (RebaseView, bool, error)
- func (s *Service) GetRepo(ctx context.Context, actor Actor, name string) (RepoView, []store.Branch, error)
- func (s *Service) GetReview(ctx context.Context, actor Actor, id string) (Review, error)
- func (s *Service) GetRules(ctx context.Context, actor Actor, repoName, effort string) (Rules, error)
- func (s *Service) GetWorkspace(ctx context.Context, actor Actor, id uuid.UUID) (WorkspaceView, error)
- func (s *Service) GitHubApp(ctx context.Context) (GitHubAppInfo, error)
- func (s *Service) GitHubAppGaps(ctx context.Context, actor Actor) ([]GitHubAppGap, error)
- func (s *Service) GitHubAppInstallURL(ctx context.Context) (string, error)
- func (s *Service) GitHubAppManifest() ([]byte, error)
- func (s *Service) GitHubClient(ctx context.Context) (GitHubAPI, error)
- func (s *Service) GitHubLinkFinish(ctx context.Context, actor Actor, code, verifier string) (GitHubUser, error)
- func (s *Service) GitHubLinkOf(ctx context.Context, actor Actor) (store.GitHubLink, bool, error)
- func (s *Service) GitHubManifestFormURL(org, state string) string
- func (s *Service) GitHubRepoToken(ctx context.Context, repo store.Repo) (string, error)
- func (s *Service) GitHubRole(ctx context.Context, repo store.Repo, person store.Principal) (role RepoRole, ok bool, err error)
- func (s *Service) GitHubSettingsURL(r store.Repo) string
- func (s *Service) GitHubSetupManifest(ctx context.Context, actor Actor) (manifest []byte, state string, err error)
- func (s *Service) GitHubSignInAs(ctx context.Context, u GitHubUser) (p store.Principal, token string, isNew bool, err error)
- func (s *Service) GitHubSignInEnabled(ctx context.Context) bool
- func (s *Service) GitHubSignInFinish(ctx context.Context, code, verifier string) (p store.Principal, token string, isNew bool, err error)
- func (s *Service) GitHubSignInStart(ctx context.Context, next string) (authorizeURL, state, verifier string, err error)
- func (s *Service) GitHubSignInUser(ctx context.Context, code, verifier string) (GitHubUser, error)
- func (s *Service) GitHubSignupNeedsConfirm(ctx context.Context, u GitHubUser) (bool, error)
- func (s *Service) GitHubWebURL() string
- func (s *Service) GrantRepo(ctx context.Context, actor Actor, repo, subject string, role RepoRole) (RepoGrant, error)
- func (s *Service) GrantSupport(ctx context.Context, actor Actor, in SupportInput) (SupportGrant, error)
- func (s *Service) HandleGitHubWebhook(ctx context.Context, event, deliveryID, signature string, body []byte) error
- func (s *Service) HandleHostWebhook(ctx context.Context, kind store.Provider, d HostDelivery) error
- func (s *Service) HostRepoToken(ctx context.Context, repo store.Repo) (string, error)
- func (s *Service) HumanChecksFor(ctx context.Context, actor Actor) ([]HumanCheck, error)
- func (s *Service) HumanJobs(ctx context.Context, actor Actor) ([]CheckJobView, error)
- func (s *Service) Info(ctx context.Context) ServerInfo
- func (s *Service) InstallCommand(baseURL string) string
- func (s *Service) InviteGitHubLogin(ctx context.Context, by *store.Principal, login, note string, siteAdmin bool) (store.SignupInvite, error)
- func (s *Service) InviteGitHubUser(ctx context.Context, actor Actor, login, note string) error
- func (s *Service) IsSiteAdmin(ctx context.Context, actor Actor) booldeprecated
- func (s *Service) IsSuperadmin(ctx context.Context, actor Actor) bool
- func (s *Service) Land(ctx context.Context, actor Actor, in LandInput) (res LandResult, err error)
- func (s *Service) ListAgents(ctx context.Context, actor Actor) ([]AgentSummary, error)
- func (s *Service) ListCITokens(ctx context.Context, actor Actor, repo string, withRevoked bool) ([]CITokenView, error)
- func (s *Service) ListCheckJobs(ctx context.Context, actor Actor, in ListJobsInput) ([]CheckJobView, error)
- func (s *Service) ListClaims(ctx context.Context, actor Actor, repo, effort string, targets []string) ([]Claim, error)
- func (s *Service) ListEfforts(ctx context.Context, actor Actor, repoName string, state store.EffortState) (store.Repo, []store.Effort, error)
- func (s *Service) ListGitHubInvites(ctx context.Context, actor Actor, all bool) ([]store.SignupInvite, error)
- func (s *Service) ListNotes(ctx context.Context, actor Actor, in ListNotesInput) ([]Note, error)
- func (s *Service) ListOrgs(ctx context.Context, actor Actor, all bool) ([]Org, []OrgRole, error)
- func (s *Service) ListOverlaps(ctx context.Context, actor Actor, repoName, effort string) ([]Overlap, error)
- func (s *Service) ListPeople(ctx context.Context, actor Actor) ([]store.Principal, error)
- func (s *Service) ListRepos(ctx context.Context, actor Actor) ([]RepoView, error)
- func (s *Service) ListReservations(ctx context.Context, actor Actor, repoName, rule string) ([]Reservation, error)
- func (s *Service) ListReviews(ctx context.Context, actor Actor, q ReviewQuery) ([]Review, error)
- func (s *Service) ListShipments(ctx context.Context, actor Actor, repoName, slug string) ([]store.Shipment, error)
- func (s *Service) ListSupport(ctx context.Context, actor Actor, repo string) ([]SupportGrant, error)
- func (s *Service) ListTasks(ctx context.Context, actor Actor, in ListTasksInput) ([]Task, error)
- func (s *Service) ListTokens(ctx context.Context, actor Actor, agent string) (store.Principal, []store.Token, error)
- func (s *Service) LoadGitHubApp(ctx context.Context) error
- func (s *Service) Log(ctx context.Context, actor Actor, repoName, slug string, limit int, ...) ([]LogEntry, error)
- func (s *Service) LogUpgradeNotices(ctx context.Context, logger *slog.Logger) error
- func (s *Service) MakeClaim(ctx context.Context, actor Actor, in ClaimInput) (Claim, []Claim, error)
- func (s *Service) MarkNotesRead(ctx context.Context, actor Actor, ids []uuid.UUID) error
- func (s *Service) MergePeople(ctx context.Context, actor Actor, keepRef, mergedRef string) (MergeResult, error)
- func (s *Service) MissingObjects(ctx context.Context, actor Actor, repo string, hashes []hash.Hash) ([]hash.Hash, error)
- func (s *Service) MyGitHubInstallations(ctx context.Context, actor Actor) ([]GitHubInstallation, error)
- func (s *Service) NextCheckJob(ctx context.Context, actor Actor, in NextJobInput) (*CheckJobView, error)
- func (s *Service) NotifyPush(ctx context.Context) (int, error)
- func (s *Service) ObjectSizesPending(ctx context.Context) (int64, error)
- func (s *Service) OpenShipment(ctx context.Context, actor Actor, in ShipInput) (ShipResult, error)
- func (s *Service) OpenWorkspace(ctx context.Context, actor Actor, repoName, slug, intent string) (WorkspaceView, error)
- func (s *Service) OrgAgreement(ctx context.Context, actor Actor, org string) (AgreementView, error)
- func (s *Service) OrgCheckHistory(ctx context.Context, actor Actor, org string) ([]OrgChecks, error)
- func (s *Service) OrgDeletionRecord(ctx context.Context, actor Actor, handle string) (OrgDeletion, error)
- func (s *Service) OrgQuota(ctx context.Context, actor Actor, org string) (QuotaUsage, error)
- func (s *Service) OrgSSO(ctx context.Context, actor Actor, org string) (SSOConfig, bool, error)
- func (s *Service) OverlapCounts(ctx context.Context, actor Actor, repoName string) (map[uuid.UUID][2]int, error)
- func (s *Service) PeekLoginCode(ctx context.Context, code string) (store.Principal, error)
- func (s *Service) PendingCLILogin(ctx context.Context, actor Actor, userCode string) (clientName string, expires time.Time, err error)
- func (s *Service) PersonIdentities(ctx context.Context, actor Actor) ([]store.Identity, error)
- func (s *Service) PipelineStatus(ctx context.Context, actor Actor, in CheckStatusInput) (PipelineView, error)
- func (s *Service) PlanShipment(ctx context.Context, actor Actor, repoName, slug, target string) (ShipPlan, error)
- func (s *Service) PlanSplit(ctx context.Context, actor Actor, in SplitInput) (ShipPlan, error)
- func (s *Service) PollCLILogin(ctx context.Context, deviceCode string) (status, token string, p store.Principal, err error)
- func (s *Service) PostNote(ctx context.Context, actor Actor, in PostNoteInput) (Note, error)
- func (s *Service) PruneAudit(ctx context.Context) (int64, error)
- func (s *Service) PruneAuditLoop(ctx context.Context, log *slog.Logger)
- func (s *Service) PurgeDueOrgs(ctx context.Context, log *slog.Logger) ([]OrgDeletion, error)
- func (s *Service) PushAvailable() bool
- func (s *Service) PushPublicKey(ctx context.Context) (string, error)
- func (s *Service) PushSubscriptions(ctx context.Context, actor Actor) ([]store.PushSubscription, error)
- func (s *Service) PutObjects(ctx context.Context, actor Actor, repo string, objs []Object) ([]hash.Hash, error)
- func (s *Service) ReadBlob(ctx context.Context, actor Actor, repoID uuid.UUID, h hash.Hash) ([]byte, error)
- func (s *Service) ReadableRepoIDs(ctx context.Context, actor Actor) (ids []uuid.UUID, all bool, err error)
- func (s *Service) ReadableRepos(ctx context.Context, actor Actor, org *uuid.UUID) ([]store.Repo, []RepoRole, error)
- func (s *Service) RebaseEffort(ctx context.Context, actor Actor, repoName, slug, onto string) (RebaseView, error)
- func (s *Service) RedeemLoginCode(ctx context.Context, code string) (store.Principal, string, error)
- func (s *Service) RejectReview(ctx context.Context, actor Actor, id, reason string) (ReviewDecision, error)
- func (s *Service) ReleaseCheckJob(ctx context.Context, actor Actor, repo, id, reason string) (CheckJobView, error)
- func (s *Service) ReleaseClaims(ctx context.Context, actor Actor, id, workspaceID string) ([]Claim, error)
- func (s *Service) RemoveMember(ctx context.Context, actor Actor, org, person string) error
- func (s *Service) RemoveOrgSSO(ctx context.Context, actor Actor, org string) error
- func (s *Service) RemoveTeamMember(ctx context.Context, actor Actor, org, team, person string) (Team, error)
- func (s *Service) RenewCheckJob(ctx context.Context, actor Actor, repo, id string, d time.Duration) (CheckJobView, error)
- func (s *Service) RepoAccess(ctx context.Context, actor Actor, repo string) ([]RepoGrant, []AccessEntry, error)
- func (s *Service) RepoOrgChecks(ctx context.Context, actor Actor, repoName string) (OrgChecks, error)
- func (s *Service) RepoRoleOf(ctx context.Context, actor Actor, r store.Repo) RepoRole
- func (s *Service) ReportChanges(ctx context.Context, actor Actor, workspaceID uuid.UUID, paths []string) error
- func (s *Service) ReportCheck(ctx context.Context, actor Actor, in ReportInput) (CheckResult, error)
- func (s *Service) ReporterCounts(ctx context.Context, actor Actor, rule string, allowSamePerson bool, ...) (bool, string, error)
- func (s *Service) RequestCheck(ctx context.Context, actor Actor, in RequestCheckInput) (CheckJobView, error)
- func (s *Service) Reserve(ctx context.Context, actor Actor, repoName, effort, rule string) (value, example string, err error)
- func (s *Service) ResolveActor(ctx context.Context, p store.Principal) (Actor, error)
- func (s *Service) ResolveSuperadminReview(ctx context.Context, actor Actor) error
- func (s *Service) RestoreOrg(ctx context.Context, actor Actor, handle string) (Org, error)
- func (s *Service) RevokeCIToken(ctx context.Context, actor Actor, repo, name string) (CITokenView, error)
- func (s *Service) RevokeRepo(ctx context.Context, actor Actor, repo, subject string) error
- func (s *Service) RevokeSupport(ctx context.Context, actor Actor, repo, person string) error
- func (s *Service) RevokeToken(ctx context.Context, actor Actor, in RevokeInput) (store.Token, store.Principal, bool, error)
- func (s *Service) RulesAt(ctx context.Context, tree hash.Hash) (Rules, error)
- func (s *Service) RunObjectSizer(ctx context.Context, log *slog.Logger)
- func (s *Service) RunOrgPurger(ctx context.Context, log *slog.Logger)
- func (s *Service) RunPushNotifier(ctx context.Context, log *slog.Logger)
- func (s *Service) SSOAvailable(ctx context.Context) bool
- func (s *Service) SSOCallbackURL() (string, error)
- func (s *Service) SSOOrgFor(ctx context.Context, who string) (string, error)
- func (s *Service) SSOSignInFinish(ctx context.Context, f SSOFlow, code string) (SSOResult, error)
- func (s *Service) SSOSignInStart(ctx context.Context, org string) (SSOStart, error)
- func (s *Service) SaveGitHubApp(ctx context.Context, creds GitHubAppCredentials, createdBy *uuid.UUID) error
- func (s *Service) SetAgentRunner(ctx context.Context, actor Actor, agent string, kinds []string) (RunnerView, error)
- func (s *Service) SetAgentScope(ctx context.Context, actor Actor, agent string, in ScopeInput) (AgentView, error)
- func (s *Service) SetBase(ctx context.Context, actor Actor, id uuid.UUID, base hash.Hash) (WorkspaceView, error)
- func (s *Service) SetMember(ctx context.Context, actor Actor, org, person string, role OrgRole) (Membership, error)
- func (s *Service) SetOrgChecks(ctx context.Context, actor Actor, org, source string) (out OrgChecks, changed bool, err error)
- func (s *Service) SetOrgQuota(ctx context.Context, actor Actor, org string, o store.OrgQuota) (QuotaUsage, error)
- func (s *Service) SetOrgSSO(ctx context.Context, actor Actor, org string, in SSOConfigInput) (SSOConfig, error)
- func (s *Service) SetRepoHost(ctx context.Context, actor Actor, in SetRepoHostInput) (HostHook, error)
- func (s *Service) SetTeamMember(ctx context.Context, actor Actor, org, team, person string) (Team, error)
- func (s *Service) ShipmentsCI(ctx context.Context, actor Actor, repoName, slug string) (map[uuid.UUID]ShipmentCIView, error)
- func (s *Service) ShowWelcome(ctx context.Context, actor Actor) bool
- func (s *Service) SignupModeOrDefault() SignupMode
- func (s *Service) SizeAllObjects(ctx context.Context) (int, error)
- func (s *Service) StartCLILogin(ctx context.Context, clientName string) (CLILogin, error)
- func (s *Service) SubscribePush(ctx context.Context, actor Actor, in PushSubscribeInput) (store.PushSubscription, error)
- func (s *Service) SuperadminReviewPending(ctx context.Context, actor Actor) bool
- func (s *Service) SweepMirrors(ctx context.Context) (int, error)
- func (s *Service) SyncBranch(ctx context.Context, actor Actor, repoName, branch string) (store.Branch, int, error)
- func (s *Service) SyncGitHubAccount(ctx context.Context, githubAccountID int64) error
- func (s *Service) SyncGitHubOrgs(ctx context.Context, person store.Principal) error
- func (s *Service) SyncInstallation(ctx context.Context, installationID int64) error
- func (s *Service) TestPush(ctx context.Context, actor Actor, endpoint string) error
- func (s *Service) Token(ctx context.Context, actor Actor, id string) (store.Token, store.Principal, error)
- func (s *Service) TokenCreateTarget(ctx context.Context, actor Actor, agent string) (store.Principal, error)
- func (s *Service) UnsubscribePush(ctx context.Context, actor Actor, endpoint string) error
- func (s *Service) UpdateOrg(ctx context.Context, actor Actor, handle, displayName string, ...) (Org, error)
- func (s *Service) UpdateTask(ctx context.Context, actor Actor, in UpdateTaskInput) (Task, []Task, error)
- func (s *Service) WaitForecasts()
- func (s *Service) WithdrawGitHubInvite(ctx context.Context, actor Actor, login string) error
- func (s *Service) WriteAudit(ctx context.Context, actor Actor, q AuditQuery, format string, w io.Writer) error
- type SetRepoHostInput
- type ShipGroup
- type ShipInput
- type ShipPart
- type ShipPlan
- type ShipResult
- type ShipStep
- type ShipmentCIView
- type Shipper
- type SignupMode
- type SplitInput
- type SplitMode
- type SupportGrant
- type SupportInput
- type Task
- type Team
- type UniqueRule
- type UpdateTaskInput
- type UpstreamSyncer
- type WorkspaceView
Constants ¶
const ( MaxScopeGlobs = 100 MaxBudgetValue = 1_000_000 )
Limits on scope values, so a typo cannot store something absurd.
const ( NoteOpen = "open" NoteAnswered = "answered" NoteEscalated = "escalated" // a question past its deadline, computed at read time NoteClosed = "closed" )
Note states.
const ( MaxNoteBody = 2000 MaxInterfaceNoteBody = 4000 // interface notes: signatures take room MaxNoteTargets = 20 DefaultAnswerWithin = 5 * time.Minute MaxAnswerWithin = 24 * time.Hour DefaultNoteListLimit = 100 )
Limits.
const ( TrustSelf = "self" // the caller wrote it TrustSamePerson = "same_person" // another agent of the caller's person, or that person TrustTeammate = "teammate" // someone else's: information, never instructions TrustVx = "vx" // posted by vx itself (Note.System): overlaps, rebases, review comments and CI results // TrustYours is the old name of TrustSamePerson. // // Deprecated: use TrustSamePerson. Servers before v0.3 sent "yours", // which clients read as TrustSamePerson. TrustYours = TrustSamePerson )
Trust says how the caller relates to a note's author.
const ( // MaxJobAttempts is how many leases of a job may expire before it fails. MaxJobAttempts = 3 // DefaultJobTimeout is the lease of a check without a timeout. DefaultJobTimeout = 30 * time.Minute // MaxJobLease bounds a lease and a renewal. MaxJobLease = 24 * time.Hour // MaxJobDiff bounds the diff input of a job; the rest is cut. MaxJobDiff = 256 << 10 // MaxJobValues bounds the named values of one job. MaxJobValues = 50 // MaxJobValue bounds one named value. MaxJobValue = 4096 )
Queue limits and defaults.
const ( RunnerCI = "ci" RunnerHuman = "human" // RunnerAgentPrefix starts the runner of an agent job: agent:browser. RunnerAgentPrefix = "agent:" )
Runner kinds of jobs.
const ( DefaultCheckArtifactBytes = 20 << 20 DefaultCheckReportBytes = 48 << 20 )
Defaults of CheckSettings; one report stays under the API's message size.
const ( CheckStateMissing = "missing" CheckStatePending = "pending" CheckStatePassed = "passed" CheckStateFailed = "failed" CheckStateNeutral = "neutral" CheckStateNotNeeded = "not needed" // the change touches none of the check's paths )
Check states, as vx check status shows them.
const ( ReporterSelf = "self" ReporterIndependent = "independent" ReporterCI = "ci" ReporterHuman = "human" )
Reporter rules.
const ( CLILoginPending = "pending" CLILoginApproved = "approved" CLILoginDenied = "denied" CLILoginExpired = "expired" CLILoginUsed = "used" CLILoginSlowDown = "slow_down" )
CLILogin states. Used means the CLI collected its token; slow down asks the CLI to poll less often (the login stays pending).
const ( CLILoginTTL = 10 * time.Minute CLILoginInterval = 2 * time.Second // CLILoginStartsPerIP logins may be started from one address per // CLILoginRateWindow. CLILoginStartsPerIP = 10 CLILoginRateWindow = 10 * time.Minute // MaxPendingCLILogins bounds undecided logins server-wide, so nobody // fills the table from many addresses. MaxPendingCLILogins = 2000 // MaxCLIClientName is the longest client name kept. MaxCLIClientName = 60 )
Limits of browser logins.
const ( CLIOK = "ok" CLIUpdateRecommended = "update_recommended" CLIUpdateRequired = "update_required" )
CLI version states in ServerInfo answers.
const ( DefaultClaimTTL = 30 * time.Minute MaxClaimTTL = 4 * time.Hour MaxClaimReason = 300 // MovedClaimTTL is how long a moving claim (vx claim --moving) stays // active after the workspace that made the move lands, so changes // still made at the old location are warned about. MovedClaimTTL = 2 * time.Hour )
Claim limits.
const ( TaskOpen = "open" TaskTaken = "taken" TaskDone = "done" )
Task states.
const ( MaxTaskTitle = 200 MaxTaskBody = 4000 )
Task limits.
const ( ReviewApproved = "approved" ReviewChangesRequested = "changes_requested" ReviewCommented = "commented" )
Review states of a ReviewSummary.
const ( CIPending = "pending" CIPassed = "passed" CIFailed = "failed" )
CI results of a shipment.
const ( ForYouQuestion = "question" // an escalated question, or one asked of the person ForYouReview = "review" // a change waiting for the person's approval ForYouCI = "ci" // CI failed on a shipment of the person's (or their agents') changes ForYouComment = "comment" // a review comment on a pull request from the git host ForYouOverlap = "overlap" // the person's effort collides with another ForYouRebase = "rebase" // the person's effort needs a rebase // ForYouAgreement: an organization the person owns needs the data // processing agreement accepted (dpa.go). ForYouAgreement = "agreement" )
ForYou item kinds.
const ( GitHubCallbackPath = "/auth/github/callback" // OAuth sign-in (vx-signin) GitHubSetupURLPath = "/ui/github/installed" // after an installation GitHubWebhookPath = "/hooks/github" // webhook deliveries GitHubManifestReturnURL = "/ui/admin/github/created" // the manifest flow returns here )
Paths on this server the App's manifest points GitHub at.
const ( GitLabWebhookPath = "/hooks/gitlab" GiteaWebhookPath = "/hooks/gitea" // Gitea and Forgejo ForgejoWebhookPath = "/hooks/forgejo" BitbucketWebhookPath = "/hooks/bitbucket" )
Webhook paths of the hosts.
const ( MaxNoteTarget = 300 // characters in one target MinNoteIDPrefix = 8 // shortest note id prefix AnswerNote and GetNote accept )
const ( // AgentActiveWindow: an agent that used its token this recently is // working. AgentActiveWindow = 15 * time.Minute // WorkspaceIdleAfter: a workspace that did nothing (sync, land, status, // a token use by its owner) for this long no longer counts as someone // working, and its claims lapse. WorkspaceIdleAfter = 2 * time.Hour )
const ( // SupportDefaultDuration is how long support access lasts when the // grant names no duration. SupportDefaultDuration = 24 * time.Hour // SupportMaxDuration is the longest support access one grant gives. SupportMaxDuration = 30 * 24 * time.Hour )
const ( OverlapClean = "clean" // no files changed by both OverlapConflict = "conflict" // shipping both would conflict )
Overlap statuses.
const AgreementManifest = "manifest.json"
AgreementManifest is the name of the manifest in VX_DPA_DIR.
const CLIApprovePath = "/ui/cli/approve"
CLIApprovePath is the approval page; the user code goes in ?code=.
const CheckRunPrefix = "vx: "
CheckRunPrefix starts the name of every check run vx publishes for a check; CI feedback ignores them, like the vx evidence run.
const ( // DefaultForecastTimeout bounds one background forecast run (all pairs // of one effort, or of a repository after its branch moved). DefaultForecastTimeout = 2 * time.Minute )
const DefaultOrgDeleteGrace = 30 * 24 * time.Hour
DefaultOrgDeleteGrace is how long a deleted organization can be restored before it is purged.
const DefaultPurgeInterval = 10 * time.Minute
DefaultPurgeInterval is how often servers look for organizations to purge.
const ( // DefaultPushEvery is how often the notifier runs. DefaultPushEvery = 30 * time.Second )
const EvidenceCheckName = "vx evidence"
EvidenceCheckName is the check run vx posts on its pull requests; CI results ignore it.
const GitHubChecksOffNotice = "GitHub checks are off: the vx GitHub App needs the Checks permission"
GitHubChecksOffNotice is what Admin > GitHub says while the App cannot post check runs.
const GitHubRoleTTL = 5 * time.Minute
GitHubRoleTTL is how long a role read from GitHub is trusted without asking again; webhooks drop cached roles sooner when access changes.
const LoginCodeTTL = 2 * time.Minute
LoginCodeTTL is how long a one-time web sign-in code stays valid.
const MaxCITokenChecks = 50
MaxCITokenChecks bounds the checks one CI token may name.
const MaxMarkRead = 1000
MaxMarkRead is the most notes one MarkNotesRead call takes.
const MaxOrgChecksSize = 64 << 10
MaxOrgChecksSize limits the [[check]] tables of one organization.
const MaxReportedPaths = 2000
MaxReportedPaths is the most changed files a workspace reports; more are cut (sorted, the first ones kept).
const MaxReviewReason = 1000
MaxReviewReason is the longest rejection reason.
const MaxRunnerKinds = 20
MaxRunnerKinds bounds the kinds one agent may serve.
const MaxTokenName = 100
MaxTokenName is the longest token label CreateToken accepts.
const MinAgreementNotice = 30 * 24 * time.Hour
MinAgreementNotice is how long before it takes effect a new version must be published.
const MinAuditRetention = 7 * 24 * time.Hour
MinAuditRetention is the shortest retention: the log also answers "who did this" for recent work.
const MinTokenPrefix = 8
MinTokenPrefix is the shortest token id prefix RevokeToken accepts.
const MsgClientTooOld = "this vx is too old for the server: update vx (object requests must name a repository)"
MsgClientTooOld is the error for object requests that do not name a repository, which only clients from before v0.2 send.
const NewAccountWindow = time.Hour
NewAccountWindow is how recently an account must have been created for the empty pages to say "created minutes ago": a sign-in with another GitHub account than usual creates one.
const NoticeSuperadminReview = "superadmin-review"
NoticeSuperadminReview is the upgrade notice of #33.
const OIDCCallbackPath = "/auth/oidc/callback"
OIDCCallbackPath is where identity providers send the browser back; it is the redirect URI to register with the provider.
const (
OtherEffortNotes = 10
)
Limits on the work Context does for other efforts, so a repository with many efforts or large ones stays cheap:
- at most otherEffortsScan other open efforts are looked at, the most recently created first;
- an effort's changed files are the diff of its base tree to its head tree (cost proportional to the change, cached by tree pair, see effortChanges); at most otherChangedMax of them are matched;
- the newest otherNotesScan interface and decision notes of an effort are read, and at most OtherEffortNotes of them returned;
- at most otherPathsShown changed paths are returned per effort.
const PermissionDenied = "permission denied: "
PermissionDenied starts the message of every permission error, so people, agents and scripts can recognise one whatever it goes on to say.
const RulesFile = rules.File
RulesFile is where a repository keeps its rules.
const SizeScanInterval = 10 * time.Minute
SizeScanInterval is how often the server looks for objects of any repository that have no recorded size.
const SuperadminReviewText = "Site admins are now superadmins: they run the server (people, invites, sign-up, the GitHub App, server settings, the operation log) " +
"and no longer have access to repositories. Grant support access per repository if needed: vx repo support REPO PERSON --role read --for 24h, " +
"or on the repository's access page. Organization owners and admins keep their access."
SuperadminReviewText is what the server logs and the admin panel shows after the upgrade.
const SystemPrincipalHandle = "vx"
SystemPrincipalHandle is the service principal that posts system notes.
const WarningRule = rules.WarningRule
WarningRule marks a warning about a vx.toml rule.
Variables ¶
var ( GitHubAppPermissions = map[string]string{ "metadata": "read", "contents": "write", "pull_requests": "write", "checks": "write", "statuses": "read", "members": "read", } GitHubAppEvents = []string{ "repository", "member", "membership", "organization", "team", "team_add", "push", "pull_request", "pull_request_review", "pull_request_review_comment", "issue_comment", "check_run", "check_suite", "status", } )
GitHubAppPermissions and GitHubAppEvents are what the App asks for. installation and installation_repositories are always delivered to an App, so they are not listed (GitHub refuses them in a manifest).
var AuditColumns = []string{"id", "at", "op", "org", "repo", "actor", "target", "before", "after"}
AuditColumns are the CSV columns.
var ErrAgreementRequired = errors.New("data processing agreement not accepted")
ErrAgreementRequired is wrapped by the error of an operation refused because the organization has not accepted the agreement in effect.
var ErrGitHubDeliveryApplied = &Error{Code: CodeExists, Msg: "this delivery was applied already"}
ErrGitHubDeliveryApplied is returned for a delivery applied before.
var ErrGitHubForbidden = errors.New("GitHub refused the call: the App lacks a permission")
ErrGitHubForbidden matches (errors.Is) a call GitHub refused because the App lacks a permission (403, not a rate limit).
var ErrGitHubNotConfigured = errors.New("GitHub is not configured on this server: a superadmin sets it up on the Admin page")
ErrGitHubNotConfigured is returned when the server has no GitHub App yet.
var ErrNothingToLand = errors.New("nothing to land")
ErrNothingToLand is returned when a snapshot has no changes.
var ErrPurgeBusy = errors.New("another server is purging organizations right now")
ErrPurgeBusy means another server holds the purge lock.
var Features = []string{
"board", "claims", "tasks", "rebase", "orgs", "github", "cli-login", "install-script",
"overlaps", "rules", "reserve", "close", "agent-scopes", "policies", "merge-by-declaration",
"reviews", "ci", "auto-rebase", "evidence-check",
}
Features this server has, for CLIs that need to tell "your server is too old" apart from other errors.
var QuotaNames = []string{"repos", "stored", "import", "push", "open_efforts"}
QuotaNames are the quotas in the order pages and the CLI show them.
var ReporterRules = []string{ReporterSelf, ReporterIndependent, ReporterCI, ReporterHuman}
ReporterRules lists the reporter rules a check may name.
Functions ¶
func Ago ¶ added in v0.5.0
Ago says how long before now t was: "just now", "40 min ago", "3h ago", "2 days ago".
func AgreementDay ¶ added in v0.6.0
AgreementDay formats an agreement date for pages and the CLI.
func AwayNotice ¶ added in v0.5.0
AwayNotice is what the asker of q is told when the agent asked was not working: "agent:alice/backend is not working right now (last seen 40 min ago); the question also goes to user:alice." Empty otherwise.
func CIFailedNote ¶ added in v0.5.0
CIFailedNote reports whether a CI note says the checks failed (see ApplyCI for the text).
func CheckOrigin ¶ added in v0.7.0
CheckOrigin says where a check comes from, for vx rules, vx check status and the web: "organization acme (version 3)", "vx.toml line 12", "vx.toml [checks] required" or "vx.toml [[policy]]".
func CheckRunName ¶ added in v0.7.0
CheckRunName is the GitHub check run name of a check.
func CheckStatusNotes ¶ added in v0.7.0
CheckStatusNotes are what vx check status says about a status view besides the checks: that the change edits vx.toml (the checks of the effort's base apply until it lands), and warnings about vx.toml checks left out because an organization check has their name.
func ClaimTrust ¶ added in v0.2.0
ClaimTrust says how actor relates to a claim's owner, like TrustOf.
func Classify ¶
Classify turns store and blob errors into service errors and passes others on unchanged.
func ClientIPFrom ¶ added in v0.6.0
ClientIPFrom is the caller's address recorded with WithClientIP, or "".
func FormatBytes ¶ added in v0.5.0
FormatBytes shows a size with one unit, like 1.5 GB.
func GitHubChecksOff ¶ added in v0.7.0
func GitHubChecksOff(gaps []GitHubAppGap) bool
GitHubChecksOff reports whether gaps include the Checks permission.
func GitHubHandle ¶ added in v0.2.0
GitHubHandle turns a GitHub login into a vx handle: lowercased, characters handles do not allow become "-", then leading and trailing separators are trimmed. A login with nothing left becomes github-<id>.
func HostWebhookPath ¶ added in v0.4.0
HostWebhookPath is the path a provider's webhooks go to, or "".
func InScope ¶ added in v0.4.0
func InScope(sc store.AgentScope, path string) bool
InScope reports whether an agent's scope lets it change path.
func MaxNoteBodyOf ¶ added in v0.3.0
MaxNoteBodyOf is the longest body a note of kind may have: interface notes carry signatures and get MaxInterfaceNoteBody, others MaxNoteBody.
func MergeOrgChecks ¶ added in v0.7.0
MergeOrgChecks puts a repository's checks together: the organization's first, then those of vx.toml. A vx.toml check with the name of an organization check is left out, with a warning: a repository cannot remove or weaken an organization check, only add its own. A vx.toml check that runs after a name that is neither is reported too.
func NormalizeGitHubLogin ¶ added in v0.2.0
NormalizeGitHubLogin returns the lowercased login, or an error saying what a login looks like.
func NormalizeUserCode ¶ added in v0.2.0
NormalizeUserCode upper-cases a user code and puts the dash back, so "wdjb mjht" and "WDJBMJHT" find WDJB-MJHT. It returns "" for anything that cannot be a user code.
func OverlapResolvedNote ¶ added in v0.5.0
OverlapResolvedNote reports whether an overlap note says the collision is gone (see overlapNoteText).
func PKCEChallenge ¶ added in v0.2.0
PKCEChallenge is the S256 code challenge for a verifier.
func ParseBytes ¶ added in v0.5.0
ParseBytes reads a size like 500MB, 10GB, 2GiB or 1048576; "0", "none" and "unlimited" are 0 (no limit). Units are powers of 1024 either way: what disks and git hosts show.
func ParseOrgChecks ¶ added in v0.7.0
ParseOrgChecks reads an organization's [[check]] tables: the same fields and validation as in vx.toml, and after may only name checks of the organization (a repository's checks are not known to it).
func ParseRetention ¶ added in v0.5.0
ParseRetention reads a retention like 90d, 2160h or 1y; "" and "0" keep the log forever.
func RebaseNeededNote ¶ added in v0.5.0
RebaseNeededNote reports whether a rebase note asks for a rebase: a conflict, or the base moved under a notify-only policy (see autoRebaseEffort for the texts). "Rebased automatically" needs nothing.
func ReporterAllowed ¶ added in v0.7.0
func ReporterAllowed(rule string, allowSamePerson bool, author ChangeAuthor, by ReporterIdentity) (bool, string)
ReporterAllowed reports whether by may report a result of a check with reporter rule rule on a change made by author, and when not, why, in a sentence that says who may. An empty rule is "self".
func SimilarNotice ¶ added in v0.7.0
SimilarNotice is what Ask tells the asker when a similar question was already open: "a similar open question exists: 1a2b3c4d by agent:alice/backend (vx board 1a2b3c4d)."
func TargetsMatch ¶ added in v0.2.0
TargetsMatch reports whether a note target matches a requested path or symbol: equal, or one is a directory prefix ("internal/http/" and "internal/http/limit.go") or symbol prefix ("auth" and "auth.Login") of the other.
func TaskTrust ¶ added in v0.2.0
TaskTrust says how actor relates to a task's creator, like TrustOf.
func TrustLabel ¶ added in v0.7.0
func TrustLabel(r *CheckResult) string
TrustLabel names who reported a result, for people: "CI", "person", "agent, accepted" or "agent, not accepted" (by the check's reporter rule).
func TrustOf ¶ added in v0.2.0
TrustOf says how actor relates to the author of n: TrustSelf, TrustSamePerson or TrustTeammate, or TrustVx for a note vx itself posted. Servers before v0.5 sent TrustTeammate for those, with system set; clients read both as vx.
func WithClientIP ¶ added in v0.2.0
WithClientIP records the caller's network address for rate limits.
func WithPermissionDenied ¶ added in v0.3.0
WithPermissionDenied puts PermissionDenied in front of msg unless it is already there.
Types ¶
type AccessEntry ¶ added in v0.2.0
AccessEntry is one person's effective role on a repository and why.
type AccessHelp ¶ added in v0.7.0
type AccessHelp struct {
// Person is the signed-in person (an agent's person for agents).
Person store.Principal
Agent bool // the caller is an agent of Person
// GitHubLogin is the linked GitHub login; "" when not connected.
GitHubLogin string
// GitHubSignIn says the server signs people in with GitHub (it has an
// App); InstallURL is where the App is installed, "" without one.
GitHubSignIn bool
InstallURL string
GitHubURL string // github.com or the GitHub Enterprise address
// Orgs are the vx organizations the person belongs to other than
// their personal one.
Orgs []string
// Installations counts the App's installations on the person's GitHub
// account and on GitHub organizations GitHub says they belong to;
// meaningful only with a GitHubLogin.
Installations int
// NewAccount is true when the person was created within
// NewAccountWindow; Created is when.
NewAccount bool
Created time.Time
}
AccessHelp is what vx knows about an account that can read no repositories.
type AccountExistsError ¶ added in v0.5.0
type AccountExistsError struct {
Email string
Handle string // the existing person
Via string // "GitHub" or "ORG single sign-on"
Org string // the organization, for single sign-on
// GitHubLogin is the GitHub account the existing person signs in
// with, when they have one.
GitHubLogin string
}
AccountExistsError is returned when a first sign-in (with GitHub or an organization's single sign-on) is for an email that already belongs to a person: they sign in to that account and connect instead of getting a second one.
func (*AccountExistsError) Error ¶ added in v0.5.0
func (e *AccountExistsError) Error() string
type Actor ¶
type Actor struct {
store.Principal
Parent *store.Principal // set for agents
// TokenID is the token the request was made with; uuid.Nil when the
// caller did not authenticate with a token (tests, internal calls).
TokenID uuid.UUID
}
Actor is the authenticated caller, with the human it acts for.
func (Actor) OnBehalfOf ¶
OnBehalfOf is the parent's ref for agents, empty otherwise.
type AddTaskInput ¶ added in v0.2.0
type AddTaskInput struct {
Repo, Effort string
Title, Body string
DependsOn []string // ids or 8+ character prefixes
Owner string // optional: agent name, handle or ref
}
AddTaskInput is a new task.
type AgentSummary ¶ added in v0.2.0
type AgentSummary struct {
Agent store.Principal
ActiveTokens int
RevokedTokens int
LastUsedAt *time.Time // latest use of any of its tokens
}
AgentSummary is one of a person's agents with a summary of its tokens.
type AgentView ¶ added in v0.4.0
type AgentView struct {
Agent store.Principal
Owner store.Principal
Scope store.AgentScope
// UpdatedBy is the ref of whoever last set the scope; empty: never set.
UpdatedBy string
// LandsToday counts the agent's lands since the start of the UTC day.
LandsToday int
// OpenWorkspaces counts its open workspaces in open efforts.
OpenWorkspaces int
// DayStart and ResetsAt bound the current UTC day the lands budget
// counts.
DayStart, ResetsAt time.Time
}
AgentView is an agent with its scope and how much of its budgets it has used today.
func (AgentView) LandsLeft ¶ added in v0.4.0
LandsLeft is how many lands the agent has left today; -1: no limit.
func (AgentView) WorkspacesLeft ¶ added in v0.4.0
WorkspacesLeft is how many more workspaces the agent may open; -1: no limit.
type AgreementNotice ¶ added in v0.6.0
type AgreementNotice struct {
Org string
Personal bool
Version AgreementVersion
Blocking bool
At time.Time // when it asked for attention: published, or in effect
}
AgreementNotice is an organization a person owns that needs the agreement accepted: one in effect (Blocking: no work until accepted) or an announced one.
type AgreementRecord ¶ added in v0.6.0
type AgreementRecord struct {
store.OrgAgreement
Title string // the version's title, when the server still publishes it
Known bool // the server still publishes this version
}
AgreementRecord is one acceptance with the version it was for.
type AgreementSettings ¶ added in v0.6.0
type AgreementSettings struct {
// Required turns the step on (VX_REQUIRE_DPA). Off, nothing asks for
// an agreement and nothing shows one.
Required bool
// Dir is where the versions came from (VX_DPA_DIR), for messages.
Dir string
// Versions are the published versions (LoadAgreementVersions), by
// effective date.
Versions []AgreementVersion
}
AgreementSettings configures the data processing agreement step.
type AgreementVersion ¶ added in v0.6.0
type AgreementVersion struct {
ID string
Title string
File string // the file name in the directory
Published time.Time
Effective time.Time
Text []byte // Markdown
SHA256 string // of Text, hex
}
AgreementVersion is one version of the agreement, as the operator published it.
func LoadAgreementVersions ¶ added in v0.6.0
func LoadAgreementVersions(dir string) ([]AgreementVersion, error)
LoadAgreementVersions reads the versions from dir: manifest.json lists each version's id, file, publication and effective date; each file is the Markdown text of one version. It refuses a manifest with a missing or empty file, a duplicate id or effective date, or a new version published less than 30 days before it takes effect.
func (AgreementVersion) EffectiveDay ¶ added in v0.6.0
func (v AgreementVersion) EffectiveDay() string
EffectiveDay is when the version takes effect, for pages.
func (AgreementVersion) PublishedDay ¶ added in v0.6.0
func (v AgreementVersion) PublishedDay() string
PublishedDay and EffectiveDay are the version's dates, for pages.
type AgreementView ¶ added in v0.6.0
type AgreementView struct {
Required bool
Org Org
MyRole OrgRole
// CanAccept: the caller is a person who owns the organization.
CanAccept bool
Owners string // up to five owners' handles
// Current is the version in effect; CurrentAccepted its acceptance,
// nil while it is missing. Usable is CurrentAccepted != nil.
Current *AgreementVersion
CurrentAccepted *AgreementRecord
Usable bool
// Announced are versions published and not in effect yet; accepted
// ones have an acceptance in AnnouncedAccepted (by id).
Announced []AgreementVersion
AnnouncedAccepted map[string]AgreementRecord
// Pending is what an owner should accept next: the version in effect
// while it is missing, else the first announced one not accepted yet.
Pending *AgreementVersion
// Missing is the refusal work gets while it is not Usable.
Missing string
// History is every acceptance, newest first.
History []AgreementRecord
// AcceptURL is where an owner accepts.
AcceptURL string
}
AgreementView is an organization's agreement status.
type ArtifactInput ¶ added in v0.7.0
type ArtifactInput struct {
Name string // a file name, no directories, e.g. flow.gif
ContentType string // empty: from the name, else sniffed
Data []byte
}
ArtifactInput is one file a report attaches.
type AskInput ¶ added in v0.2.0
type AskInput struct {
Repo, Effort string
Targets []string
Body string
To string // agent name, handle or ref; empty: anyone
AnswerWithin time.Duration // 0: DefaultAnswerWithin
}
AskInput is a question.
type AuditQuery ¶ added in v0.5.0
type AuditQuery struct {
Org string // organization handle
Repo string // repository name
Actor string // principal ref or handle: user:alice, alice, agent:alice/claude
Since time.Time
Until time.Time
// Newest, when set, exports only the newest Newest entries, newest
// first (the web page's preview).
Newest int
}
AuditQuery filters an export. Empty fields do not filter.
type AuditRow ¶ added in v0.5.0
type AuditRow struct {
ID int64 `json:"id"`
At time.Time `json:"at"`
Op string `json:"op"`
Org string `json:"org,omitempty"`
Repo string `json:"repo,omitempty"`
Actor string `json:"actor,omitempty"`
Target string `json:"target"`
Before json.RawMessage `json:"before,omitempty"`
After json.RawMessage `json:"after,omitempty"`
}
AuditRow is one exported entry.
type AuditSettings ¶ added in v0.5.0
type AuditSettings struct {
// Retention deletes entries older than this (VX_AUDIT_RETENTION); 0
// keeps them forever. At least MinAuditRetention.
Retention time.Duration
}
AuditSettings configure the operation log.
type AutoRebase ¶ added in v0.4.0
type AutoRebase struct {
Effort string // slug
Rebased bool // the effort now sits on the branch head
Conflicts []string // files that conflict; the effort was left alone
Behind bool // notify mode: the effort is behind and replays cleanly
}
AutoRebase is what an automatic rebase did to one effort.
type BackfillStats ¶ added in v0.2.0
type BackfillStats struct {
Repo string
Changesets int
Objects int // objects recorded, including ones already recorded
Skipped int // trees that could not be read (missing from the store)
Ran bool
Took time.Duration
}
BackfillStats is what one repository's backfill did.
type CIEvent ¶ added in v0.4.0
type CIEvent struct {
Repo store.Repo
HeadSHA string
// PR, when the host names it, limits the event to that shipment;
// otherwise every shipment whose head is HeadSHA gets it.
PR *PRRef
Source string // check_run, status, pipeline
Name string
Status string // queued, in_progress, completed
Conclusion string // success, failure, neutral, cancelled, skipped, timed_out, action_required, stale
URL string
Host string
}
CIEvent is a CI result for a commit of a vx pull request.
type CISummary ¶ added in v0.4.0
type CISummary struct {
State string // pending, passed, failed
Failed []store.ShipmentCheck
Pending []store.ShipmentCheck
Passed []store.ShipmentCheck
}
CISummary is a shipment's CI result.
func SummarizeCI ¶ added in v0.4.0
func SummarizeCI(checks []store.ShipmentCheck) CISummary
SummarizeCI sums up checks: failed when one completed without success, pending while one runs, else passed.
type CITokenView ¶ added in v0.7.0
CITokenView is a CI token without its secret.
func (CITokenView) MayReport ¶ added in v0.7.0
func (v CITokenView) MayReport(check string) bool
MayReport reports whether the token may report results of check.
func (CITokenView) Ref ¶ added in v0.7.0
func (v CITokenView) Ref() string
Ref is the reference the token's results are recorded under.
type CLILogin ¶ added in v0.2.0
type CLILogin struct {
DeviceCode string
UserCode string
VerificationURL string
ExpiresAt time.Time
Interval time.Duration
}
CLILogin is a started browser login.
type ChangeAuthor ¶ added in v0.7.0
type ChangeAuthor struct {
Principal string // "agent:alice/backend" or "user:alice"
Person string // "user:alice": the person behind it (the principal itself for a person)
}
ChangeAuthor is who made a change, as recorded on its changeset.
type CheckCounts ¶ added in v0.7.0
type CheckCounts struct{ Passed, Failed, Waiting, Skipped int }
CheckCounts sum up a pipeline.
type CheckJobView ¶ added in v0.7.0
type CheckJobView struct {
store.CheckJob
// LeaseOwnerRef is who holds the lease; empty when nobody does.
LeaseOwnerRef string
// Inputs is set by NextCheckJob and GetCheckJob.
Inputs *JobInputs
}
CheckJobView is a job with what a runner needs: the resolved inputs.
type CheckResult ¶ added in v0.7.0
type CheckResult struct {
store.CheckResult
RepoName string
EffortSlug string
Counts bool // its reporter is one the check allows (resultCounts)
Why string // why it does not count; empty when it does
}
CheckResult is a stored result with where it belongs and, where it is read for a check of a change, whether it counts for that check.
type CheckSettings ¶ added in v0.7.0
type CheckSettings struct {
MaxArtifactBytes int64 // one artifact, the log or the data
MaxReportBytes int64 // everything one report sends
}
CheckSettings bound what one report may carry (VX_CHECK_ARTIFACT_MAX, VX_CHECK_REPORT_MAX). Zero fields take the defaults.
type CheckState ¶ added in v0.7.0
type CheckState struct {
Def rules.CheckDef
Applies bool
// State is CheckStateMissing, ..., or CheckStateNotNeeded when the
// check does not apply.
State string
// Latest is the newest result that counts (its reporter is allowed).
Latest *CheckResult
// Results are the check's results on the tree, newest first (at most
// maxStateResults), each saying whether it counts and why not.
Results []CheckResult
// How says how to provide a result, for people and agents.
How string
}
CheckState is one check of a change: whether it applies, its state on the change's tree, and its results there.
func (CheckState) Blocks ¶ added in v0.7.0
func (c CheckState) Blocks(stage rules.Blocks) bool
Blocks reports whether the check stops stage (land or ship) while it has no passing result.
func (CheckState) NotCounted ¶ added in v0.7.0
func (c CheckState) NotCounted() []CheckResult
NotCounted are the results newer than Latest that do not count.
type CheckStatusInput ¶ added in v0.7.0
CheckStatusInput selects a change for CheckStatus; see ReportInput.
type CheckStatusView ¶ added in v0.7.0
type CheckStatusView struct {
Repo string
Effort string
ChangeID string
Tree hash.Hash
Head bool // the effort head
Landed bool
Checks []CheckState
// Other are results on this tree for no check of vx.toml, such as
// vx land --run commands no check names.
Other []store.CheckResult
// Rules says where the checks came from; Problem is set when vx.toml
// does not parse; Warnings say what of the checks was left out.
Rules string
Problem string
Warnings []string
}
CheckStatusView is what a change still needs.
type Claim ¶ added in v0.2.0
type Claim struct {
ID uuid.UUID
RepoName string
EffortSlug string
EffortID uuid.UUID
Targets []string
Owner store.Principal
OwnerParent *store.Principal // the person an agent owner acts for
WorkspaceID *uuid.UUID
Reason string
CreatedAt time.Time
ExpiresAt time.Time
ReleasedAt *time.Time
// MovingTo is where the claimed code is being moved (a path or
// symbol); empty for other claims. A land by someone else that changes
// the claimed code warns them to make the change there.
MovingTo string
}
Claim says a principal is changing some paths or symbols now.
type ClaimInput ¶ added in v0.2.0
type ClaimInput struct {
Repo, Effort string
Targets []string
Reason string
TTL time.Duration // 0: DefaultClaimTTL
WorkspaceID string // optional
MovingTo string // optional: the Targets are being moved here (a path or symbol)
}
ClaimInput is a new claim.
type ContextWorkspace ¶ added in v0.2.0
type ContextWorkspace struct {
Workspace store.Workspace
Owner store.Principal
// OnTargets are the workspace's changed files (as its working copy
// reported them) that match the targets, or the targets of its claims
// that do; empty when it is not known to touch them.
OnTargets []string
// FilesKnown says the working copy reported its changed files.
FilesKnown bool
}
ContextWorkspace is an open workspace with its owner.
type ContinueInput ¶ added in v0.2.0
type ContinueInput struct {
Repo, Effort string
// StoppedAt is the conflicting change the caller resolved (its old-chain
// hash), so a resolution of an earlier stop is never applied to a later
// one.
StoppedAt hash.Hash
// Tree is the resolved tree of that change on top of the rebased chain
// so far; its objects must be uploaded.
Tree hash.Hash
}
ContinueInput resolves the change a stopped rebase conflicts on.
type CreateEffortInput ¶
type CreateEffortInput struct {
Repo string
Name string
Goal string
BaseBranch string // empty: the repo's default branch
}
CreateEffortInput describes a new effort.
type CreateRepoInput ¶
type CreateRepoInput struct {
Name string
Provider store.Provider
Remote string
DefaultBranch string
// Org owns the repo. Empty: the organization named like the repo's
// owner part when the caller may create repos there, else the
// caller's personal organization.
Org string
// BaseURL is the host's web address for GitLab, Gitea, Forgejo and
// Bitbucket (empty: the server's default for the provider).
BaseURL string
// Token is a token for this repository only (GitLab, Gitea, Forgejo,
// Bitbucket), kept sealed with VX_SECRET_KEY. Empty: the server's
// token for the host.
Token string
}
CreateRepoInput describes a new repo.
type DiskSpace ¶ added in v0.5.0
type DiskSpace struct {
Path string
Free, Total int64
FreePercent int
Low bool // below QuotaSettings.DiskWarnPercent
}
DiskSpace is the free space of the data directory's disk.
type EffortView ¶
type EffortView struct {
Repo store.Repo
Effort store.Effort
Workspaces []store.Workspace
// Rebase is the effort's rebase in progress (running or stopped), if any.
Rebase *store.Rebase
}
EffortView is an effort with its repo and open workspaces.
type EnqueueInput ¶ added in v0.7.0
type EnqueueInput struct {
Repo store.Repo
Effort store.Effort
Trigger string // land, ship or manual
// Change is the change the jobs are for: the landed one on land, the
// effort head on ship, the workspace's change at a land gate.
Change JobChangeRef
// Base and Tree are what the diff goes from and to; results must be for
// Tree.
Base, Tree hash.Hash
// Paths are the changed paths the checks' globs are matched against.
Paths []string
// Values are named input values (preview_url), by input name.
Values map[string]string
RequestedBy *uuid.UUID
// Only, when set, is the one check to enqueue whatever its when.
Only string
}
EnqueueInput is what land, ship and requests hand the queue.
type ForYou ¶ added in v0.5.0
type ForYou struct {
Items []ForYouItem
Counts map[string]int
}
ForYou is what waits for a principal, newest first, with counts.
type ForYouItem ¶ added in v0.5.0
type ForYouItem struct {
Kind string
At time.Time
Note *Note
Review *Review
Agreement *AgreementNotice
}
ForYouItem is one thing on the For you page: a note or a review.
type GeneratedRule ¶ added in v0.3.0
GeneratedRule says files matching Glob are generated by Command: vx never text-merges them and tells people to regenerate instead.
type GitHubAPI ¶ added in v0.2.0
type GitHubAPI interface {
// CreateAppFromManifest completes the manifest flow and returns the new
// App's credentials.
CreateAppFromManifest(ctx context.Context, code string) (GitHubAppCredentials, error)
// Installation and InstallationRepos read an installation of the App.
Installation(ctx context.Context, id int64) (GitHubInstallation, error)
InstallationRepos(ctx context.Context, id int64) ([]GitHubRepo, error)
// InstallationToken returns a short-lived token for an installation, for
// git pushes and API calls on its repositories.
InstallationToken(ctx context.Context, id int64) (token string, expires time.Time, err error)
// ExchangeOAuthCode turns a web sign-in code into a user access token.
ExchangeOAuthCode(ctx context.Context, code, redirectURI, codeVerifier string) (userToken string, err error)
// User returns the signed-in GitHub user.
User(ctx context.Context, userToken string) (GitHubUser, error)
// RepoPermission returns login's permission on owner/repo: admin,
// maintain, write, triage, read or none.
RepoPermission(ctx context.Context, installationID int64, owner, repo, login string) (string, error)
// OrgMembership returns login's role in org: admin, member or none.
OrgMembership(ctx context.Context, installationID int64, org, login string) (string, error)
}
GitHubAPI is what vx needs from GitHub. internal/github implements it over HTTP; tests use the fake in internal/github/githubtest.
type GitHubAppCredentials ¶ added in v0.2.0
type GitHubAppCredentials struct {
AppID int64
Slug string
HTMLURL string
ClientID string
ClientSecret string
PrivateKeyPEM string
WebhookSecret string
}
GitHubAppCredentials are what the manifest flow returns.
type GitHubAppGap ¶ added in v0.4.0
type GitHubAppGap struct {
What string // e.g. "checks:write" or "event:check_run"
Fix string // what to do on GitHub
}
GitHubAppGap is something the server's App lacks, for Admin > GitHub.
type GitHubAppInfo ¶ added in v0.2.0
type GitHubAppInfo struct {
AppID int64
Slug string
HTMLURL string // https://github.com/apps/<slug>
ClientID string
InstallURL string // where an organization installs the App
AuthorizeURL string // OAuth authorize endpoint for web sign-in
CreatedBy *uuid.UUID
CreatedAt time.Time
}
GitHubAppInfo is what may be shown about the App (no secrets).
type GitHubAppSettings ¶ added in v0.4.0
GitHubAppSettings are the App's permissions and events on GitHub.
type GitHubCheckRun ¶ added in v0.4.0
type GitHubCheckRun struct {
Name string
HeadSHA string
// Status is queued, in_progress or completed; empty means completed.
// CreateCheckRun always completes.
Status string
Conclusion string // success, neutral, failure, skipped (completed runs)
Title string
Summary string // markdown
Text string // markdown
DetailsURL string
ExternalID string
}
GitHubCheckRun is a check run on a commit.
type GitHubCheckRunsAPI ¶ added in v0.7.0
type GitHubCheckRunsAPI interface {
StartCheckRun(ctx context.Context, installationID int64, owner, repo string, run GitHubCheckRun) (int64, error)
UpdateCheckRun(ctx context.Context, installationID int64, owner, repo string, id int64, run GitHubCheckRun) error
}
GitHubCheckRunsAPI creates check runs that stay open and updates them as results arrive: one per [[check]] on a shipped pull request (see github_check_runs.go). internal/github implements it.
type GitHubChecksAPI ¶ added in v0.4.0
type GitHubChecksAPI interface {
CreateCheckRun(ctx context.Context, installationID int64, owner, repo string, run GitHubCheckRun) error
// AppSettings reads the App's permissions and webhook events.
AppSettings(ctx context.Context) (GitHubAppSettings, error)
}
GitHubChecksAPI is the part of the GitHub client that posts check runs and reads the App's settings. internal/github implements it next to GitHubAPI; a client without it posts no check runs.
type GitHubInstallation ¶ added in v0.2.0
type GitHubInstallation struct {
ID int64
AccountID int64
AccountLogin string
AccountType string // Organization or User
RepositorySelection string // all or selected
SuspendedAt *time.Time
}
GitHubInstallation is an installation of the App.
type GitHubRepo ¶ added in v0.2.0
GitHubRepo is a repository an installation can reach.
type GitHubRoleScope ¶ added in v0.2.0
type GitHubRoleScope struct {
RepoID *uuid.UUID
GitHubRepoID int64
GitHubOrgID int64
GitHubUserID int64
InstallationID int64
Reason string
}
GitHubRoleScope selects what DropGitHubRoles forgets. Every set field adds its own part (the fields are OR-ed, never AND-ed):
- RepoID or GitHubRepoID: everyone's role on that repository (member added, removed or edited; repository visibility, rename, transfer).
- GitHubOrgID: roles on every repository of installations on that account and memberships in it (organization membership and team changes).
- GitHubUserID: everything cached for that person (person removed, or their access changed in a way that names only them).
- InstallationID: roles on every repository of the installation and memberships in its account (installation removed, suspended, or its repositories changed).
Reason is logged.
type GitHubSettings ¶ added in v0.2.0
type GitHubSettings struct {
API GitHubAPI // nil until the App is configured
PublicURL string // e.g. https://app.vxbench.com, for redirect and webhook URLs
Signup SignupMode // empty: SignupInvite
SecretKey []byte // 32 bytes from VX_SECRET_KEY, for secrets at rest
// WebURL and APIURL are GitHub's browser and REST API bases; empty:
// github.com. GitHub Enterprise Server: https://HOST and
// https://HOST/api/v3.
WebURL, APIURL string
// Connect makes the API client for the App once its credentials are
// known (internal/github in the server, the fake in tests). With zero
// credentials it returns a client that can only complete the manifest
// flow. nil: the App cannot be set up or loaded.
Connect func(creds GitHubAppCredentials) (GitHubAPI, error)
}
GitHubSettings configure the GitHub integration of a Service.
type GitHubSignupRefused ¶ added in v0.2.0
type GitHubSignupRefused struct {
Login string
Mode SignupMode
}
GitHubSignupRefused is returned when a GitHub account has no vx person and the signup mode does not let it create one.
func (*GitHubSignupRefused) Error ¶ added in v0.2.0
func (e *GitHubSignupRefused) Error() string
type GitHubUser ¶ added in v0.2.0
type GitHubUser struct {
ID int64
Login string
Name string
Email string // primary verified email if GitHub shares it; may be empty
}
GitHubUser is a signed-in GitHub user.
type HostDelivery ¶ added in v0.4.0
type HostDelivery struct {
Event string // X-Gitlab-Event, X-Gitea-Event / X-Forgejo-Event, X-Event-Key
ID string // X-Gitlab-Event-UUID, X-Gitea-Delivery, X-Request-UUID; may be empty
Token string // X-Gitlab-Token
Signature string // X-Gitea-Signature, X-Forgejo-Signature, X-Hub-Signature
URLSecret string // ?secret= (Bitbucket hooks without a secret)
Body []byte
}
HostDelivery is one webhook delivery as it arrived; nothing in it is trusted before the secret checks out.
type HostHook ¶ added in v0.4.0
type HostHook struct {
URL string // where the host delivers, e.g. https://vx.example.com/hooks/gitlab
// Secret is the repository's webhook secret, only right after it was
// made (vx keeps it sealed and never shows it again).
Secret string
// SecretSource says which secret verifies deliveries: "repository",
// "server" (VX_<HOST>_WEBHOOK_SECRET) or "" (none yet: deliveries are
// refused).
SecretSource string
}
HostHook is how to register a repository's webhook on its host.
type HostSettings ¶ added in v0.4.0
type HostSettings struct {
// WebhookSecrets are server-wide webhook secrets per provider
// (VX_GITLAB_WEBHOOK_SECRET, VX_GITEA_WEBHOOK_SECRET,
// VX_FORGEJO_WEBHOOK_SECRET, VX_BITBUCKET_WEBHOOK_SECRET). A delivery
// signed with one is accepted for every repository of that provider
// that has no secret of its own.
WebhookSecrets map[store.Provider]string
}
HostSettings configure GitLab, Gitea, Forgejo and Bitbucket on a server.
type HumanCheck ¶ added in v0.7.0
type HumanCheck struct {
JobID uuid.UUID
Repo string
Effort string // slug
EffortName string
Check string
ChangeID string
Tree hash.Hash
Since time.Time
Inputs map[string]string // named values, e.g. preview_url
}
HumanCheck is a check waiting for a person, for the For you page.
type Inbox ¶ added in v0.2.0
type Inbox struct {
Questions []Note // open questions to the caller (people: also to their agents)
Answers []Note // answers to the caller's questions, newest first
Escalated []Note // people only: overdue questions in their efforts or to their agents
// Notes are system notes addressed to the caller (people: also to their
// agents) that no newer note replaced, newest first: review comments
// and CI results from the git host (v0.4), and claims that lapsed.
Notes []Note
// ForAgents, people only: open questions to their agents that were
// not working when asked, copied to them at once (not part of
// Questions).
ForAgents []Note
}
Inbox is what needs a principal's attention.
type JobChange ¶ added in v0.7.0
type JobChange struct {
ID string `json:"id,omitempty"`
Changeset string `json:"changeset,omitempty"`
Intent string `json:"intent,omitempty"`
Author string `json:"author,omitempty"`
OnBehalfOf string `json:"on_behalf_of,omitempty"`
BaseTree string `json:"base_tree"`
Tree string `json:"tree"`
}
JobChange is the change input. For a ship job it is the effort's head.
type JobChangeRef ¶ added in v0.7.0
type JobChangeRef struct {
ID string
Changeset hash.Hash // zero when it has not landed (a land gate)
Intent string
Author ChangeAuthor
}
JobChangeRef is the change a job is for.
type JobEffort ¶ added in v0.7.0
type JobEffort struct {
Repo string `json:"repo"`
Slug string `json:"slug"`
Name string `json:"name"`
Goal string `json:"goal,omitempty"`
Branch string `json:"base_branch"`
}
JobEffort is the effort input.
type JobFile ¶ added in v0.7.0
type JobFile struct {
Path string `json:"path"`
Status string `json:"status"` // add, modify, delete
Hash string `json:"hash,omitempty"`
Mode string `json:"mode,omitempty"`
}
JobFile is one changed file.
type JobInputs ¶ added in v0.7.0
type JobInputs struct {
Effort JobEffort `json:"effort"`
Change JobChange `json:"change"`
ChangedFiles []JobFile `json:"changed_files"`
Files []JobFile `json:"files"` // fetchable through the object API (GetObjects with the repository)
Diff string `json:"diff,omitempty"`
DiffCut bool `json:"diff_cut,omitempty"`
Values map[string]string `json:"values"`
// Missing lists declared inputs that have no value yet.
Missing []string `json:"missing,omitempty"`
}
JobInputs is a job's input bundle.
type JobSpec ¶ added in v0.7.0
type JobSpec struct {
Repo store.Repo
Effort store.Effort
Def jobDef
Trigger string
Change JobChangeRef
Base, Tree hash.Hash
Values map[string]string
RequestedBy *uuid.UUID
}
JobSpec is one job to enqueue (pipelines enqueue dependents with it).
type LandInput ¶
type LandInput struct {
WorkspaceID uuid.UUID
Base hash.Hash // changeset the snapshot was made on
Tree hash.Hash // snapshot root tree; objects must be uploaded
Intent string // empty: the workspace intent
Evidence *object.Evidence
DependsOn []string
Model string
Session string
// RequireUpToDate refuses to merge onto newer work.
RequireUpToDate bool
}
LandInput is a snapshot to land into a workspace's effort.
type LandResult ¶
type LandResult struct {
Landed bool
Changeset store.ChangesetRow
Files []store.FileChange
Rebased bool // the effort moved, the snapshot was merged onto it
AutoMerged []string // paths changed on both sides that merged cleanly
Conflicts []engine.Conflict // set when Landed is false
EffortHead hash.Hash
// EffortMoved is set when RequireUpToDate refused the land.
EffortMoved bool
// Warnings are problems found in the landed tree, such as a Go function
// declared twice in one package after a clean text merge, a vx.toml
// [[unique]] key used twice (kind "rule"), or a generated file both
// sides changed, kept from the workspace (kind "generated"). They never
// stop a land.
Warnings []engine.Warning
// OverlappingClaims are active claims of other principals on files this
// land changed. They never stop a land.
OverlappingClaims []Claim
// KeptBoth lists paths where both sides inserted different lines at the
// same place and the merge kept both; worth a look.
KeptBoth []string
// MergedByDecl lists .go paths whose lines conflicted but whose
// top-level declarations did not, merged declaration by declaration;
// worth a look, like KeptBoth.
MergedByDecl []string
// Overlaps are the effort's stored forecasts with other open efforts.
// The forecast for this land runs after it, in the background, so they
// may still describe the effort before this land.
Overlaps []Overlap
// CheckResults are the check results this land stored: its vx land
// --run results, on the snapshot they ran on.
CheckResults []store.CheckResult
// Review is set when a "human" landing policy of vx.toml applies: the
// change waits for a person as this pending review, Landed is false and
// the effort head did not move.
Review *Review
}
LandResult is the outcome of Land.
type ListJobsInput ¶ added in v0.7.0
type ListJobsInput struct {
Repo, Effort string
// States: queued, leased, done, failed, superseded; empty: all.
States []string
Runner string
Limit int
}
ListJobsInput selects jobs for ListCheckJobs.
type ListNotesInput ¶ added in v0.2.0
type ListNotesInput struct {
Repo, Effort string
Targets []string
Kinds []NoteKind
Since time.Time
ThreadID uuid.UUID
Limit int // 0: DefaultNoteListLimit
// IncludeSuperseded keeps notes a newer note replaced (vx board --all);
// by default they are left out.
IncludeSuperseded bool
}
ListNotesInput filters a board listing.
type ListTasksInput ¶ added in v0.2.0
ListTasksInput filters an effort's tasks.
type LogEntry ¶
type LogEntry struct {
store.ChangesetRow
Files []store.FileChange
}
LogEntry is a landed changeset with its file list.
type Membership ¶ added in v0.2.0
Membership is a person in an organization.
type MergeResult ¶ added in v0.5.0
type MergeResult struct {
Kept, Merged store.Principal
Moved store.MergeStats
}
MergeResult is what MergePeople did.
type MirrorCleaner ¶ added in v0.6.0
type MirrorCleaner interface {
// RemoveMirror deletes the mirror of a repository; false when there was
// none.
RemoveMirror(repoID uuid.UUID) (bool, error)
// MirrorRepoIDs lists the repositories with a mirror here.
MirrorRepoIDs() ([]uuid.UUID, error)
}
MirrorCleaner is an UpstreamSyncer that keeps git mirrors on this server's disk (the git bridge).
type NewPerson ¶ added in v0.2.0
type NewPerson struct {
Handle string
DisplayName string
Email string
SiteAdmin bool
// Org, when set, adds the person to this organization as a member.
Org string
// CreateOrg creates Org with the person as its owner when it does not
// exist yet (vx-server user-add on a new server).
CreateOrg bool
}
NewPerson describes a person for AddPerson.
type NextJobInput ¶ added in v0.7.0
type NextJobInput struct {
// Repo and Effort narrow the queue; empty Repo: every repository the
// caller may run jobs in.
Repo, Effort string
// Runner is a runner kind the caller serves: browser (agent:browser),
// ci or human. Empty: every kind it serves.
Runner string
}
NextJobInput says which job a runner wants.
type Note ¶ added in v0.2.0
type Note struct {
ID uuid.UUID
RepoName string
EffortSlug string
EffortID uuid.UUID
ThreadID uuid.UUID // the root note of the thread; equals ID for a root
Kind NoteKind
Targets []string
Author store.Principal
AuthorOwner *store.Principal // the person an agent author acts for
To *store.Principal // a question's addressee; nil: anyone
Body string
State string
AnswerBy *time.Time
CreatedAt time.Time
// Supersedes is the author's earlier note this one replaces;
// SupersededBy is set on a note a newer one replaced.
Supersedes *uuid.UUID
SupersededBy *uuid.UUID
System bool // posted by vx itself
Read bool // the caller has seen it (filled per caller)
// CopiedTo is the person a question was copied to because the agent it
// is addressed to was not working when it was asked.
CopiedTo *store.Principal
// ToAway is set by Ask when the agent asked is not working right now
// (AwayNotice says so to the asker).
ToAway *Presence
// SimilarTo is the open question of the effort this question closely
// matched when it was asked (same targets, nearly the same words);
// Similar lists the later questions that matched this one.
SimilarTo *uuid.UUID
Similar []uuid.UUID
// SimilarOpen is set by Ask to the open question SimilarTo names
// (SimilarNotice says so to the asker).
SimilarOpen *Note
}
Note is one note on an effort's board.
type NoteContext ¶ added in v0.2.0
type NoteContext struct {
Notes []Note
Working []ContextWorkspace
RecentChanges []LogEntry // landed changes touching the targets, newest first, with files
Claims []Claim // active claims on the targets (all when no targets)
OtherEfforts []OtherEffortActivity // the targets in other open efforts the caller can read
Overlaps []Overlap // forecast collisions of this effort with others
}
NoteContext is what an agent should know before touching some targets.
type NoteKind ¶ added in v0.2.0
type NoteKind string
NoteKind is the type of a board note.
const ( NotePlan NoteKind = "plan" // what I am about to change NoteDecision NoteKind = "decision" // a choice others should follow NoteInterface NoteKind = "interface" // a signature others can rely on NoteQuestion NoteKind = "question" // asked with Ask NoteAnswer NoteKind = "answer" // given with AnswerNote NoteBlocker NoteKind = "blocker" // what I am waiting on NoteHandoff NoteKind = "handoff" // work left for the next agent // Posted by vx itself (Note.System), never through PostNote: NoteOverlap NoteKind = "overlap" // a forecast collision with another effort NoteReview NoteKind = "review" // a review comment from the git host (v0.4) NoteCI NoteKind = "ci" // a CI result from the git host (v0.4) NoteClaim NoteKind = "claim" // to a claim's owner: it lapsed, or someone landed on code it is moving )
const NoteApproval NoteKind = "approval"
NoteApproval is a system note about a review under a human landing policy: waiting, approved, rejected, or conflicting on approval. Notes to the author are addressed to them (Note.To).
const NoteRebase NoteKind = "rebase"
NoteRebase is a system note about the effort's base branch: rebased automatically, or in need of a rebase.
type Object ¶ added in v0.2.0
type Object struct {
Kind hash.Kind
Data []byte
Hash hash.Hash // for uploads: what the client says it is; zero skips the check
}
Object is one object in transfer.
type Org ¶ added in v0.2.0
type Org struct {
ID uuid.UUID
Handle string
DisplayName string
DefaultRepoRole RepoRole // RoleNone, RoleRead or RoleWrite
Personal bool
CreatedAt time.Time
}
Org is an organization.
type OrgChecks ¶ added in v0.7.0
type OrgChecks struct {
Org string
Version int // 0: the organization never defined checks
Source string
Checks []rules.CheckDef
By string // "user:alice"
At time.Time
}
OrgChecks is one version of an organization's checks.
type OrgDeletion ¶ added in v0.6.0
type OrgDeletion struct {
OrgID uuid.UUID `json:"org_id"`
Org string `json:"org"`
RequestedBy string `json:"requested_by"`
DeletedAt time.Time `json:"deleted_at"`
PurgeAfter time.Time `json:"purge_after"`
PurgeStarted *time.Time `json:"purge_started,omitempty"`
PurgedAt *time.Time `json:"purged_at,omitempty"`
PurgedBy string `json:"purged_by,omitempty"`
Counts map[string]int64 `json:"counts,omitempty"`
}
OrgDeletion is the record of an organization's deletion: what a deletion confirmation says. It names no repository.
func (OrgDeletion) Confirmation ¶ added in v0.6.0
func (d OrgDeletion) Confirmation(server string) string
Confirmation is the deletion confirmation as plain text, for owners to keep and for the operator to send after the purge.
type OrgDeletionSettings ¶ added in v0.6.0
type OrgDeletionSettings struct {
// Grace is how long owners can restore a deleted organization
// (VX_ORG_DELETE_GRACE); 0 means DefaultOrgDeleteGrace. Negative
// purges at the next run of the purger (no grace period).
Grace time.Duration
// PurgeInterval is how often each server looks for organizations to
// purge; 0 means DefaultPurgeInterval.
PurgeInterval time.Duration
}
OrgDeletionSettings configure deleting organizations.
type OrgDetail ¶ added in v0.2.0
type OrgDetail struct {
Org Org
MyRole OrgRole // empty when the caller is not a member
Members []Membership
Teams []Team
Repos []store.Repo
}
OrgDetail is an organization with its members, teams and the repositories the caller can read.
type OtherEffortActivity ¶ added in v0.3.0
type OtherEffortActivity struct {
Effort store.Effort
Owner store.Principal
Claims []Claim
Notes []Note // interface and decision notes, newest first
Working []ContextWorkspace
ChangedPaths []string // among the targets: changed in that effort, not shipped
}
OtherEffortActivity is another open effort's activity on some targets.
type Overlap ¶ added in v0.3.0
type Overlap struct {
RepoName string
Effort store.Effort // the caller's side
Other store.Effort
OtherOwner store.Principal
Status string
Conflicts []string
Warnings []engine.Warning // kind "rule" for vx.toml violations, "duplicate" for Go
CheckedAt time.Time
}
Overlap is a forecast collision between two open efforts of a repository.
type PRRef ¶ added in v0.4.0
type PRRef struct {
Repo store.Repo
Number string // the host's number (shipments.provider_ref); may be empty
HeadBranch string // vx/...; used when Number matches no shipment
HeadSHA string
URL string
}
PRRef names a pull (or merge) request of a vx shipment on the git host.
type PipelineCheck ¶ added in v0.7.0
type PipelineCheck struct {
Def rules.CheckDef
Origin string // "organization acme (version 3)" or "vx.toml"
Depth int // for indented display: 0 runs after nothing
Parent string // the check it is shown under
State string // rules.StatePassed, ... (see rules.Pipeline)
Reason string // why it waits or was skipped
Result *CheckResult
// Trust labels the reporter of Result: "independent agent", "CI",
// "person", "the author's agent", ...
Trust string
// Rejected says why the newest result does not count (the reporter is
// not one the check accepts); empty otherwise.
Rejected string
}
PipelineCheck is one check of a change or effort on one tree, placed in its pipeline: what the status, the web pages and GitHub show.
type PipelineView ¶ added in v0.7.0
type PipelineView struct {
View CheckStatusView // what CheckStatus says
Repo store.Repo
Effort store.Effort
ChangeID string
Tree hash.Hash
Checks []PipelineCheck // in pipeline order
// Notes: the change edits vx.toml, vx.toml checks left out for an
// organization check's name, a vx.toml that does not parse.
Notes []string
// EditsRules: the change edits vx.toml.
EditsRules bool
Org OrgChecks
}
PipelineView is the checks of a change (or of an effort's head) on one tree, placed in their pipeline, for vx check status and the web.
func (PipelineView) Counts ¶ added in v0.7.0
func (v PipelineView) Counts() CheckCounts
Counts sums up the view: neutral counts as passed, ready as waiting.
type PostNoteInput ¶ added in v0.2.0
type PostNoteInput struct {
Repo, Effort string
Kind NoteKind // plan, decision, interface, blocker, handoff
Targets []string
Body string
Supersedes string // optional: id or 8+ character prefix of the author's own earlier note
}
PostNoteInput is a non-question note.
type Presence ¶ added in v0.5.0
type Presence struct {
Active bool
// LastSeen is its latest token use or workspace activity; nil: never.
LastSeen *time.Time
}
Presence says whether a principal is working right now.
type PushMessage ¶ added in v0.5.0
type PushMessage struct {
Title string `json:"title"`
Body string `json:"body"`
URL string `json:"url"` // a path on this server
Tag string `json:"tag"` // a newer notification with the same tag replaces the older
}
PushMessage is what the service worker shows (static/sw.js).
type PushSettings ¶ added in v0.5.0
type PushSettings struct {
// Every is how often the notifier looks for new things to push; zero:
// DefaultPushEvery.
Every time.Duration
// Client posts to push services; nil: webpush.PublicClient, which only
// connects to public addresses. Tests set it.
Client *http.Client
// AllowAnyEndpoint accepts http and private endpoints (tests only).
AllowAnyEndpoint bool
}
PushSettings configures Web Push delivery.
type PushSubscribeInput ¶ added in v0.5.0
type PushSubscribeInput struct {
Endpoint, P256dh, Auth string
Device string // what the browser is, shown in Settings
}
PushSubscribeInput is a browser's subscription.
type Quota ¶ added in v0.5.0
type Quota struct {
Repos int64 // repositories
StoredBytes int64 // bytes in the object store over all repositories
ImportBytes int64 // size of one repository imported from a git host
PushBytes int64 // bytes of one upload of objects (one request)
OpenEfforts int64 // efforts that are open or shipping
}
Quota is one set of limits; 0 means no limit.
type QuotaRow ¶ added in v0.5.0
type QuotaRow struct {
Name, Label string
Used string // "" when the quota is per request (import, push)
Limit string // "no limit" for 0
Default bool // the limit is the server's default
Over bool // used is at or above the limit
}
Row is one line of the quota table on the org page.
type QuotaSettings ¶ added in v0.5.0
type QuotaSettings struct {
Defaults Quota
// DataDir is the server's data directory, whose disk the admin panel
// watches. Empty: no disk-space warning.
DataDir string
// DiskWarnPercent warns on the admin pages when less than this share
// of the data disk is free. 0: 10.
DiskWarnPercent int
}
QuotaSettings configure quotas and the disk-space warning.
type QuotaUsage ¶ added in v0.5.0
type QuotaUsage struct {
Org string
Limits Quota // in effect
Defaults Quota // the server's
Override store.OrgQuota // the organization's own; nil fields: default
Repos int64
OpenEfforts int64
// StoredBytes is the bytes the organization's objects take in the
// object store; StoredKnown is false while the server does not count
// them yet.
StoredBytes int64
StoredKnown bool
}
QuotaUsage is what an organization uses against its limits.
func (QuotaUsage) Rows ¶ added in v0.5.0
func (u QuotaUsage) Rows() []QuotaRow
Rows lists the quotas for display.
type RebaseView ¶ added in v0.2.0
type RebaseView struct {
Repo store.Repo
Effort store.Effort
Rebase store.Rebase
// UpToDate is set when there was nothing to rebase: the effort already
// sits on the head of the branch. No rebase is recorded then.
UpToDate bool
// StoppedAt is the old-chain change whose replay conflicts, when the
// rebase is stopped. Writing the merge of BaseTree (its parent's tree),
// ChangeTree (its tree) and OntoTree (the rebased chain so far) with
// conflict markers reproduces the conflicts.
StoppedAt *store.ChangesetRow
BaseTree, ChangeTree, OntoTree hash.Hash
StartedBy, UpdatedBy string // principal refs
}
RebaseView is a rebase with what a caller needs to show or resume it.
type RepoGrant ¶ added in v0.2.0
type RepoGrant struct {
Repo string
Subject string // "user:alice" or "team:acme/backend"
Role RepoRole
}
RepoGrant is a direct grant of a role on a repository.
type RepoRole ¶ added in v0.2.0
type RepoRole string
RepoRole is what a principal may do in a repository. Roles are ordered: admin includes write, write includes read.
func RoleFromGitHub ¶ added in v0.2.0
RoleFromGitHub maps a GitHub repository permission to a vx role.
type RepoSizer ¶ added in v0.5.0
type RepoSizer interface {
RepoSize(ctx context.Context, repo store.Repo) (bytes int64, known bool, err error)
}
RepoSizer is implemented by a git bridge that can ask a git host how big a repository is before importing it. known is false when the host does not say.
type ReportInput ¶ added in v0.7.0
type ReportInput struct {
Repo string
Effort string
// ChangeID and Tree say what the result describes. An empty ChangeID
// is the effort head; a zero Tree is the change's newest tree on the
// effort (an open workspace has none yet: pass the snapshot's tree).
ChangeID string
Tree hash.Hash
Name string // the check, as vx.toml names it
Status string // pass, fail, neutral or pending
Summary string
Log []byte
// Artifacts are files the check produced: screenshots, recordings,
// reports. They become objects of the repository.
Artifacts []ArtifactInput
// Data is structured output (JSON), DataName the file name it came
// from (e.g. steps.json); both may be empty.
Data []byte
DataName string
// How is the command of a run check, set when vx ran it.
How string
Model string
Started, Finished time.Time
CITokenID *uuid.UUID // set by the server for CI service tokens, never by a client
// contains filtered or unexported fields
}
ReportInput is one result of a check.
type ReporterIdentity ¶ added in v0.7.0
type ReporterIdentity struct {
Kind ReporterKind
Principal string // ref of the reporter
Person string // ref of the person behind it; empty for CI and services
}
ReporterIdentity is who reports a result.
type ReporterKind ¶ added in v0.7.0
type ReporterKind string
ReporterKind is what kind of principal reports a result.
const ( ReporterIsPerson ReporterKind = "person" ReporterIsAgent ReporterKind = "agent" ReporterIsCI ReporterKind = "ci" // ReporterIsService is a service principal that is not a CI token. ReporterIsService ReporterKind = "service" )
type RequestCheckInput ¶ added in v0.7.0
type RequestCheckInput struct {
Repo, Effort string
Check string
// ChangeID picks a change; empty: the effort's head (its whole diff).
ChangeID string
Values map[string]string
}
RequestCheckInput asks for a check to run.
type Reservation ¶ added in v0.3.0
type Reservation = store.Reservation
Reservation is a value vx reserve handed out.
type Review ¶ added in v0.4.0
type Review struct {
store.Review
RepoName string
EffortSlug string
Author store.Principal
AuthorOwner *store.Principal // the person an agent author acts for
DecidedBy *store.Principal
// Files are the changes of the snapshot against its base (GetReview
// only).
Files []store.FileChange
// CanDecide says whether the caller may approve or reject it; when not,
// CannotDecide says why.
CanDecide bool
CannotDecide string
}
Review is a land waiting for a person, with who it is by and, for the caller, whether they may decide it.
func (Review) WaitingText ¶ added in v0.4.0
WaitingText is what the author's vx land prints:
Waiting for a person to review: internal/store/migrations/021_x.sql (policy in vx.toml)
type ReviewDecision ¶ added in v0.4.0
type ReviewDecision struct {
Review Review
// Landed is set when an approval landed the change; Conflicts when it
// could not because the change now conflicts with the effort (the
// review stays pending and goes back to the author).
Landed *LandResult
Conflicts []engine.Conflict
}
ReviewDecision is the outcome of ApproveReview or RejectReview.
type ReviewEvent ¶ added in v0.4.0
type ReviewEvent struct {
PR PRRef
Kind ReviewKind
// State is the review's state for ReviewSummary.
State string
// ID is the host's id of the review or comment. A later event with the
// same id (an edit) supersedes the earlier note.
ID string
// Edited is set for an edit of an earlier review or comment: its note
// is replaced, and no new task is added.
Edited bool
Reviewer string // the reviewer's login on the host
Body string
URL string
// Path and Line are where a ReviewLine comment is (Line in the file
// as of CommitSHA; 0: the file as a whole).
Path string
Line int
CommitSHA string
Host string // "GitHub", "GitLab", ...: shown in the note
}
ReviewEvent is a review, or a comment, on a vx pull request.
type ReviewKind ¶ added in v0.4.0
type ReviewKind string
ReviewKind says what a ReviewEvent is.
const ( ReviewSummary ReviewKind = "review" // a submitted review: approved, changes requested or commented ReviewLine ReviewKind = "line" // a comment on a line of the diff ReviewComment ReviewKind = "comment" // a comment in the pull request's conversation )
type ReviewQuery ¶ added in v0.4.0
type ReviewQuery struct {
Repo string // empty: every repository the caller can read
Effort string // needs Repo
// States: empty means pending only.
States []store.ReviewState
Limit int
}
ReviewQuery filters ListReviews.
type RevokeInput ¶ added in v0.2.0
type RevokeInput struct {
// ID is a token id or a unique prefix of one (at least 8 characters)
// among the tokens the caller may manage.
ID string
// AllowCurrent allows revoking the token the request is made with, which
// signs the caller out.
AllowCurrent bool
}
RevokeInput says which token to revoke.
type Rules ¶ added in v0.3.0
Rules are a repository's vx.toml (see internal/rules).
func ParseRules ¶ added in v0.3.0
ParseRules parses vx.toml. Unknown keys, invalid globs and regular expressions are errors that say the line and what is wrong.
type RunnerView ¶ added in v0.7.0
RunnerView is an agent with the runner kinds it serves.
type SSOConfig ¶ added in v0.5.0
type SSOConfig struct {
Org string
Issuer string
ClientID string
Domains []string
Require bool
UpdatedAt time.Time
UpdatedBy string // ref, when known
CallbackURL string // the redirect URI to register with the provider
}
SSOConfig is an organization's single sign-on as shown to its members (never the client secret).
type SSOConfigInput ¶ added in v0.5.0
SSOConfigInput is what an owner sets. An empty ClientSecret keeps the saved one.
type SSOFlow ¶ added in v0.5.0
type SSOFlow struct {
Org, State, Nonce, Verifier string
// LinkPerson and LinkToken are set when a signed-in person signs in
// through the provider: the identity is connected to them and their
// current session is marked, instead of starting a new one.
LinkPerson, LinkToken uuid.UUID
}
SSOFlow is what the web layer kept between start and callback.
type SSORequiredError ¶ added in v0.5.0
type SSORequiredError struct {
Org string // handle
}
SSORequiredError says an organization requires single sign-on and the request's token did not come through it.
func (*SSORequiredError) Error ¶ added in v0.5.0
func (e *SSORequiredError) Error() string
type SSOResult ¶ added in v0.5.0
type SSOResult struct {
Person store.Principal
Org string
// Token is a new web session; empty when the flow marked the signed-in
// person's session instead.
Token string
IsNew bool // the account was created now
Linked bool // the identity was connected to an existing person now
}
SSOResult is a finished single sign-on.
type SSOStart ¶ added in v0.5.0
SSOStart is a started single sign-on: where to send the browser and what the web layer keeps in its short-lived cookie.
type ScopeInput ¶ added in v0.4.0
type ScopeInput struct {
Clear bool
SetAllow bool
Allow []string
SetDeny bool
Deny []string
MaxLandsPerDay *int
MaxLines *int
MaxFiles *int
MaxWorkspaces *int
}
ScopeInput changes an agent's scope. Fields left nil (or Set* false) keep their value; Clear removes every limit first.
type ServerInfo ¶ added in v0.2.0
ServerInfo is the server's version and the oldest CLI it accepts.
type Service ¶
type Service struct {
Store *store.Store
Blobs blob.Store
Upstream UpstreamSyncer // nil: repos without an upstream only
Shipper Shipper // nil: shipping disabled
// Hosts configures GitLab, Gitea, Forgejo and Bitbucket webhooks.
Hosts HostSettings
// Now overrides the clock, for tests; nil means time.Now. Read the
// time with Clock, never by calling Now.
Now func() time.Time
// MaxLandAttempts bounds compare-and-swap retries when several agents
// land into the same effort at once.
MaxLandAttempts int
// GitHub configures sign-in with GitHub and GitHub-backed repositories;
// its API is nil until a GitHub App is set up.
GitHub GitHubSettings
// ForecastTimeout bounds one background overlap forecast run; zero:
// DefaultForecastTimeout.
ForecastTimeout time.Duration
// Limits are the rate limits (sign-up here; the server applies the
// others per request); nil: none. Quotas are the organization quotas
// (quotas.go). Audit configures the operation log export (audit.go).
Limits *ratelimit.Limiter
Quotas QuotaSettings
Audit AuditSettings
// Push configures Web Push notifications (push.go).
Push PushSettings
// Agreement configures the data processing agreement step (dpa.go);
// off by default.
Agreement AgreementSettings
// Checks bound the reports of company-defined checks (checks.go).
Checks CheckSettings
// OrgDeletion configures deleting and purging organizations
// (org_delete.go, org_purge.go).
OrgDeletion OrgDeletionSettings
// contains filtered or unexported fields
}
Service holds the dependencies of the application logic.
func New ¶
New returns a Service with defaults filled in. When upstream can also ship (the git bridge can), it is used for that too.
func (*Service) AbortRebase ¶ added in v0.2.0
func (s *Service) AbortRebase(ctx context.Context, actor Actor, repoName, slug string) (RebaseView, error)
AbortRebase drops the effort's rebase in progress. The effort is left as it was; the changesets the rebase stored stay unreferenced.
func (*Service) AcceptAgreement ¶ added in v0.6.0
func (s *Service) AcceptAgreement(ctx context.Context, actor Actor, org, version, sum string) (AgreementRecord, error)
AcceptAgreement records that the calling person, an owner of org, accepts a version of the agreement: the one in effect or an announced one. sha256 is the hash of the text they were shown; a text that changed since is refused. The web UI is the only caller: acceptance is a deliberate act by a person, so there is no API or CLI for it.
func (*Service) AcceptedAgreementText ¶ added in v0.6.0
func (s *Service) AcceptedAgreementText(ctx context.Context, actor Actor, org, id string) (AgreementRecord, []byte, error)
AcceptedAgreementText returns an acceptance of org and the text exactly as it was accepted (members and superadmins).
func (*Service) AccessHelp ¶ added in v0.7.0
AccessHelp explains, for the signed-in actor, why they can read no repositories. It does not check that they read none: callers show it only when a list of readable repositories came back empty. Asking GitHub is best effort; what it cannot find out is left at its zero value.
func (*Service) AddPerson ¶ added in v0.2.0
func (s *Service) AddPerson(ctx context.Context, by *store.Principal, n NewPerson) (store.Principal, string, bool, error)
AddPerson creates a person, their personal organization and a first token, without checking who asks: CreatePerson checks, and vx-server user-add runs it with by nil. It reports whether it created n.Org.
func (*Service) AgreementNotices ¶ added in v0.6.0
AgreementNotices lists the notices for the organizations the caller (a person) owns. Agents and other members get none: they cannot accept. Personal organizations without repositories get none either: they are accepted for on first use.
func (*Service) AgreementRequired ¶ added in v0.6.0
AgreementRequired reports whether this server asks organizations to accept the data processing agreement.
func (*Service) AgreementText ¶ added in v0.6.0
func (s *Service) AgreementText(ctx context.Context, actor Actor, org, version string) (AgreementVersion, error)
AgreementText returns a published version (in effect, announced or earlier) for reading and download (members and superadmins).
func (*Service) AllowSignup ¶ added in v0.5.0
AllowSignup takes one new account from the sign-up rate of the caller's address (VX_RATE_SIGNUP). Every path that creates an account from a sign-in (GitHub, single sign-on) calls it right before creating the person; accounts site admins create are not limited. Without limits, or without a known address, it allows everything.
func (*Service) AnswerNote ¶ added in v0.2.0
func (s *Service) AnswerNote(ctx context.Context, actor Actor, questionID string, body string) (Note, Note, error)
AnswerNote answers a question (by id or an 8+ character id prefix) and returns the answer and the updated question.
func (*Service) ApplyCI ¶ added in v0.4.0
ApplyCI records a CI result on the shipments whose head is the event's commit and, when the shipment's result changes, tells the authors of its changes: on failure which checks failed, on success one short note. Each new note replaces the author's previous CI note on that pull request; a rerun with the same outcome posts nothing.
func (*Service) ApplyGitHubOrgMembership ¶ added in v0.2.0
func (s *Service) ApplyGitHubOrgMembership(ctx context.Context, githubOrgID, githubUserID int64, role string) error
ApplyGitHubOrgMembership records a membership change GitHub reported in a webhook (organization member_added, member_removed, member_invited does not count): role is admin, member or "" (not a member). It drops the person's cached answers for that organization and updates the linked vx organization. People vx does not know are ignored.
func (*Service) ApplyReview ¶ added in v0.4.0
func (s *Service) ApplyReview(ctx context.Context, ev ReviewEvent) error
ApplyReview posts a review or comment on a vx pull request as review notes: a line comment to the author of the change that wrote the line, anything else to every agent whose changes are in the pull request. A review that requests changes also adds a task for each of them. Events for pull requests vx did not open are ignored.
func (*Service) ApproveCLILogin ¶ added in v0.2.0
func (s *Service) ApproveCLILogin(ctx context.Context, actor Actor, userCode string, approve bool) error
ApproveCLILogin approves or denies a pending login by user code; approval lets the CLI collect a token for the person named after the client.
func (*Service) ApproveReview ¶ added in v0.4.0
func (s *Service) ApproveReview(ctx context.Context, actor Actor, id string) (ReviewDecision, error)
ApproveReview approves a pending review and lands it onto the current effort head with the normal merge (write; a person, see cannotDecide). The approval is recorded in the change's evidence. When the merge conflicts the review stays pending and a note asks the author to resolve and land again.
func (*Service) Ask ¶ added in v0.2.0
Ask posts a question, optionally to one principal, that escalates after its deadline.
func (*Service) Authorize ¶ added in v0.2.0
func (s *Service) Authorize(ctx context.Context, actor Actor, repo string, need RepoRole) (store.Repo, RepoRole, error)
Authorize returns the repository named repo if actor has at least need on it. A repository the actor cannot read is reported as not found, so its existence does not leak; one it can read but needs more on is a permission error (the repository and the actor's role come back with it). Agents are checked as the person they act for.
Every service function that takes a repository name calls this first. It runs one query, plus a cache lookup (and when that is stale, a call to GitHub) for GitHub-backed repositories.
func (*Service) AuthorizeID ¶ added in v0.2.0
func (s *Service) AuthorizeID(ctx context.Context, actor Actor, repoID uuid.UUID, need RepoRole) (RepoRole, error)
AuthorizeID is Authorize for a repository id (for objects, workspaces and other records that carry a repo id).
func (*Service) BackfillObjects ¶ added in v0.2.0
BackfillObjects queues every repository that has changesets but no recorded objects and backfills each queued repository, one at a time. Requests for a repository that is still queued backfill it on demand, so a long backfill of one repository does not hold up the others.
func (*Service) BackfillRepoObjects ¶ added in v0.2.0
func (s *Service) BackfillRepoObjects(ctx context.Context, repoID uuid.UUID, force bool, log *slog.Logger) (BackfillStats, error)
BackfillRepoObjects records the objects of every changeset tree in the repository. Unless force is set it does nothing for a repository that is not queued. Concurrent calls for one repository wait for each other.
func (*Service) BlobReader ¶ added in v0.2.0
func (s *Service) BlobReader(ctx context.Context, actor Actor, repoID uuid.UUID) (func(context.Context, hash.Hash) ([]byte, error), error)
BlobReader returns a function that reads file contents of the repository with id repoID, after checking once that actor can read it. The web UI and the MCP tools read blobs through it. Zero hashes read as empty.
func (*Service) Branch ¶
func (s *Service) Branch(ctx context.Context, actor Actor, repo store.Repo, name string) (store.Branch, error)
Branch returns a tracked branch, importing it first if vx does not follow it yet. This is how efforts can start from any branch on the fly. The caller has authorized actor on repo already.
func (*Service) BranchMoved ¶ added in v0.4.0
BranchMoved runs after vx imported branch of repo: it marks the efforts whose changes reached the branch merged, then rebases the open efforts on it, or tells them they need a rebase (vx.toml [automation] rebase). by names what moved the branch, for the op log ("github push"). Errors are logged: the import itself succeeded.
func (*Service) CanSealSecrets ¶ added in v0.4.0
CanSealSecrets reports whether the server has a key to keep secrets.
func (*Service) CheckAgreements ¶ added in v0.6.0
CheckAgreements is run at start with the step on: a version must be in effect, and no published text may differ from one an owner accepted under the same id (a changed text is a new version).
func (*Service) CheckArtifact ¶ added in v0.7.0
func (s *Service) CheckArtifact(ctx context.Context, actor Actor, id, name string) (store.CheckArtifact, []byte, error)
CheckArtifact returns one artifact of a result, or its log when name is empty (read).
func (*Service) CheckAuditQuery ¶ added in v0.5.0
CheckAuditQuery validates q for actor without exporting, so a web page or download can fail with a message before it starts writing.
func (*Service) CheckCLIVersion ¶ added in v0.2.0
CheckCLIVersion says whether a CLI of cliVersion works with this server, and what to tell its user. Dev builds and CLIs that send no version are always ok.
func (*Service) CheckResults ¶ added in v0.7.0
func (s *Service) CheckResults(ctx context.Context, actor Actor, repoName, effort, changeID string, tree hash.Hash) ([]store.CheckResult, error)
CheckResults lists the results bound to a change's tree (read), newest first: what pipelines read to feed one check's outputs into the next.
func (*Service) CheckRules ¶ added in v0.3.0
func (s *Service) CheckRules(ctx context.Context, r Rules, base, tree hash.Hash) ([]engine.Warning, error)
CheckRules reports violations of rules in tree, limited to the paths changed between base and tree, as warnings of kind WarningRule.
func (*Service) CheckStatus ¶ added in v0.7.0
func (s *Service) CheckStatus(ctx context.Context, actor Actor, in CheckStatusInput) (CheckStatusView, error)
CheckStatus says, for each check of a change, whether it applies and whether it is missing, pending, passed or failed on the change's tree (read).
func (*Service) Clock ¶ added in v0.7.0
Clock is the service's one clock: Now when set, else the wall clock. Every time the service stores or compares goes through it, so a test that sets Now sees one consistent time, and one that sets Now to nil still works.
func (*Service) CloseEffort ¶ added in v0.3.0
func (s *Service) CloseEffort(ctx context.Context, actor Actor, repoName, slug string, state store.EffortState) (store.Effort, error)
CloseEffort marks an effort merged or abandoned (write). Its changes and board stay readable; it can no longer be landed into, and lists, context and overlap forecasts leave it out. Closing a closed effort again with the same state changes nothing.
func (*Service) CompleteGitHubSetup ¶ added in v0.2.0
CompleteGitHubSetup exchanges the manifest code for the App's credentials and stores them encrypted (superadmins).
func (*Service) ConsoleOrgDeletionRecords ¶ added in v0.6.0
func (s *Service) ConsoleOrgDeletionRecords(ctx context.Context, handle string) ([]OrgDeletion, error)
ConsoleOrgDeletionRecords returns every deletion record of organizations that had handle, newest first, for the server's operator (vx-server org deletion-record): after the purge nobody else can see them.
func (*Service) ConsoleOrgQuota ¶ added in v0.5.0
ConsoleOrgQuota is OrgQuota from the server console (vx-server quota).
func (*Service) ConsolePurgeOrg ¶ added in v0.6.0
ConsolePurgeOrg purges a deleted organization now, before its grace period ends, for the server's operator (vx-server org purge --now): for a customer who asks for their data to go at once.
func (*Service) ConsoleSetOrgQuota ¶ added in v0.5.0
func (s *Service) ConsoleSetOrgQuota(ctx context.Context, org string, o store.OrgQuota) (QuotaUsage, error)
ConsoleSetOrgQuota is SetOrgQuota from the server console (vx-server quota), with no actor.
func (*Service) ConsoleSetSuperadmin ¶ added in v0.5.0
func (s *Service) ConsoleSetSuperadmin(ctx context.Context, handle string, on bool) (p store.Principal, changed bool, err error)
ConsoleSetSuperadmin makes the person handle a superadmin (on) or not, for vx-server superadmin grant|revoke. changed is false when they already were (or were not) one. Agents and service principals cannot be superadmins.
func (*Service) ConsoleSuperadmins ¶ added in v0.5.0
ConsoleSuperadmins lists the superadmins, by handle (vx-server superadmin list).
func (*Service) Context ¶ added in v0.2.0
func (s *Service) Context(ctx context.Context, actor Actor, repo, effort string, targets []string) (NoteContext, error)
Context returns notes on the targets, open workspaces, active claims and recent changes touching them. Without targets it returns the effort's latest notes and changes. OtherEfforts is what other open efforts of the repository do on the targets (without targets: on the files this effort changed); see otherEfforts for the rules and limits.
func (*Service) ContinueRebase ¶ added in v0.2.0
func (s *Service) ContinueRebase(ctx context.Context, actor Actor, in ContinueInput) (RebaseView, error)
ContinueRebase records the resolved tree as the stopped change's rebased version, marked as resolved by the actor, and replays the rest. It may stop again on a later change.
func (*Service) CreateAgent ¶
func (s *Service) CreateAgent(ctx context.Context, actor Actor, name, displayName string) (store.Principal, string, error)
CreateAgent creates an agent that acts for the calling human and returns it with a fresh token. Agents cannot create agents.
func (*Service) CreateCIToken ¶ added in v0.7.0
func (s *Service) CreateCIToken(ctx context.Context, actor Actor, repo, name string, checks []string) (CITokenView, string, error)
CreateCIToken creates a CI token on a repository and returns it with its secret, which is shown once. Only a person with admin on the repository may; agents never mint tokens.
func (*Service) CreateEffort ¶
func (s *Service) CreateEffort(ctx context.Context, actor Actor, in CreateEffortInput) (store.Effort, error)
CreateEffort starts an effort on the current head of its base branch (write).
func (*Service) CreateLoginCode ¶ added in v0.2.0
CreateLoginCode returns a one-time code that signs the actor in to the web UI. It expires after LoginCodeTTL and works once.
func (*Service) CreateOrg ¶ added in v0.2.0
func (s *Service) CreateOrg(ctx context.Context, actor Actor, handle, displayName string) (Org, error)
CreateOrg creates an organization owned by the calling person.
func (*Service) CreatePerson ¶ added in v0.2.0
func (s *Service) CreatePerson(ctx context.Context, actor Actor, handle, displayName, email string, siteAdmin bool, org string) (store.Principal, string, error)
CreatePerson creates a person with a first token (superadmins), optionally as a member of an organization (a superadmin may add people to any organization: that gives the new person a role, never the superadmin).
func (*Service) CreateRepo ¶
func (s *Service) CreateRepo(ctx context.Context, actor Actor, in CreateRepoInput) (store.Repo, error)
CreateRepo registers a repo. A repo with an upstream imports its default branch right away; a repo without one starts from an empty snapshot.
func (*Service) CreateTeam ¶ added in v0.2.0
CreateTeam, DeleteTeam, SetTeamMember and RemoveTeamMember manage teams (org owners and admins).
func (*Service) CreateToken ¶ added in v0.2.0
func (s *Service) CreateToken(ctx context.Context, actor Actor, agent, name string) (store.Token, store.Principal, string, error)
CreateToken issues a new token to the caller (agent empty) or to one of the caller's agents and returns it with its secret, which is shown once.
Only people can create tokens, also for themselves. Agents can list and revoke their own tokens, but if an agent could mint tokens, a leaked agent token could create replacements that survive its revocation, so revoking it would no longer contain the leak. An agent that needs a new token asks the person it acts for.
func (*Service) DataDisk ¶ added in v0.5.0
DataDisk reports the data directory's disk space for the admin pages; ok is false without a data directory or when it cannot be read.
func (*Service) DeleteOrg ¶ added in v0.6.0
func (s *Service) DeleteOrg(ctx context.Context, actor Actor, handle, confirm string) (OrgDeletion, error)
DeleteOrg deletes an organization: it is hidden at once and purged after the grace period. Only owners may, by naming its handle again in confirm; personal organizations cannot be deleted this way.
func (*Service) DeleteTeam ¶ added in v0.2.0
func (*Service) DeletedOrgs ¶ added in v0.6.0
DeletedOrgs lists the deleted organizations the caller owns that can still be restored or are being purged, soonest purge first.
func (*Service) DismissWelcome ¶ added in v0.2.0
DismissWelcome hides the welcome page from the navigation (or shows it again).
func (*Service) DropGitHubRoles ¶ added in v0.2.0
func (s *Service) DropGitHubRoles(ctx context.Context, scope GitHubRoleScope) error
DropGitHubRoles forgets cached GitHub answers in scope, so the next check asks GitHub. Webhooks call it; it never calls GitHub. An empty scope is an error, so a caller bug cannot silently keep stale roles.
func (*Service) EffortOverlaps ¶ added in v0.3.0
func (s *Service) EffortOverlaps(ctx context.Context, actor Actor, repoName, slug string) ([]Overlap, error)
EffortOverlaps returns an effort's stored forecasts that are not clean, without recomputing them (read). The web UI shows them.
func (*Service) ExportAudit ¶ added in v0.5.0
func (s *Service) ExportAudit(ctx context.Context, actor Actor, q AuditQuery, emit func(AuditRow) error) error
ExportAudit calls emit for every entry the caller may see that matches q, oldest first.
func (*Service) ForYou ¶ added in v0.5.0
ForYou returns what waits for the caller across the repositories they can read (read). Agents get their own questions and notes; their efforts are their person's.
func (*Service) ForecastOverlaps ¶ added in v0.3.0
ForecastOverlaps recomputes the forecast between effort and every other open effort of its repository with the same base branch, and posts or updates overlap notes on both boards when something changed. Called after every land and when the base branch moves; it never fails a land (errors are logged). It is internal: no actor, no access check.
func (*Service) ForecastQueueDepth ¶ added in v0.5.0
ForecastQueueDepth is how many repositories have overlap forecasts queued and not started yet, for /metrics.
func (*Service) GetAgent ¶ added in v0.4.0
GetAgent returns an agent with its scope and today's usage. An agent may read its own (agent empty); a person their agents'. Superadmins have no say over other people's agents: scopes name paths in their repositories.
func (*Service) GetAgentRunner ¶ added in v0.7.0
func (s *Service) GetAgentRunner(ctx context.Context, actor Actor, agent string) (RunnerView, error)
GetAgentRunner returns the runner kinds an agent serves. The agent itself (agent empty) and its person may read them.
func (*Service) GetChangeset ¶
func (s *Service) GetChangeset(ctx context.Context, actor Actor, repoName, ref string) (store.Repo, LogEntry, error)
GetChangeset resolves a changeset by hash, prefix or change ID (read).
func (*Service) GetCheckJob ¶ added in v0.7.0
func (s *Service) GetCheckJob(ctx context.Context, actor Actor, repo, id string) (CheckJobView, error)
GetCheckJob returns one job with its inputs. Read on its repository, or a CI token of it.
func (*Service) GetCheckResult ¶ added in v0.7.0
GetCheckResult returns one result (read).
func (*Service) GetEffort ¶
func (s *Service) GetEffort(ctx context.Context, actor Actor, repoName, slug string) (EffortView, error)
GetEffort loads an effort by repo name and slug (read), with its rebase in progress if there is one.
func (*Service) GetInbox ¶ added in v0.2.0
GetInbox returns what needs the caller's attention across efforts, in the repositories the caller can read.
func (*Service) GetNote ¶ added in v0.2.0
GetNote returns one note by id or an 8+ character id prefix.
func (*Service) GetObjects ¶ added in v0.2.0
func (s *Service) GetObjects(ctx context.Context, actor Actor, repo string, hashes []hash.Hash, maxBytes int) ([]Object, error)
GetObjects returns objects that are part of repo, in the order asked, stopping before maxBytes (but always returning at least one); the client asks again for the rest. An object that is not part of repo is not found, whether or not another repository has it.
func (*Service) GetOrg ¶ added in v0.2.0
GetOrg returns an organization the caller is a member of (or any, for superadmins, with only the repositories they can read).
func (*Service) GetOrgChecks ¶ added in v0.7.0
GetOrgChecks returns the checks in force for an organization (members and superadmins).
func (*Service) GetRebase ¶ added in v0.2.0
func (s *Service) GetRebase(ctx context.Context, actor Actor, repoName, slug string) (RebaseView, bool, error)
GetRebase returns the effort's rebase in progress, or else its latest one. Found is false when the effort was never rebased.
func (*Service) GetRepo ¶ added in v0.2.0
func (s *Service) GetRepo(ctx context.Context, actor Actor, name string) (RepoView, []store.Branch, error)
GetRepo returns a repository the caller can read, with its branches.
func (*Service) GetReview ¶ added in v0.4.0
GetReview returns one review with the files its snapshot changes (read).
func (*Service) GetRules ¶ added in v0.3.0
func (s *Service) GetRules(ctx context.Context, actor Actor, repoName, effort string) (Rules, error)
GetRules returns the vx.toml rules of a repository (read): at the head of effort when one is given, else at the head of the default branch. No vx.toml: empty Rules. A vx.toml that does not parse is an error that says where.
func (*Service) GetWorkspace ¶
func (s *Service) GetWorkspace(ctx context.Context, actor Actor, id uuid.UUID) (WorkspaceView, error)
GetWorkspace loads a workspace with its effort and repo (read).
func (*Service) GitHubApp ¶ added in v0.2.0
func (s *Service) GitHubApp(ctx context.Context) (GitHubAppInfo, error)
GitHubApp returns the server's App: ErrGitHubNotConfigured when there is none.
func (*Service) GitHubAppGaps ¶ added in v0.4.0
GitHubAppGaps lists the permissions and events this vx needs that the App lacks (superadmins): those GitHub refused, and those the App's settings on GitHub do not have.
func (*Service) GitHubAppInstallURL ¶ added in v0.2.0
GitHubAppInstallURL is where an organization installs the App; empty without an App.
func (*Service) GitHubAppManifest ¶ added in v0.2.0
GitHubAppManifest builds the manifest of this server's App.
func (*Service) GitHubClient ¶ added in v0.2.0
GitHubClient returns the API client for the server's App: ErrGitHubNotConfigured when there is none. s.GitHub.API, when set, wins (tests).
func (*Service) GitHubLinkFinish ¶ added in v0.2.0
func (s *Service) GitHubLinkFinish(ctx context.Context, actor Actor, code, verifier string) (GitHubUser, error)
GitHubLinkFinish links the GitHub account a sign-in code is for to the signed-in person, for people created with a token before GitHub sign-in.
func (*Service) GitHubLinkOf ¶ added in v0.2.0
GitHubLinkOf returns the GitHub account linked to a person; ok is false when there is none.
func (*Service) GitHubManifestFormURL ¶ added in v0.2.0
GitHubManifestFormURL is where the manifest form posts: the person's account, or org when set. state goes along and comes back.
func (*Service) GitHubRepoToken ¶ added in v0.2.0
GitHubRepoToken returns an installation token for a repository linked to an installation of the App, for git over HTTPS (user x-access-token) and API calls; "" for other repositories, which use VX_GITHUB_TOKEN or SSH. The git bridge asks for it on every fetch, push and pull request; the client caches tokens until shortly before they expire.
func (*Service) GitHubRole ¶ added in v0.2.0
func (s *Service) GitHubRole(ctx context.Context, repo store.Repo, person store.Principal) (role RepoRole, ok bool, err error)
GitHubRole returns a person's role on a GitHub-backed repository, from the cache or GitHub. ok is false when the repository is not GitHub-backed (then vx's own roles apply). Authorize calls it. An agent is checked as its person; a service principal has no GitHub role. When GitHub cannot be reached and no answer younger than an hour is cached, err is a retryable CodeUnavailable error and role is RoleNone.
func (*Service) GitHubSettingsURL ¶ added in v0.2.0
GitHubSettingsURL is where access to a GitHub-backed repository is managed on GitHub.
func (*Service) GitHubSetupManifest ¶ added in v0.2.0
func (s *Service) GitHubSetupManifest(ctx context.Context, actor Actor) (manifest []byte, state string, err error)
GitHubSetupManifest returns the App manifest (JSON) and a state value for the manifest flow (superadmins). The web page posts it to GitHub.
func (*Service) GitHubSignInAs ¶ added in v0.7.0
func (s *Service) GitHubSignInAs(ctx context.Context, u GitHubUser) (p store.Principal, token string, isNew bool, err error)
GitHubSignInAs finishes a web sign-in for a GitHub user read from a sign-in code (GitHubSignInUser), as GitHubSignInFinish does. The caller vouches that u came from GitHub: the web UI keeps it, between asking and Continue, in a cookie signed with the server key.
func (*Service) GitHubSignInEnabled ¶ added in v0.2.0
GitHubSignInEnabled reports whether people can sign in with GitHub here: the server has a GitHub App.
func (*Service) GitHubSignInFinish ¶ added in v0.2.0
func (s *Service) GitHubSignInFinish(ctx context.Context, code, verifier string) (p store.Principal, token string, isNew bool, err error)
GitHubSignInFinish completes a web sign-in: it links or creates the person (per the signup mode), syncs their organizations, and returns the person and a new web-session token. isNew is true on first sign-in. The web UI asks before creating an account (GitHubSignInUser, GitHubSignupNeedsConfirm, GitHubSignInAs); this does all in one step.
func (*Service) GitHubSignInStart ¶ added in v0.2.0
func (s *Service) GitHubSignInStart(ctx context.Context, next string) (authorizeURL, state, verifier string, err error)
GitHubSignInStart returns the GitHub authorize URL for a web sign-in and the state and PKCE verifier the web layer keeps in a short-lived cookie. next is kept by the web layer too; it is not sent to GitHub.
func (*Service) GitHubSignInUser ¶ added in v0.7.0
GitHubSignInUser exchanges a web sign-in code and returns the GitHub user it is for, without signing anyone in.
func (*Service) GitHubSignupNeedsConfirm ¶ added in v0.7.0
GitHubSignupNeedsConfirm reports whether signing in as u would create a new vx account nobody arranged: u has no vx person yet, the signup mode lets them create one, and no invite names them. The web UI then asks "create a new account for GitHub LOGIN?" first, because a browser logged in to a second GitHub account would otherwise get a second, empty vx account. A sign-up that would be refused returns that error now, so the person is not asked about an account they cannot get. It takes nothing from the sign-up rate limit; creating the account does.
func (*Service) GitHubWebURL ¶ added in v0.2.0
GitHubWebURL is GitHub's browser base URL (github.com or GHE).
func (*Service) GrantRepo ¶ added in v0.2.0
func (s *Service) GrantRepo(ctx context.Context, actor Actor, repo, subject string, role RepoRole) (RepoGrant, error)
GrantRepo gives a person or team a role on a repository (repo admins). On a GitHub-backed repository only service principals can be granted: people's roles come from GitHub.
func (*Service) GrantSupport ¶ added in v0.5.0
func (s *Service) GrantSupport(ctx context.Context, actor Actor, in SupportInput) (SupportGrant, error)
GrantSupport gives a superadmin support access to a repository (repository admins). Granting again replaces the earlier grant.
func (*Service) HandleGitHubWebhook ¶ added in v0.2.0
func (s *Service) HandleGitHubWebhook(ctx context.Context, event, deliveryID, signature string, body []byte) error
HandleGitHubWebhook verifies and applies a webhook delivery: installations, repositories, membership and permission changes.
func (*Service) HandleHostWebhook ¶ added in v0.4.0
HandleHostWebhook verifies and applies a delivery from GitLab (kind gitlab), Gitea or Forgejo (gitea, forgejo: both accept either) or Bitbucket (bitbucket). A delivery is applied to every vx repository that follows its upstream and whose secret (its own, else the server's for the host) verifies it.
func (*Service) HostRepoToken ¶ added in v0.4.0
HostRepoToken returns the token vx keeps for a GitLab, Gitea, Forgejo or Bitbucket repository, or "" when it has none (the server's token for its host applies). The git bridge calls it; nothing logs the result.
func (*Service) HumanChecksFor ¶ added in v0.7.0
HumanChecksFor lists the human jobs waiting for actor: queued ones (and those actor holds) in repositories actor can write whose result actor may report (never their own change of an independent or human check). Agents and services get none.
func (*Service) HumanJobs ¶ added in v0.7.0
HumanJobs returns the pending human jobs of the repositories actor can write, for the For you page; nil for agents and services.
func (*Service) Info ¶ added in v0.2.0
func (s *Service) Info(ctx context.Context) ServerInfo
Info describes this server.
func (*Service) InstallCommand ¶ added in v0.2.0
InstallCommand is the one-liner that installs vx from the server at baseURL (PublicURL wins when set).
func (*Service) InviteGitHubLogin ¶ added in v0.2.0
func (s *Service) InviteGitHubLogin(ctx context.Context, by *store.Principal, login, note string, siteAdmin bool) (store.SignupInvite, error)
InviteGitHubLogin invites a GitHub login on behalf of by (nil: the server console, vx-server invite). siteAdmin makes the person a superadmin when they sign up; only the console can ask for that.
func (*Service) InviteGitHubUser ¶ added in v0.2.0
InviteGitHubUser allows a GitHub login to sign up while sign-up is invite-only (superadmins).
func (*Service) IsSuperadmin ¶ added in v0.5.0
IsSuperadmin reports whether actor (or, for agents, its person) is a superadmin (principals.site_admin): someone who runs the server through the admin panel. It gives no role on any repository. It reads the database, so a change applies at once.
func (*Service) Land ¶
Land merges a workspace snapshot into its effort (write).
When the effort has not moved since the snapshot's base, the snapshot becomes the new head. When it has, the snapshot is merged onto the current head with a three-way merge, and only real conflicts are sent back. The head moves with a compare-and-swap, so concurrent lands never lose work: the loser merges again on the new head and retries.
func (*Service) ListAgents ¶ added in v0.2.0
ListAgents returns the agents acting for the calling person.
func (*Service) ListCITokens ¶ added in v0.7.0
func (s *Service) ListCITokens(ctx context.Context, actor Actor, repo string, withRevoked bool) ([]CITokenView, error)
ListCITokens lists a repository's CI tokens (revoked ones too with withRevoked). Repository admins only.
func (*Service) ListCheckJobs ¶ added in v0.7.0
func (s *Service) ListCheckJobs(ctx context.Context, actor Actor, in ListJobsInput) ([]CheckJobView, error)
ListCheckJobs lists a repository's (or effort's) jobs, pending first. Read on the repository, or a CI token of it; without a repository, every repository the caller can read.
func (*Service) ListClaims ¶ added in v0.2.0
func (s *Service) ListClaims(ctx context.Context, actor Actor, repo, effort string, targets []string) ([]Claim, error)
ListClaims returns the active claims of an effort, optionally only those matching targets (TargetsMatch).
func (*Service) ListEfforts ¶
func (s *Service) ListEfforts(ctx context.Context, actor Actor, repoName string, state store.EffortState) (store.Repo, []store.Effort, error)
ListEfforts lists a repo's efforts (read).
func (*Service) ListGitHubInvites ¶ added in v0.2.0
func (s *Service) ListGitHubInvites(ctx context.Context, actor Actor, all bool) ([]store.SignupInvite, error)
ListGitHubInvites lists invites (superadmins): open ones, or all.
func (*Service) ListOrgs ¶ added in v0.2.0
ListOrgs lists the caller's organizations, or all of them for superadmins with all set.
func (*Service) ListOverlaps ¶ added in v0.3.0
func (s *Service) ListOverlaps(ctx context.Context, actor Actor, repoName, effort string) ([]Overlap, error)
ListOverlaps returns the stored forecasts of an effort (read), or of every pair in the repository when effort is empty. A forecast older than the efforts' heads or the branch head is recomputed first, within a short time limit; past it the stored one is returned.
func (*Service) ListPeople ¶ added in v0.2.0
ListPeople lists every person on the server (superadmins).
func (*Service) ListRepos ¶ added in v0.2.0
ListRepos lists the repositories the caller can read, with the caller's role on each.
func (*Service) ListReservations ¶ added in v0.3.0
func (s *Service) ListReservations(ctx context.Context, actor Actor, repoName, rule string) ([]Reservation, error)
ListReservations lists the values vx reserve handed out in a repository (read), newest first; rule narrows it to one [unique] rule.
func (*Service) ListReviews ¶ added in v0.4.0
ListReviews returns reviews in the repositories the caller can read (read), newest first: pending ones unless States says otherwise.
func (*Service) ListShipments ¶
func (s *Service) ListShipments(ctx context.Context, actor Actor, repoName, slug string) ([]store.Shipment, error)
ListShipments returns an effort's shipments (read).
func (*Service) ListSupport ¶ added in v0.5.0
func (s *Service) ListSupport(ctx context.Context, actor Actor, repo string) ([]SupportGrant, error)
ListSupport lists a repository's support access in effect (repository admins).
func (*Service) ListTasks ¶ added in v0.2.0
ListTasks lists an effort's tasks: not done first, then by creation.
func (*Service) ListTokens ¶ added in v0.2.0
func (s *Service) ListTokens(ctx context.Context, actor Actor, agent string) (store.Principal, []store.Token, error)
ListTokens returns the tokens of the caller (agent empty) or of one of the caller's agents, given by name ("backend") or handle ("alice/backend").
func (*Service) LoadGitHubApp ¶ added in v0.2.0
LoadGitHubApp loads the App at server start. No App is not an error; an App the server cannot open (no or another VX_SECRET_KEY) is.
func (*Service) Log ¶
func (s *Service) Log(ctx context.Context, actor Actor, repoName, slug string, limit int, withFiles bool) ([]LogEntry, error)
Log lists changes landed in an effort since its base, newest first (read).
func (*Service) LogUpgradeNotices ¶ added in v0.5.0
LogUpgradeNotices logs each open upgrade notice once, at server start.
func (*Service) MakeClaim ¶ added in v0.2.0
func (s *Service) MakeClaim(ctx context.Context, actor Actor, in ClaimInput) (Claim, []Claim, error)
MakeClaim records a claim and returns it with the active claims of others on the same targets. It never fails because of them.
func (*Service) MarkNotesRead ¶ added in v0.3.0
MarkNotesRead records that actor was shown notes. Notes in repositories the caller cannot read, and ids of no note, are skipped silently, so the call never tells whether a note exists.
func (*Service) MergePeople ¶ added in v0.5.0
func (s *Service) MergePeople(ctx context.Context, actor Actor, keepRef, mergedRef string) (MergeResult, error)
MergePeople merges the person merged into keep (superadmins only): tokens, agents, organization and team memberships, repository grants, single sign-on identities and (when keep has none) the GitHub link move to keep, the higher role winning where both had one. Authorship stays: changes keep naming the merged person and their agents, whose handles do not change. The merged person is disabled and the merge recorded in the operation log (person.merge).
A superadmin never merges their own account, in either direction: through the admin path that would hand them a customer's repository roles, or hand theirs to a customer.
func (*Service) MissingObjects ¶ added in v0.2.0
func (s *Service) MissingObjects(ctx context.Context, actor Actor, repo string, hashes []hash.Hash) ([]hash.Hash, error)
MissingObjects returns the hashes that are not part of repo yet, which the client then uploads. An object stored only for another repository is missing here: uploading it again costs little, because storage dedupes, and proves the uploader has the bytes.
func (*Service) MyGitHubInstallations ¶ added in v0.2.0
func (s *Service) MyGitHubInstallations(ctx context.Context, actor Actor) ([]GitHubInstallation, error)
MyGitHubInstallations lists the installations of the App on the actor's own GitHub account and on GitHub organizations GitHub says they are a member of. It is empty for people without a GitHub link.
func (*Service) NextCheckJob ¶ added in v0.7.0
func (s *Service) NextCheckJob(ctx context.Context, actor Actor, in NextJobInput) (*CheckJobView, error)
NextCheckJob gives the caller the oldest queued job it may run, with a lease for the check's timeout, and its inputs; nil when there is none. Expired leases are put back (or failed) first.
func (*Service) NotifyPush ¶ added in v0.5.0
NotifyPush runs one round of the notifier: for each person with notifications on, it pushes what is new since they turned them on. It returns how many notifications went out.
func (*Service) ObjectSizesPending ¶ added in v0.5.0
ObjectSizesPending counts objects of repositories whose size is not recorded yet; they count 0 bytes toward quotas until it is.
func (*Service) OpenShipment ¶
OpenShipment pushes the planned commits to vx/<effort> and opens or updates the pull request. Shipping again replaces the branch and updates the same PR. vx never merges: that stays a decision on the git host. PlanShipment checks admin on the repository.
func (*Service) OpenWorkspace ¶
func (s *Service) OpenWorkspace(ctx context.Context, actor Actor, repoName, slug, intent string) (WorkspaceView, error)
OpenWorkspace starts a task in an effort, based on the effort's head (write).
func (*Service) OrgAgreement ¶ added in v0.6.0
OrgAgreement returns an organization's agreement status (members of the organization and superadmins; anyone else gets not found). With the step off, only Required (false) is set.
func (*Service) OrgCheckHistory ¶ added in v0.7.0
func (s *Service) OrgCheckHistory(ctx context.Context, actor Actor, org string) ([]OrgChecks, error)
OrgCheckHistory lists every saved version of an organization's checks, newest first (members and superadmins).
func (*Service) OrgDeletionRecord ¶ added in v0.6.0
func (s *Service) OrgDeletionRecord(ctx context.Context, actor Actor, handle string) (OrgDeletion, error)
OrgDeletionRecord returns the deletion record of a deleted organization the caller owns, before its purge.
func (*Service) OrgQuota ¶ added in v0.5.0
OrgQuota returns an organization's quotas and usage, for its members and superadmins.
func (*Service) OrgSSO ¶ added in v0.5.0
OrgSSO returns an organization's single sign-on for its members; ok is false when it has none.
func (*Service) OverlapCounts ¶ added in v0.3.0
func (s *Service) OverlapCounts(ctx context.Context, actor Actor, repoName string) (map[uuid.UUID][2]int, error)
OverlapCounts returns, for each open effort of a repository the actor can read, how many other efforts it overlaps with and how many of those conflict (read). The web UI shows them as badges.
func (*Service) PeekLoginCode ¶ added in v0.2.0
PeekLoginCode tells who a code would sign in, without using it up.
func (*Service) PendingCLILogin ¶ added in v0.2.0
func (s *Service) PendingCLILogin(ctx context.Context, actor Actor, userCode string) (clientName string, expires time.Time, err error)
PendingCLILogin returns the client name of a pending login by user code, for the approval page (signed-in people only).
func (*Service) PersonIdentities ¶ added in v0.5.0
PersonIdentities lists the single sign-on identities of the actor's person, for the settings page.
func (*Service) PipelineStatus ¶ added in v0.7.0
func (s *Service) PipelineStatus(ctx context.Context, actor Actor, in CheckStatusInput) (PipelineView, error)
PipelineStatus is CheckStatus with every check placed in its pipeline (read, as CheckStatus: CI tokens of the repository too): in dependency order, indented under the check it runs after, with where it comes from and why it waits or was skipped. The notes say when the change edits vx.toml itself: the checks of the effort's base apply until it lands.
func (*Service) PlanShipment ¶
func (s *Service) PlanShipment(ctx context.Context, actor Actor, repoName, slug, target string) (ShipPlan, error)
PlanShipment replays the effort's changes, oldest first, onto the latest head of the target branch. Each change becomes one commit. A change whose parent is not the current tree is merged onto it, so an effort started on an older commit, or on another branch, still ships cleanly. Shipping needs admin on the repository.
func (*Service) PlanSplit ¶ added in v0.4.0
PlanSplit plans shipping an effort as several pull requests (admin). The plan's Groups hold the parts; Problems say why the split cannot ship as grouped (OpenShipment refuses it then). The whole-effort fields of the plan (Steps, Conflicts, Warnings) are those of PlanShipment.
func (*Service) PollCLILogin ¶ added in v0.2.0
func (s *Service) PollCLILogin(ctx context.Context, deviceCode string) (status, token string, p store.Principal, err error)
PollCLILogin returns the state of a login; on approval it returns the new token exactly once. Later polls return CLILoginUsed. Polling faster than the interval returns CLILoginSlowDown while the login is pending.
func (*Service) PostNote ¶ added in v0.2.0
PostNote adds a plan, decision, interface, blocker or handoff note.
func (*Service) PruneAudit ¶ added in v0.5.0
PruneAudit deletes operation log entries older than the retention and returns how many. Without a retention it does nothing.
func (*Service) PruneAuditLoop ¶ added in v0.5.0
PruneAuditLoop prunes once an hour until ctx ends.
func (*Service) PurgeDueOrgs ¶ added in v0.6.0
PurgeDueOrgs purges every deleted organization whose grace period ended (and finishes purges that stopped), if no other server is purging.
func (*Service) PushAvailable ¶ added in v0.5.0
PushAvailable reports whether this server can send notifications: it needs VX_SECRET_KEY to keep its VAPID key.
func (*Service) PushPublicKey ¶ added in v0.5.0
PushPublicKey is the key browsers subscribe with (applicationServerKey).
func (*Service) PushSubscriptions ¶ added in v0.5.0
func (s *Service) PushSubscriptions(ctx context.Context, actor Actor) ([]store.PushSubscription, error)
PushSubscriptions lists the browsers the caller gets notifications in.
func (*Service) PutObjects ¶ added in v0.2.0
func (s *Service) PutObjects(ctx context.Context, actor Actor, repo string, objs []Object) ([]hash.Hash, error)
PutObjects stores objects and records them as part of repo. The caller needs write access. The server hashes the bytes it receives, so an object only becomes part of a repository when its content was sent.
func (*Service) ReadBlob ¶ added in v0.2.0
func (s *Service) ReadBlob(ctx context.Context, actor Actor, repoID uuid.UUID, h hash.Hash) ([]byte, error)
ReadBlob reads one file's contents from a repository actor can read.
func (*Service) ReadableRepoIDs ¶ added in v0.2.0
func (s *Service) ReadableRepoIDs(ctx context.Context, actor Actor) (ids []uuid.UUID, all bool, err error)
ReadableRepoIDs returns the ids of every repository actor can read, for filtering lists. all would mean every repository; nobody has that any more (superadmins have no implicit role), so it is always false, and callers keep handling it.
func (*Service) ReadableRepos ¶ added in v0.2.0
func (s *Service) ReadableRepos(ctx context.Context, actor Actor, org *uuid.UUID) ([]store.Repo, []RepoRole, error)
ReadableRepos lists the repositories actor can read, by name, with its role on each, in one query. org limits it to one organization's repositories; nil lists them all.
func (*Service) RebaseEffort ¶ added in v0.2.0
func (s *Service) RebaseEffort(ctx context.Context, actor Actor, repoName, slug, onto string) (RebaseView, error)
RebaseEffort replays the effort's changes, oldest first, onto the latest head of onto (default: the effort's base branch), after importing that branch's new commits. Each change is three-way merged onto the rebased chain so far with the same rules as a land, and keeps its change id, intent, author and evidence; it is marked as rebased. The effort head moves only when every change replayed, with a compare-and-swap; changes landed meanwhile are replayed too. When a change conflicts the rebase stops and waits for ContinueRebase or AbortRebase.
func (*Service) RedeemLoginCode ¶ added in v0.2.0
func (s *Service) RedeemLoginCode(ctx context.Context, code string) (store.Principal, string, error)
RedeemLoginCode uses up a code and issues a new token for its principal, to be kept in the browser's session cookie.
func (*Service) RejectReview ¶ added in v0.4.0
func (s *Service) RejectReview(ctx context.Context, actor Actor, id, reason string) (ReviewDecision, error)
RejectReview rejects a pending review with a reason (write; a person, see cannotDecide). The author's workspace stays open: they change the files and land again, which opens a new review, or abandon it.
func (*Service) ReleaseCheckJob ¶ added in v0.7.0
func (s *Service) ReleaseCheckJob(ctx context.Context, actor Actor, repo, id, reason string) (CheckJobView, error)
ReleaseCheckJob gives the caller's leased job back to the queue without counting an attempt, with a reason others see.
func (*Service) ReleaseClaims ¶ added in v0.2.0
func (s *Service) ReleaseClaims(ctx context.Context, actor Actor, id, workspaceID string) ([]Claim, error)
ReleaseClaims ends one claim (id or prefix) or all of the caller's claims for a workspace, and returns what it released.
func (*Service) RemoveMember ¶ added in v0.2.0
RemoveMember removes a person from an organization and its teams.
func (*Service) RemoveOrgSSO ¶ added in v0.5.0
RemoveOrgSSO turns an organization's single sign-on off (owners). Linked identities stay, so turning it on again keeps people's accounts.
func (*Service) RemoveTeamMember ¶ added in v0.2.0
func (*Service) RenewCheckJob ¶ added in v0.7.0
func (s *Service) RenewCheckJob(ctx context.Context, actor Actor, repo, id string, d time.Duration) (CheckJobView, error)
RenewCheckJob extends the caller's lease on a job by d (0: the check's timeout), counted from now.
func (*Service) RepoAccess ¶ added in v0.2.0
func (s *Service) RepoAccess(ctx context.Context, actor Actor, repo string) ([]RepoGrant, []AccessEntry, error)
RepoAccess lists a repository's direct grants and everyone's effective role (repo admins).
func (*Service) RepoOrgChecks ¶ added in v0.7.0
func (s *Service) RepoOrgChecks(ctx context.Context, actor Actor, repoName string) (OrgChecks, error)
RepoOrgChecks returns the organization checks that apply to a repository (read on the repository: its readers see what it is held to without being members of the organization).
func (*Service) RepoRoleOf ¶ added in v0.2.0
RepoRoleOf returns actor's role on r without checking anything, for filling my_role in responses. It is RoleNone when the actor cannot read r.
func (*Service) ReportChanges ¶ added in v0.3.0
func (s *Service) ReportChanges(ctx context.Context, actor Actor, workspaceID uuid.UUID, paths []string) error
ReportChanges records the files the caller's open workspace has changed locally (write). vx status, vx sync, vx claim and vx wait send them.
func (*Service) ReportCheck ¶ added in v0.7.0
func (s *Service) ReportCheck(ctx context.Context, actor Actor, in ReportInput) (CheckResult, error)
ReportCheck stores one result of a check (write): bound to the change and the tree in, with its log, artifacts and data as objects of the repository.
func (*Service) ReporterCounts ¶ added in v0.7.0
func (s *Service) ReporterCounts(ctx context.Context, actor Actor, rule string, allowSamePerson bool, author ChangeAuthor) (bool, string, error)
ReporterCounts is the hook the result store calls when a result is reported: whether actor's result of a check (its reporter rule and allow_same_person) on a change made by author counts, and when not, why. The result is stored either way.
func (*Service) RequestCheck ¶ added in v0.7.0
func (s *Service) RequestCheck(ctx context.Context, actor Actor, in RequestCheckInput) (CheckJobView, error)
RequestCheck makes a job for a check that has a runner, on the effort's head or one change, whatever the check's when. Values are named inputs (preview_url). Asking again for the same tree merges the values into the pending job. Needs write.
func (*Service) Reserve ¶ added in v0.3.0
func (s *Service) Reserve(ctx context.Context, actor Actor, repoName, effort, rule string) (value, example string, err error)
Reserve hands out the next free value of a unique rule (write): one more than the largest key used in the head of the effort's target branch, in the head of any open effort of the repository, or reserved before, formatted like the existing keys (same zero padding). The value is recorded in rule_reservations, whose primary key makes concurrent calls get different values: the loser computes again. example is a file name to use, like "internal/store/migrations/017_<name>.sql".
func (*Service) ResolveActor ¶
ResolveActor loads the parent of an agent principal.
func (*Service) ResolveSuperadminReview ¶ added in v0.5.0
ResolveSuperadminReview marks the upgrade review done (superadmins, people only). It is recorded in the operation log.
func (*Service) RestoreOrg ¶ added in v0.6.0
RestoreOrg brings a deleted organization back, unchanged, while its grace period lasts. Only its owners may.
func (*Service) RevokeCIToken ¶ added in v0.7.0
func (s *Service) RevokeCIToken(ctx context.Context, actor Actor, repo, name string) (CITokenView, error)
RevokeCIToken revokes a repository's CI token by name, with its token. Repository admins only (people and their agents).
func (*Service) RevokeRepo ¶ added in v0.2.0
RevokeRepo removes a direct grant (repo admins). It also works on GitHub-backed repositories, to clean up grants made before the repository was linked (they have no effect there).
func (*Service) RevokeSupport ¶ added in v0.5.0
RevokeSupport ends a superadmin's support access to a repository: its admins may, and so may the superadmin for their own.
func (*Service) RevokeToken ¶ added in v0.2.0
func (s *Service) RevokeToken(ctx context.Context, actor Actor, in RevokeInput) (store.Token, store.Principal, bool, error)
RevokeToken revokes one of the caller's tokens or one of their agents'. It returns the token and whether it was already revoked.
func (*Service) RulesAt ¶ added in v0.3.0
RulesAt returns the rules in vx.toml at the root of tree (none: empty Rules, no error).
func (*Service) RunObjectSizer ¶ added in v0.5.0
RunObjectSizer records object sizes until ctx ends: queued objects as they come, and a full pass at start and every SizeScanInterval.
func (*Service) RunOrgPurger ¶ added in v0.6.0
RunOrgPurger purges deleted organizations whose grace period ended, and removes git mirrors of purged repositories, until ctx ends.
func (*Service) RunPushNotifier ¶ added in v0.5.0
RunPushNotifier runs NotifyPush every PushSettings.Every until ctx ends. Without VX_SECRET_KEY there is nothing to sign with, and it returns.
func (*Service) SSOAvailable ¶ added in v0.5.0
SSOAvailable reports whether any organization here signs in with single sign-on, for the sign-in page.
func (*Service) SSOCallbackURL ¶ added in v0.5.0
SSOCallbackURL is the redirect URI to register with identity providers.
func (*Service) SSOOrgFor ¶ added in v0.5.0
SSOOrgFor finds the organization a person means on the sign-in page: an organization handle, or a work email whose domain one organization's single sign-on allows.
func (*Service) SSOSignInFinish ¶ added in v0.5.0
SSOSignInFinish completes a sign-in through org's provider: it exchanges the code, verifies the ID token, uses up its nonce, checks the email rules, finds, connects or creates the person, makes them a member of the organization, and returns a web session marked as signed in through it.
func (*Service) SSOSignInStart ¶ added in v0.5.0
SSOSignInStart begins signing in through org's provider.
func (*Service) SaveGitHubApp ¶ added in v0.2.0
func (s *Service) SaveGitHubApp(ctx context.Context, creds GitHubAppCredentials, createdBy *uuid.UUID) error
SaveGitHubApp stores the App's credentials sealed with the server key and starts using them. CompleteGitHubSetup calls it; tests too.
func (*Service) SetAgentRunner ¶ added in v0.7.0
func (s *Service) SetAgentRunner(ctx context.Context, actor Actor, agent string, kinds []string) (RunnerView, error)
SetAgentRunner sets the runner kinds an agent serves; none stops it from taking agent jobs. Only the agent's person may, never an agent (not even for itself) and never a superadmin for someone else's agent.
func (*Service) SetAgentScope ¶ added in v0.4.0
func (s *Service) SetAgentScope(ctx context.Context, actor Actor, agent string, in ScopeInput) (AgentView, error)
SetAgentScope changes an agent's path scope and budgets. Only the agent's person may; an agent cannot change any scope, not even its own, or a scope would limit nothing. Superadmins cannot: scopes name paths in other people's repositories.
func (*Service) SetBase ¶
func (s *Service) SetBase(ctx context.Context, actor Actor, id uuid.UUID, base hash.Hash) (WorkspaceView, error)
SetBase records that the workspace's files now sit on base, which must be on the effort's chain (write).
func (*Service) SetMember ¶ added in v0.2.0
func (s *Service) SetMember(ctx context.Context, actor Actor, org, person string, role OrgRole) (Membership, error)
SetMember adds a person to an organization or changes their role. Owners and admins may; only owners make owners; the last owner stays.
func (*Service) SetOrgChecks ¶ added in v0.7.0
func (s *Service) SetOrgChecks(ctx context.Context, actor Actor, org, source string) (out OrgChecks, changed bool, err error)
SetOrgChecks saves a new version of an organization's checks (owners and admins, people only: an agent changes a repository's checks by landing vx.toml, never the organization's). An empty source removes every organization check; that is a version too. Saving the same source again changes nothing and returns the version in force, with changed false.
func (*Service) SetOrgQuota ¶ added in v0.5.0
func (s *Service) SetOrgQuota(ctx context.Context, actor Actor, org string, o store.OrgQuota) (QuotaUsage, error)
SetOrgQuota replaces an organization's override (superadmins only). A nil field goes back to the server's default; 0 means no limit.
func (*Service) SetOrgSSO ¶ added in v0.5.0
func (s *Service) SetOrgSSO(ctx context.Context, actor Actor, org string, in SSOConfigInput) (SSOConfig, error)
SetOrgSSO saves an organization's single sign-on (owners). vx reads the provider's discovery document first, so a mistyped issuer fails here and not at the next sign-in. Requiring single sign-on needs the owner to have signed in through it once, so they know it works.
func (*Service) SetRepoHost ¶ added in v0.4.0
func (s *Service) SetRepoHost(ctx context.Context, actor Actor, in SetRepoHostInput) (HostHook, error)
SetRepoHost sets the token of a GitLab, Gitea, Forgejo or Bitbucket repository or makes a new webhook secret for it (admin), and says how to register the webhook.
func (*Service) SetTeamMember ¶ added in v0.2.0
func (*Service) ShipmentsCI ¶ added in v0.4.0
func (s *Service) ShipmentsCI(ctx context.Context, actor Actor, repoName, slug string) (map[uuid.UUID]ShipmentCIView, error)
ShipmentsCI returns the CI results of an effort's shipments (read), by shipment id; shipments without a CI result are missing.
func (*Service) ShowWelcome ¶ added in v0.2.0
ShowWelcome reports whether the welcome page is still linked from the navigation for actor's person.
func (*Service) SignupModeOrDefault ¶ added in v0.2.0
func (s *Service) SignupModeOrDefault() SignupMode
SignupModeOrDefault is the signup mode in effect: invite unless set.
func (*Service) SizeAllObjects ¶ added in v0.5.0
SizeAllObjects records sizes for every object of any repository that has none yet, in batches, and returns how many it recorded.
func (*Service) StartCLILogin ¶ added in v0.2.0
StartCLILogin begins a browser login for a CLI (no token needed).
func (*Service) SubscribePush ¶ added in v0.5.0
func (s *Service) SubscribePush(ctx context.Context, actor Actor, in PushSubscribeInput) (store.PushSubscription, error)
SubscribePush turns notifications on for the caller in one browser.
func (*Service) SuperadminReviewPending ¶ added in v0.5.0
SuperadminReviewPending reports whether the admin panel should show the upgrade review banner to actor: a superadmin, with the notice open.
func (*Service) SweepMirrors ¶ added in v0.6.0
SweepMirrors removes this server's git mirrors of repositories that no longer exist (purged here or by another server), and returns how many.
func (*Service) SyncBranch ¶
func (s *Service) SyncBranch(ctx context.Context, actor Actor, repoName, branch string) (store.Branch, int, error)
SyncBranch imports the latest commits of an upstream branch (write). For repos without an upstream it returns the branch as it is.
func (*Service) SyncGitHubAccount ¶ added in v0.2.0
SyncGitHubAccount syncs the installations on a GitHub account that have no vx organization yet: call it when the person of a GitHub user account signs in for the first time, so their personal installation comes in.
func (*Service) SyncGitHubOrgs ¶ added in v0.2.0
SyncGitHubOrgs refreshes a person's memberships in every GitHub organization with an installation of the App, and so in the linked vx organizations, and drops their cached roles. Web sign-in calls it. It asks GitHub once per organization installation.
func (*Service) SyncInstallation ¶ added in v0.2.0
SyncInstallation reads an installation's account and repositories from GitHub and creates or updates the matching vx organization and repos.
An installation of a deleted organization (#40) is left alone: syncing stops at the deletion, a restore brings it back as it was, and the purge drops the link.
func (*Service) TestPush ¶ added in v0.5.0
TestPush sends a test notification to one of the caller's browsers.
func (*Service) Token ¶ added in v0.2.0
func (s *Service) Token(ctx context.Context, actor Actor, id string) (store.Token, store.Principal, error)
Token returns a token the caller may manage, by id or unique prefix, with its owner. It changes nothing; use it to show what RevokeToken would do.
func (*Service) TokenCreateTarget ¶ added in v0.2.0
func (s *Service) TokenCreateTarget(ctx context.Context, actor Actor, agent string) (store.Principal, error)
TokenCreateTarget returns who CreateToken would create a token for, or why the caller may not. It changes nothing.
func (*Service) UnsubscribePush ¶ added in v0.5.0
UnsubscribePush turns notifications off for one of the caller's browsers. Turning off one that is not there is not an error.
func (*Service) UpdateOrg ¶ added in v0.2.0
func (s *Service) UpdateOrg(ctx context.Context, actor Actor, handle, displayName string, defaultRole *RepoRole) (Org, error)
UpdateOrg changes an organization's display name or default repository role (owners and admins). Empty values are unchanged.
func (*Service) UpdateTask ¶ added in v0.2.0
func (s *Service) UpdateTask(ctx context.Context, actor Actor, in UpdateTaskInput) (Task, []Task, error)
UpdateTask applies an action to a task and returns it, plus the tasks a done unblocked.
func (*Service) WaitForecasts ¶ added in v0.3.0
func (s *Service) WaitForecasts()
WaitForecasts blocks until the background forecasts queued so far have finished. Servers call it on shutdown; tests call it before looking.
func (*Service) WithdrawGitHubInvite ¶ added in v0.2.0
WithdrawGitHubInvite deletes an open invite (superadmins).
type SetRepoHostInput ¶ added in v0.4.0
type SetRepoHostInput struct {
Repo string
// Token replaces the repository's token; "" removes it (the server's
// token for the host applies again). nil: unchanged.
Token *string
// RotateWebhookSecret makes a new webhook secret and returns it once.
RotateWebhookSecret bool
}
SetRepoHostInput changes how vx reaches a repository's host.
type ShipGroup ¶ added in v0.4.0
type ShipGroup struct {
Part int // 1-based
Name string // from the intents, e.g. "add-limiter-middleware"
Title string // pull request title
Branch string // vx/<effort>/<n>-<name>
Base string // the target branch, or the previous part's branch (stacked)
Steps []ShipStep
Files []string // paths the part changes on its base
// Why says why changes share this part: a common file, depends_on.
Why []string
Tree hash.Hash // tree after the part, on top of its base
Conflicts []engine.Conflict
ConflictedAt *store.ChangesetRow
// Problem says why the part cannot ship as grouped; empty: it can.
Problem string
Warnings []engine.Warning
Body string
// Previous is the shipment this part updates, when shipped before.
Previous *store.Shipment
}
ShipGroup is one part of a split: one branch and one pull request.
type ShipInput ¶
type ShipInput struct {
Repo, Effort, Target string
Title, Body string // empty: generated
Draft bool
// Split ships one pull request per part (PlanSplit); Groups is a
// person's grouping, empty for vx's.
Split SplitMode
Groups [][]string
}
ShipInput controls OpenShipment.
type ShipPlan ¶
type ShipPlan struct {
Repo store.Repo
Effort store.Effort
Target string
TargetHead store.ChangesetRow
Branch string
Title string
Body string
Steps []ShipStep
Conflicts []engine.Conflict
ConflictedAt *store.ChangesetRow
// Warnings are problems found in the tree that would ship, checked over
// every path the effort changes on the target. They do not stop a ship.
Warnings []engine.Warning
// A split (PlanSplit) ships Groups, one pull request each.
Split SplitMode
Groups []ShipGroup
// Suggested: vx chose the grouping (not a person).
Suggested bool
// Problems say why the split cannot ship as grouped.
Problems []string
// Notes are things to know that do not stop the split.
Notes []string
// Stale are open parts of an earlier split that this one no longer
// has: shipping stops updating them.
Stale []store.Shipment
}
ShipPlan is what shipping an effort would produce.
type ShipResult ¶
type ShipResult struct {
Plan ShipPlan
Shipment store.Shipment // the first part of a split
PR provider.OpenedPR
Parts []ShipPart // a split's parts, in order
}
ShipResult is a pushed branch and, where the provider has them, its PR.
type ShipStep ¶
type ShipStep struct {
Changeset store.ChangesetRow
Tree hash.Hash // tree after this step, on top of the target
Files int // files this step changes on the target
Skipped bool // the target already has this change
}
ShipStep is one landed change replayed onto the target.
type ShipmentCIView ¶ added in v0.4.0
type ShipmentCIView struct {
State string // "", pending, passed, failed
HeadSHA string
Checks []store.ShipmentCheck
Failed []store.ShipmentCheck
}
ShipmentCIView is what vx ship list, vx status and the web ship page show about a shipment's CI.
func (ShipmentCIView) Line ¶ added in v0.4.0
func (v ShipmentCIView) Line() string
Line is "CI: passed", "CI: failed (go test, https://...)" or "".
type Shipper ¶
type Shipper interface {
ExportBranch(ctx context.Context, repo store.Repo, baseSHA, branch string, commits []provider.Commit) ([]string, error)
OpenPullRequest(ctx context.Context, repo store.Repo, pr provider.PullRequest) (provider.OpenedPR, error)
}
Shipper pushes branches and opens pull requests on the git host.
type SignupMode ¶ added in v0.2.0
type SignupMode string
SignupMode says who may create an account by signing in with GitHub.
const ( SignupInvite SignupMode = "invite" // only invited GitHub logins (the default) SignupOpen SignupMode = "open" // anyone with a GitHub account SignupClosed SignupMode = "closed" // nobody new; existing people still sign in )
func ParseSignupMode ¶ added in v0.2.0
func ParseSignupMode(v string) (SignupMode, error)
ParseSignupMode reads a signup mode from configuration (VX_SIGNUP).
type SplitInput ¶ added in v0.4.0
type SplitInput struct {
Repo, Effort, Target string
Mode SplitMode
// Groups is a person's grouping: change ids (or unique prefixes) per
// part, in order. Empty: vx suggests the grouping, keeping the parts
// shipped before.
Groups [][]string
}
SplitInput controls PlanSplit.
type SplitMode ¶ added in v0.4.0
type SplitMode string
SplitMode says how an effort ships as several pull requests.
const ( // SplitNone ships the effort as one pull request. SplitNone SplitMode = "" // SplitIndependent ships parts that merge in any order: changes that // touch a common file, or where one depends on another, stay in one // part, and every part replays onto the target on its own. SplitIndependent SplitMode = "independent" // SplitStacked ships an ordered list of parts, each based on the // previous part's branch. SplitStacked SplitMode = "stacked" )
func ParseSplitMode ¶ added in v0.4.0
ParseSplitMode reads "independent", "stacked" or "" (one pull request).
type SupportGrant ¶ added in v0.5.0
type SupportGrant struct {
Repo string
Person store.Principal
Role RepoRole
ExpiresAt time.Time
Reason string
GrantedBy string // ref of who granted it, "" when they are gone
CreatedAt time.Time
}
SupportGrant is a superadmin's time-limited role on a repository.
func (SupportGrant) String ¶ added in v0.5.0
func (g SupportGrant) String() string
String describes a grant in one line, for logs and CLI output.
type SupportInput ¶ added in v0.5.0
type SupportInput struct {
Repo string
Person string // handle or user:HANDLE of a superadmin
Role RepoRole // read or write; empty: read
For time.Duration // 0: SupportDefaultDuration
Reason string // why, shown on the access page and in the log
}
SupportInput is a support grant to make.
type Task ¶ added in v0.2.0
type Task struct {
ID uuid.UUID
RepoName string
EffortSlug string
EffortID uuid.UUID
Title, Body string
State string
Owner *store.Principal
DependsOn []uuid.UUID
Blocked bool // computed: some DependsOn task is not done
CreatedBy store.Principal
CreatedParent *store.Principal // the person an agent creator acts for
CreatedAt time.Time
UpdatedAt time.Time
}
Task is one item of an effort's shared plan.
type UniqueRule ¶ added in v0.3.0
UniqueRule says that files matching Glob may not share the first group of Key (for example two migrations with the same number).
type UpdateTaskInput ¶ added in v0.2.0
UpdateTaskInput changes a task: Action is take, release, done, reopen or assign (with Owner).
type UpstreamSyncer ¶
type UpstreamSyncer interface {
// DefaultBranch asks the provider for the repo's default branch.
DefaultBranch(ctx context.Context, repo store.Repo) (string, error)
// SyncBranch imports new commits on branch and records its head.
SyncBranch(ctx context.Context, repo store.Repo, branch string) (store.Branch, int, error)
}
UpstreamSyncer imports branches from a repo's git provider.
Source Files
¶
- access_help.go
- admin_console.go
- agent_scope.go
- audit.go
- auth.go
- authz.go
- autorebase.go
- board.go
- checkjobs.go
- checkjobs_defs.go
- checks.go
- checktrust.go
- citokens.go
- claims.go
- cli_login.go
- context_others.go
- coordination.go
- disk_unix.go
- dpa.go
- effort_close.go
- efforts.go
- feedback.go
- feedback_blame.go
- feedback_github.go
- foryou.go
- github.go
- github_app.go
- github_check_runs.go
- github_checks.go
- github_events.go
- github_roles.go
- github_signin.go
- github_sync.go
- github_webhook.go
- host_feedback.go
- host_webhooks.go
- hosts.go
- land.go
- limits.go
- login.go
- merge_people.go
- notes.go
- objects.go
- objects_backfill.go
- objectsizes.go
- oidc.go
- ops_metrics.go
- org_checks.go
- org_delete.go
- org_purge.go
- orgs.go
- orgs_access.go
- orgs_manage.go
- overlaps.go
- pipeline.go
- presence.go
- push.go
- quotas.go
- rebase.go
- repo_writes.go
- repos.go
- reserve.go
- reviews.go
- rules.go
- runners.go
- service.go
- ship.go
- ship_split.go
- similar.go
- support.go
- symbols.go
- tasks.go
- upstream_events.go
- v03.go
- working.go