claim

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 — built-in 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
	// StatusUse is the mirror tiebreak the CLI transition write already
	// carries (transition.MirrorStatusUse, GDK-1356): on a board with two
	// same-named in-progress destinations, the one the project actually
	// holds issues in is the one a bare claim means. nil leaves payload
	// order deciding, which is the pre-GDK-1521 answer (GDK-1521's defect).
	StatusUse func(statusID string) int
}

Request is one claim write. TransitionID is optional: empty lets the origin pick the first destination whose category is in-progress. Set, it accepts whatever PickTransition accepts (transition id, status id, name) and is the answer to a board where two transitions land in progress (GDK-1174) — Apply resolves it and refuses a destination that is not in-progress, because claim is not a general transition.

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. Built-in 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