Help us shape the future of Go! Take the 2026 Go Developer Survey

discovery

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: MIT Imports: 14 Imported by: 0

README

Bounded contract candidates

Discovery has separate syntax-tree resolvers for Python producers and TypeScript consumers. The coordinator reads bounded Git/worktree source once, composes registered endpoints with canonical local type relationships, and preserves proposed/inferred/unknown findings separately from accepted JSON/OpenAPI contracts. No imports, startup hooks, npm scripts or tests execute during discovery.

See supported patterns and trust limits, the representative project, and python_resolve_test.go, typescript_resolve_test.go, quality_test.go.

proposed_manifest never persists automatically. Python source schemas require a reviewed JSON/OpenAPI snapshot before declaring accepted obligations. Dynamic schemas and URLs, ambiguous ownership, runtime validators/serialization and middleware remain unresolved. New support must retain exact source provenance, bounded traversal and negative regressions, rather than matching names lexically.

Documentation

Overview

Package discovery extracts conservative, inspectable static contract candidates. Candidates never replace or automatically update authoritative manifests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Candidate

type Candidate struct {
	ID          string             `json:"id"`
	Producer    string             `json:"producer"`
	Consumer    string             `json:"consumer,omitempty"`
	Contract    string             `json:"contract"`
	SchemaPath  string             `json:"schema_path,omitempty"`
	Pointer     string             `json:"pointer,omitempty"`
	Endpoint    string             `json:"endpoint,omitempty"`
	Method      string             `json:"method,omitempty"`
	Fields      []string           `json:"fields"`
	Evidence    model.Evidence     `json:"evidence"`
	Locations   []model.Provenance `json:"locations"`
	Ambiguities []string           `json:"ambiguities,omitempty"`
}

func MatchAcross

func MatchAcross(producer Report, consumer Report) []Candidate

MatchAcross proposes relationships between separately discovered repositories. Only equal literal paths and known HTTP methods match. Source type names and field overlap cannot establish a relationship. Reports and manifests are not mutated, and every returned relationship remains proposed evidence.

type Comparison

type Comparison struct {
	Status      model.Status       `json:"status"`
	Base        string             `json:"base"`
	Head        string             `json:"head"`
	Findings    []model.Finding    `json:"findings"`
	Diagnostics []model.Diagnostic `json:"diagnostics"`
	Limitations []string           `json:"limitations"`
}

func Compare

func Compare(ctx context.Context, root, base, head string) (Comparison, error)

Compare reports removed declared fields still accessed by a supported candidate in the new tree. Runtime compatibility remains unknown; findings are warnings.

type ConsumerUse

type ConsumerUse struct {
	Path      string             `json:"path"`
	Endpoint  string             `json:"endpoint"`
	Method    string             `json:"method"`
	Type      string             `json:"type"`
	Fields    []string           `json:"fields"`
	Locations []model.Provenance `json:"locations"`
}

ConsumerUse records a literal typed request with no resolved local producer. Type identifies a statically resolved type, not a runtime contract.

type Report

type Report struct {
	Status           model.Status       `json:"status"`
	Revision         string             `json:"revision"`
	Schemas          []Schema           `json:"schemas"`
	Candidates       []Candidate        `json:"candidates"`
	Consumers        []ConsumerUse      `json:"consumers,omitempty"`
	ProposedManifest contracts.Manifest `json:"proposed_manifest"`
	Diagnostics      []model.Diagnostic `json:"diagnostics"`
	Limitations      []string           `json:"limitations"`
}

func Discover

func Discover(ctx context.Context, root, ref string) (Report, error)

Discover reads only bounded regular files through Radar's Git/path helpers.

type Schema

type Schema struct {
	ID       string           `json:"id"`
	Name     string           `json:"name"`
	Path     string           `json:"path"`
	Pointer  string           `json:"pointer"`
	Fields   []string         `json:"fields"`
	Evidence model.Provenance `json:"evidence"`
}

Jump to

Keyboard shortcuts

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