parenthint

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: 6 Imported by: 0

Documentation

Overview

Package parenthint is the single owner of parent-rejection detection and the mirror hierarchy hint that follows it (CLI create/edit and REST PUT parent / POST create). Both surfaces call Wrap so a new path cannot inherit the bare origin 400.

The field key differs by verb, and both shapes were measured against a real Cloud site on 2026-08-21: POST /issue answers with `parent` AND `parentId`, PUT /issue/{key} answers with `pid`. The messages themselves are localized per account, so the keys are the only stable part. GDK-424 tested `parent` inline in the create path, which could never have matched the edit path (GDK-525).

Detection is typed, not textual: every Jira-family origin (connected, standalone issuetap, paired) rides *jira.Client, so the 400 arrives as *jira.APIError and Rejection reads its field keys. The old err.Error() scan matched any sentence containing "parent" — including the Linear adapter's local refusal, which is not an origin parent rejection at all (GDK-819).

The hint names CLI --parent because that wording is the existing contract (GDK-330); REST appends the same sentence rather than a second copy. This package does not compose HTTP status.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hint

func Hint(q Querier, parentKey string) string

Hint reads the rejected parent from the mirror and states the hierarchy rule Jira's 400 leaves out. Best-effort: no querier, no row, or any error returns "" and the origin error stands alone.

func Rejection

func Rejection(err error) bool

Rejection reports whether err is the origin refusing the parent we sent. The answer is read off the typed *jira.APIError the whole Jira REST family returns (connected, standalone issuetap, paired — one client), never off the message text: `parent`/`parentId` answer POST /issue, `pid` answers PUT /issue/{key}. The Linear adapter never reaches here with a parent rejection; it refuses the field locally, and that refusal's sentence is not scanned (GDK-819).

func Wrap

func Wrap(err error, parentKey string, q Querier) error

Wrap appends the mirror's hierarchy answer to a parent rejection and returns every other error untouched. q may be nil: the origin error then stands alone (best-effort; no mirror, no row).

Types

type Hinted

type Hinted struct {
	Hint string
	// contains filtered or unexported fields
}

Hinted wraps an origin error with the mirror hierarchy sentence. Unwrap keeps the origin error matchable; Error appends the hint the same way the CLI used to (origin + newline + hint).

func (*Hinted) Error

func (h *Hinted) Error() string

func (*Hinted) Unwrap

func (h *Hinted) Unwrap() error

type Querier

type Querier interface {
	QueryRow(query string, args ...any) *sql.Row
	Query(query string, args ...any) (*sql.Rows, error)
}

Querier is the mirror read the hint needs. *sql.DB (CLI openReadOnly) and *store.DB (REST's existing connection) both satisfy it; this package never opens a connection of its own.

Jump to

Keyboard shortcuts

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