Documentation
¶
Overview ¶
Package transition is the single owner of the gadak transition write (CLI, including `gadak close`, and REST). Both surfaces call Apply so identifier resolution, required screen fields, resolution lookup, field-alias remap, category-token idempotency, and the origin write cannot exist on one path and not the other.
Refused errors carry catalogue data only. The CLI formats flag names; REST maps them to HTTP 400. This package does not name CLI flags.
Mirror refresh is not here: it is the write-through tail shared by every write verb (CLI mutate / server mutate), not a property of this verb.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllASCIIDigits ¶
AllASCIIDigits reports whether s is one or more ASCII digits — the "the user typed a bare id, not a name" discriminator in catalog resolution.
func FormatNamedIDs ¶
FormatNamedIDs joins a catalog's names (ids where the name is empty) with ", " — the "available: …" list in resolution errors. Single owner; the `gadak agent` / `gadak edit` surfaces import it (GDK-619).
func IsRefused ¶
IsRefused reports whether err is a caller-side refusal (bad identifier, missing required field, unknown resolution). Origin errors are not.
func Preview ¶
func Preview(ctx context.Context, o Origin, key, target string) (id string, changed bool, err error)
Preview answers what Apply would do without writing: the resolved transition id when one would fire (changed=true), or the category no-op (changed=false, empty id). It exists so a dry-run cannot drift from the real write — both run resolveTransition. A pick miss that is not a no-op returns the pick error.
Types ¶
type Origin ¶
type Origin interface {
Transitions(ctx context.Context, key string) ([]jira.Transition, error)
Transition(ctx context.Context, key, transitionID string, fields map[string]any, comment json.RawMessage) error
}
Origin is the origin verbs Apply needs. origin.Writer satisfies it.
type Refused ¶
type Refused struct {
Msg string
}
Refused is a caller-side refusal: the origin was not written. Adapters map this to a 400 / CLI message; origin errors pass through unchanged.
type Request ¶
type Request struct {
Key string
Target string
Resolution string
Fields map[string]any
Comment string
}
Request is one transition write. Target is whatever PickTransition accepts: transition id, target status id, transition/status name, or a status category token (new|inprogress|done). Fields are already parsed (CLI --field, REST JSON); aliases are remapped here. Resolution is a name or id; a name is resolved from the transition's allowedValues, else the origin's resolution catalog.
type RequiredFieldsError ¶
RequiredFieldsError is a Refused whose screen lists required fields the request did not supply. CLI appends flag names; REST uses Error as-is.
func (*RequiredFieldsError) Error ¶
func (e *RequiredFieldsError) Error() string
type Result ¶
type Result struct {
Changed bool `json:"changed"`
}
Result is a successful Apply. Changed is false when Target was a category token and the origin already reports that category: no POST (and no comment). A named or id miss is still an error, not a no-op.