reviewapp

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package reviewapp provides the transport-independent application boundary for reading a validated Change Saga and its source comparison.

Index

Constants

View Source
const (
	DefaultPageLimit     = 100
	MaxPageLimit         = 1000
	DefaultFragmentLimit = 256 << 10
	MaxFragmentLimit     = 1 << 20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetSummary

type AssetSummary struct {
	Name      string `json:"name"`
	MediaType string `json:"media_type"`
	Bytes     int64  `json:"bytes"`
}

type Attribution

type Attribution struct {
	Status      string     `json:"status"`
	Commit      string     `json:"commit,omitempty"`
	Committer   *Committer `json:"committer,omitempty"`
	CommittedAt *time.Time `json:"committed_at,omitempty"`
}

type ChapterSummary

type ChapterSummary struct {
	Node
	ChildCount    int  `json:"child_count"`
	FragmentCount int  `json:"fragment_count"`
	OwnsCurrent   bool `json:"owns_current_diffs"`
	OwnsStale     bool `json:"owns_stale_diffs"`
}

type ChildrenPage

type ChildrenPage struct {
	Parent   string `json:"parent"`
	Children []Node `json:"children"`
	Page     Page   `json:"-"`
}

type ChildrenQuery

type ChildrenQuery struct {
	Parent string `json:"parent"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type ClaimEvidence added in v0.0.2

type ClaimEvidence struct {
	URI            string         `json:"uri"`
	Status         string         `json:"status"`
	MappedToTarget bool           `json:"mapped_to_target"`
	Atoms          []gitdiff.Atom `json:"atoms"`
}

type ClaimPage added in v0.0.2

type ClaimPage struct {
	Claims []ClaimRecord `json:"claims"`
	Page   Page          `json:"-"`
}

type ClaimQuery added in v0.0.2

type ClaimQuery struct {
	Target string `json:"target,omitempty"`
	Status string `json:"status,omitempty"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type ClaimRecord added in v0.0.2

type ClaimRecord struct {
	ID                 string              `json:"id"`
	Target             string              `json:"target"`
	Kind               string              `json:"kind"`
	Statement          string              `json:"statement"`
	CreatedAt          time.Time           `json:"created_at"`
	Attribution        Attribution         `json:"attribution"`
	Evidence           []ClaimEvidence     `json:"evidence"`
	VerificationStatus string              `json:"verification_status"`
	LatestVerification *VerificationRecord `json:"latest_verification,omitempty"`
}

type Committer

type Committer struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

type CompactDiffs

type CompactDiffs struct {
	Current           int `json:"current"`
	Stale             int `json:"stale"`
	DirectCurrent     int `json:"direct_current"`
	DirectStale       int `json:"direct_stale"`
	DescendantCurrent int `json:"descendant_current"`
	DescendantStale   int `json:"descendant_stale"`
}

type CompactReview

type CompactReview struct {
	// LatestState is retained as a wire-compatible name for the aggregate of
	// every reviewer's current decision.
	LatestState    string `json:"latest_state,omitempty"`
	HumanApprovals int    `json:"human_approvals"`
	AIApprovals    int    `json:"ai_approvals"`
	Rejections     int    `json:"rejections"`
	Unspecified    int    `json:"unspecified_decisions"`
	OpenThreads    int    `json:"open_threads"`
}

type CoverageSummary

type CoverageSummary struct {
	Complete    bool   `json:"complete"`
	Scope       string `json:"scope"`
	Total       int    `json:"total"`
	Covered     int    `json:"covered"`
	Uncovered   int    `json:"uncovered"`
	Overlapping int    `json:"overlapping"`
	Stale       int    `json:"stale"`
}

type DiffOwner

type DiffOwner struct {
	Target       string         `json:"target"`
	Selector     string         `json:"selector"`
	Note         string         `json:"note,omitempty"`
	EvidenceFile string         `json:"evidence_file,omitempty"`
	Mapping      *MappingSignal `json:"mapping,omitempty"`
}

type DiffOwnerQuery

type DiffOwnerQuery struct {
	Diff   string `json:"diff"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type DiffOwnership

type DiffOwnership struct {
	Diff  string      `json:"diff"`
	Kind  string      `json:"kind"`
	Atoms []OwnedAtom `json:"atoms"`
	Page  Page        `json:"-"`
}

type Error

type Error struct {
	Code      ErrorCode      `json:"code"`
	Message   string         `json:"message"`
	Retryable bool           `json:"retryable"`
	Details   map[string]any `json:"details,omitempty"`
	// contains filtered or unexported fields
}

Error is a stable domain error. Cause is retained for logs but intentionally excluded from serialized output because it can contain local absolute paths.

func AsError

func AsError(err error) *Error

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorCode

type ErrorCode string
const (
	CodeInvalidArgument   ErrorCode = "invalid_argument"
	CodeNotFound          ErrorCode = "not_found"
	CodeInvalidSaga       ErrorCode = "invalid_saga"
	CodeSourceUnavailable ErrorCode = "source_unavailable"
	CodeStaleSnapshot     ErrorCode = "stale_snapshot"
	CodeConflict          ErrorCode = "conflict"
	CodeUnsafePath        ErrorCode = "unsafe_path"
	CodeUnsupportedMedia  ErrorCode = "unsupported_media"
	CodeTooLarge          ErrorCode = "too_large"
	CodeInternal          ErrorCode = "internal"
)

func ErrorCodeOf

func ErrorCodeOf(err error) ErrorCode

ErrorCodeOf returns the stable code for a domain error. Unexpected errors deliberately collapse to internal rather than exposing implementation text.

type FragmentChunk

type FragmentChunk struct {
	Encoding   string `json:"encoding"`
	Data       string `json:"data"`
	Offset     int64  `json:"offset"`
	NextOffset *int64 `json:"next_offset"`
	Bytes      int64  `json:"bytes"`
	SHA256     string `json:"sha256"`
}

type FragmentContent

type FragmentContent struct {
	Target       string             `json:"target"`
	ID           string             `json:"id"`
	Title        string             `json:"title"`
	MediaType    string             `json:"media_type"`
	Content      FragmentChunk      `json:"content"`
	Assets       []AssetSummary     `json:"assets"`
	Landmarks    []SemanticLandmark `json:"landmarks"`
	Intent       string             `json:"intent,omitempty"`
	Layout       string             `json:"layout,omitempty"`
	Takeaway     string             `json:"takeaway,omitempty"`
	ReadingOrder []string           `json:"reading_order,omitempty"`
}

type FragmentDiffQuery

type FragmentDiffQuery struct {
	Target string `json:"target"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type FragmentDiffs

type FragmentDiffs struct {
	Target    string             `json:"target"`
	Selectors []ResolvedSelector `json:"selectors"`
	Atoms     []gitdiff.Atom     `json:"atoms"`
	Stale     []StaleSelector    `json:"stale"`
	Page      Page               `json:"-"`
}

type FragmentQuery

type FragmentQuery struct {
	Target string `json:"target"`
	Offset int64  `json:"offset,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type Gap

type Gap struct {
	Kind      string         `json:"kind"`
	Uncovered *UncoveredGap  `json:"uncovered,omitempty"`
	Stale     *StaleSelector `json:"stale,omitempty"`
	Overlap   *OverlapGap    `json:"overlap,omitempty"`
}

type GapPage

type GapPage struct {
	Gaps []Gap `json:"gaps"`
	Page Page  `json:"-"`
}

type GapQuery

type GapQuery struct {
	Kind   string `json:"kind,omitempty"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type LandmarkValue

type LandmarkValue struct {
	Type      string  `json:"type"`
	ElementID string  `json:"element_id,omitempty"`
	HeadingID string  `json:"heading_id,omitempty"`
	Exact     string  `json:"exact,omitempty"`
	Prefix    string  `json:"prefix,omitempty"`
	Suffix    string  `json:"suffix,omitempty"`
	X         float64 `json:"x,omitempty"`
	Y         float64 `json:"y,omitempty"`
	Width     float64 `json:"width,omitempty"`
	Height    float64 `json:"height,omitempty"`
}

type MappingAssessment added in v0.0.2

type MappingAssessment struct {
	Target             string          `json:"target"`
	TargetKind         string          `json:"target_kind"`
	EvidenceFile       string          `json:"evidence_file,omitempty"`
	Notes              []string        `json:"notes"`
	SelectorCount      int             `json:"selector_count"`
	StaleSelectorCount int             `json:"stale_selector_count"`
	AtomCount          int             `json:"atom_count"`
	AtomsPerNote       float64         `json:"atoms_per_note"`
	FileCount          int             `json:"file_count"`
	TargetAtomCount    int             `json:"target_atom_count"`
	TargetFileCount    int             `json:"target_file_count"`
	ChangesetShare     float64         `json:"changeset_share"`
	ScrutinyScore      int             `json:"scrutiny_score"`
	Reasons            []MappingReason `json:"reasons"`
}

type MappingPage added in v0.0.2

type MappingPage struct {
	Mappings []MappingAssessment `json:"mappings"`
	Page     Page                `json:"-"`
}

type MappingQuery added in v0.0.2

type MappingQuery struct {
	Target       string `json:"target,omitempty"`
	Sort         string `json:"sort,omitempty"`
	MinimumScore int    `json:"minimum_score,omitempty"`
	Cursor       string `json:"cursor,omitempty"`
	Limit        int    `json:"limit,omitempty"`
}

type MappingReason added in v0.0.2

type MappingReason struct {
	Code    string `json:"code"`
	Weight  int    `json:"weight"`
	Message string `json:"message"`
}

type MappingSignal added in v0.0.2

type MappingSignal struct {
	ScrutinyScore      int             `json:"scrutiny_score"`
	AtomCount          int             `json:"atom_count"`
	AtomsPerNote       float64         `json:"atoms_per_note"`
	FileCount          int             `json:"file_count"`
	TargetAtomCount    int             `json:"target_atom_count"`
	TargetFileCount    int             `json:"target_file_count"`
	StaleSelectorCount int             `json:"stale_selector_count"`
	Reasons            []MappingReason `json:"reasons"`
}

MappingSignal deliberately describes breadth and justification risk, not correctness. A high score tells an AI where to scrutinize first; it never turns a narrow mapping into proof that the explanation is true.

type Node

type Node struct {
	Kind        string         `json:"kind"`
	Target      string         `json:"target"`
	Parent      string         `json:"parent,omitempty"`
	ID          string         `json:"id"`
	Title       string         `json:"title"`
	Description string         `json:"description,omitempty"`
	Order       int            `json:"order,omitempty"`
	HasChildren bool           `json:"has_children"`
	Review      CompactReview  `json:"review"`
	Diffs       CompactDiffs   `json:"diffs"`
	MediaType   string         `json:"media_type,omitempty"`
	Bytes       int64          `json:"bytes,omitempty"`
	Selector    *LandmarkValue `json:"selector,omitempty"`
	ItemKind    string         `json:"item_kind,omitempty"`
	About       string         `json:"about,omitempty"`
	Body        string         `json:"body,omitempty"`
	Placement   string         `json:"placement,omitempty"`
	Leader      string         `json:"leader,omitempty"`
}

type OpenOptions

type OpenOptions struct {
	SagaRoot  string
	SourceDir string
	// SummaryOnly builds the hierarchy and aggregate coverage/review counts
	// without retaining atom-level indexes used by focused query operations.
	SummaryOnly bool
}

type OverlapGap

type OverlapGap struct {
	Atom   gitdiff.Atom `json:"atom"`
	Owners []DiffOwner  `json:"owners"`
}

type Overview

type Overview struct {
	Saga              SagaIdentity     `json:"saga"`
	Source            SourceSnapshot   `json:"source"`
	Root              Node             `json:"root"`
	OverviewFragments []Node           `json:"overview_fragments"`
	Chapters          []ChapterSummary `json:"chapters"`
	Decks             []ChapterSummary `json:"decks,omitempty"`
	Coverage          CoverageSummary  `json:"coverage"`
}

type OverviewQuery

type OverviewQuery struct{}

type OwnedAtom

type OwnedAtom struct {
	Atom    gitdiff.Atom   `json:"atom"`
	Owners  []DiffOwner    `json:"owners"`
	Threads []ReviewThread `json:"threads"`
}

type Page

type Page struct {
	Total      int     `json:"total"`
	Returned   int     `json:"returned"`
	HasMore    bool    `json:"has_more"`
	NextCursor *string `json:"next_cursor"`
}

type ResolvedSelector

type ResolvedSelector struct {
	URI          string         `json:"uri"`
	Note         string         `json:"note,omitempty"`
	Status       string         `json:"status"`
	Target       string         `json:"target"`
	EvidenceFile string         `json:"evidence_file,omitempty"`
	Atoms        []gitdiff.Atom `json:"atoms,omitempty"`
}

type ReviewEvent

type ReviewEvent struct {
	ID                  string                 `json:"id"`
	Kind                string                 `json:"kind"`
	Target              string                 `json:"target,omitempty"`
	Diff                string                 `json:"diff,omitempty"`
	State               string                 `json:"state,omitempty"`
	Body                string                 `json:"body,omitempty"`
	Anchor              *saga.Anchor           `json:"anchor,omitempty"`
	CreatedAt           time.Time              `json:"created_at"`
	Attribution         Attribution            `json:"attribution"`
	LegacyClaimedAuthor string                 `json:"legacy_claimed_author,omitempty"`
	Reviewer            *saga.ReviewerIdentity `json:"reviewer,omitempty"`
}

type ReviewFragment

type ReviewFragment struct {
	Target    string `json:"target"`
	ID        string `json:"id"`
	Title     string `json:"title"`
	MediaType string `json:"media_type"`
	Encoding  string `json:"encoding,omitempty"`
	Data      string `json:"data,omitempty"`
	Bytes     int64  `json:"bytes"`
	Truncated bool   `json:"truncated,omitempty"`
}

type ReviewItem

type ReviewItem struct {
	Kind   string        `json:"kind"`
	Thread *ReviewThread `json:"thread,omitempty"`
	Event  *ReviewEvent  `json:"event,omitempty"`
}

type ReviewMessage

type ReviewMessage struct {
	ID                  string           `json:"id"`
	CreatedAt           time.Time        `json:"created_at"`
	Attribution         Attribution      `json:"attribution"`
	LegacyClaimedAuthor string           `json:"legacy_claimed_author,omitempty"`
	Fragments           []ReviewFragment `json:"fragments"`
}

type ReviewPage

type ReviewPage struct {
	Items []ReviewItem `json:"items"`
	Page  Page         `json:"-"`
}

type ReviewQuery

type ReviewQuery struct {
	Target string `json:"target,omitempty"`
	Thread string `json:"thread,omitempty"`
	State  string `json:"state,omitempty"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type ReviewThread

type ReviewThread struct {
	ID                  string           `json:"id"`
	Kind                string           `json:"kind"`
	Target              string           `json:"target"`
	Anchor              saga.Anchor      `json:"anchor"`
	Suggestion          *saga.Suggestion `json:"suggestion,omitempty"`
	State               string           `json:"state"`
	CreatedAt           time.Time        `json:"created_at"`
	Attribution         Attribution      `json:"attribution"`
	LegacyClaimedAuthor string           `json:"legacy_claimed_author,omitempty"`
	Messages            []ReviewMessage  `json:"messages"`
	Events              []ReviewEvent    `json:"events"`
}

type SagaIdentity

type SagaIdentity struct {
	ID    string   `json:"id"`
	Title string   `json:"title"`
	PR    *saga.PR `json:"pr,omitempty"`
}

type SemanticLandmark added in v0.0.2

type SemanticLandmark struct {
	Target      string         `json:"target"`
	ID          string         `json:"id"`
	Label       string         `json:"label"`
	Description string         `json:"description,omitempty"`
	Selector    *LandmarkValue `json:"selector"`
	Diffs       CompactDiffs   `json:"diffs"`
	Kind        string         `json:"kind,omitempty"`
	About       string         `json:"about,omitempty"`
	Body        string         `json:"body,omitempty"`
	Placement   string         `json:"placement,omitempty"`
	Leader      string         `json:"leader,omitempty"`
}

type SourceSnapshot

type SourceSnapshot struct {
	Repository string `json:"repository"`
	Base       string `json:"base"`
	Head       string `json:"head"`
	BaseOID    string `json:"base_oid"`
	HeadOID    string `json:"head_oid"`
}

type StaleSelector

type StaleSelector struct {
	URI          string `json:"uri"`
	Note         string `json:"note,omitempty"`
	Target       string `json:"target"`
	EvidenceFile string `json:"evidence_file,omitempty"`
	Reason       string `json:"reason"`
}

type UncoveredGap

type UncoveredGap struct {
	Atom gitdiff.Atom `json:"atom"`
}

type VerificationPage added in v0.0.2

type VerificationPage struct {
	Verifications []VerificationRecord `json:"verifications"`
	Page          Page                 `json:"-"`
}

type VerificationQuery added in v0.0.2

type VerificationQuery struct {
	Claim  string `json:"claim,omitempty"`
	Status string `json:"status,omitempty"`
	Cursor string `json:"cursor,omitempty"`
	Limit  int    `json:"limit,omitempty"`
}

type VerificationRecord added in v0.0.2

type VerificationRecord struct {
	ID          string      `json:"id"`
	Claim       string      `json:"claim"`
	Status      string      `json:"status"`
	Method      string      `json:"method,omitempty"`
	Summary     string      `json:"summary"`
	Command     string      `json:"command,omitempty"`
	CreatedAt   time.Time   `json:"created_at"`
	Attribution Attribution `json:"attribution"`
}

Jump to

Keyboard shortcuts

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