46021e7d23
PR state was written by two flows and the second one could not persist: the feedback fetch returned live PR data without saving it, and the browser patched its own store copy instead. Opening a PR's detail panel turned that tab purple while the kanban card and boot payload still read state=open, and a reload snapped it back. The backend is now the only writer — the feedback read reconciles through SyncTaskPR and publishes github.task_pr.updated, so every surface converges and the state survives a reload. SyncTaskPR also refuses to move a row out of merged, since GitHub cannot un-merge a PR.
76 lines
1.8 KiB
Go
76 lines
1.8 KiB
Go
package github
|
|
|
|
// Normalized PR states (lowercase, used after conversion from GitHub API).
|
|
const (
|
|
prStateMerged = "merged"
|
|
prStateClosed = "closed"
|
|
prStateOpen = "open"
|
|
)
|
|
|
|
// PR review states from the GitHub API.
|
|
const (
|
|
reviewStateApproved = "APPROVED"
|
|
reviewStateChangesRequested = "CHANGES_REQUESTED"
|
|
reviewStatePending = "PENDING"
|
|
reviewStateCommented = "COMMENTED"
|
|
)
|
|
|
|
// Computed (aggregated) review states.
|
|
const (
|
|
computedReviewStateApproved = "approved"
|
|
computedReviewStateChangesRequested = "changes_requested"
|
|
computedReviewStatePending = "pending"
|
|
)
|
|
|
|
// Check run status and conclusion values from the GitHub API.
|
|
const (
|
|
checkStatusCompleted = "completed"
|
|
checkStatusPending = "pending"
|
|
checkStatusSuccess = "success"
|
|
|
|
checkConclusionSuccess = "success"
|
|
checkConclusionFail = "failure"
|
|
checkConclusionSkipped = "skipped"
|
|
checkConclusionNeutral = "neutral"
|
|
checkConclusionCancelled = "cancelled"
|
|
checkConclusionTimedOut = "timed_out"
|
|
checkConclusionActionRequired = "action_required"
|
|
)
|
|
|
|
// Check source identifiers.
|
|
const (
|
|
checkSourceCheckRun = "check_run"
|
|
checkSourceStatusContext = "status_context"
|
|
)
|
|
|
|
// PR comment source identifiers.
|
|
const (
|
|
commentTypeReview = "review"
|
|
commentTypeIssue = "issue"
|
|
)
|
|
|
|
// Reviewer types.
|
|
const (
|
|
reviewerTypeUser = "user"
|
|
reviewerTypeTeam = "team"
|
|
)
|
|
|
|
// GitHub user type identifiers.
|
|
const (
|
|
githubUserTypeBot = "Bot"
|
|
)
|
|
|
|
// Commit status state values from /commits/:ref/status.
|
|
const (
|
|
commitStatusSuccess = "success"
|
|
commitStatusPending = "pending"
|
|
commitStatusFailure = "failure"
|
|
commitStatusError = "error"
|
|
)
|
|
|
|
// Watch poll interval bounds in seconds (stored in the database).
|
|
const (
|
|
defaultWatchPollIntervalSec = 300
|
|
minWatchPollIntervalSec = 60
|
|
)
|