claim

package
v0.18.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 26, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package claim is the single owner of the gadak claim write (CLI today, REST later), the way internal/transition owns the transition write.

On an origin that implements issuetap's claim route — standalone and paired workspaces — Apply is one atomic call: of two agents claiming concurrently exactly one wins. Atlassian Cloud has no claim route and answers 404; there Apply falls back to the two writes the atomic route exists to fuse (assignee + in-progress transition), judged locally first. That fallback has no atomicity; Result.Atomic says which path answered so the caller can say so instead of silently granting a guarantee the origin never made.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Origin

type Origin interface {
	transition.Origin
	Claim(ctx context.Context, key, transitionID string, takeOver bool) (jira.ClaimResult, error)
	Myself(ctx context.Context) (jira.User, error)
	IssueStatus(ctx context.Context, key string) (jira.Status, *jira.User, error)
	SetAssignee(ctx context.Context, key, accountID string) error
}

Origin is the origin surface Apply needs. *jira.Client satisfies it; the Linear adapter does not — claim is a Jira-workflow verb (assignee plus the in-progress transition), so callers refuse Linear before reaching here.

type Request

type Request struct {
	Key          string
	TransitionID string
	TakeOver     bool
}

Request is one claim write. TransitionID is optional: empty lets the origin pick the first destination whose category is in-progress.

type Result

type Result struct {
	Key            string `json:"key"`
	AssigneeID     string `json:"assignee_id"`
	Assignee       string `json:"assignee"`
	StatusID       string `json:"status_id"`
	Status         string `json:"status"`
	StatusCategory string `json:"status_category"`
	ClaimedAt      string `json:"claimed_at"`
	Atomic         bool   `json:"atomic"`
}

Result is what the caller shows: the claim's outcome on the origin plus whether the origin guaranteed it atomically.

func Apply

func Apply(ctx context.Context, o Origin, cfg *config.Config, req Request) (Result, error)

Apply claims req.Key on the origin. Standalone and paired origins answer the atomic route; a 404 means the origin has no claim route (Cloud — or the issue does not exist, which the fallback's read then reports honestly) and the two-call fallback runs. Apply does not refresh the mirror — that tail is the write verb's, same as transition.

type TakenError

type TakenError struct {
	Key    string
	Holder string
	// contains filtered or unexported fields
}

TakenError is the refusal: another actor holds the issue in progress. The sentence stays the origin's own ("<KEY> is already claimed by <표시명>") on both paths so they print identically; Holder carries the display name separately for callers that show it on its own. Exit codes and HTTP status are the caller's mapping (CLI: a dedicated exit code; REST: 409).

func (*TakenError) Error

func (e *TakenError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL