modelresolveaudit

package
v1.0.0-beta.162 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT 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 modelresolveaudit is a static invariant audit that fails when a name-keyed model-registry lookup skips capability resolution.

A loop is spawned with whatever name a rule handed it — that name can be a CAPABILITY (coordinator/developer/reviewer), not a concrete endpoint. A raw reg.GetEndpoint(name) / reg.GetMaxTokens(name) / reg.Endpoints[name] lookup MISSES on a capability and silently returns wrong/zero endpoint accounting, limits, or provider — the #584 (cost-usd) / #594 (max_tokens) bug class. The invariant (model/registry.go ResolveEndpointName): every name-keyed lookup on the accounting/limit/aux paths MUST resolve the name through model.ResolveEndpointName (or reg.Resolve) first.

This audit is a heuristic go/ast scan over owned source. A lookup passes when its argument is provably a resolved name (an inline ResolveEndpointName/Resolve call, or a variable assigned from one earlier in the same function), or when the site carries an inline `// modelresolveaudit:allow <reason>` escape-hatch, mirroring internal/entityidaudit and internal/predicateaudit.

Index

Constants

View Source
const (
	// SurfaceGetEndpoint marks a reg.GetEndpoint(name) call.
	SurfaceGetEndpoint = "go-call:GetEndpoint"
	// SurfaceGetMaxTokens marks a reg.GetMaxTokens(name) call.
	SurfaceGetMaxTokens = "go-call:GetMaxTokens"
	// SurfaceEndpointsIndex marks a reg.Endpoints[name] index expression.
	SurfaceEndpointsIndex = "go-index:Endpoints"
)

Surface labels for the three name-keyed lookup shapes the audit detects.

Variables

This section is empty.

Functions

func Audit

func Audit(roots ...string) ([]Candidate, []Finding, error)

Audit walks roots and returns every extracted lookup candidate plus every candidate that is neither provably resolved nor covered by an allow annotation. A stale allow annotation (one that covers no unresolved lookup) is an error, keeping the escape-hatch set honest.

Types

type Candidate

type Candidate struct {
	File    string
	Line    int
	Column  int
	Surface string
	Arg     string
}

Candidate records one structurally extracted name-keyed lookup.

type Finding

type Finding struct {
	Candidate
	Reason string
}

Finding is an unresolved lookup that carries no allow annotation.

Jump to

Keyboard shortcuts

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