Documentation
¶
Overview ¶
Package analysis provides conservative proofs about checked payload contracts. It never guesses arbitrary predicate equivalence or treats unknown as success.
Index ¶
Constants ¶
const ContractSyntaxVersion = "refine.contract-syntax/v2"
const OperationCompatibilityVersion = "refine.operation-compatibility/v1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Compatibility ¶
type Compatibility struct {
Fingerprint string `json:"fingerprint"`
Backward Finding `json:"backward"` // Every old accepted payload is accepted by new.
Forward Finding `json:"forward"` // Every new accepted payload is accepted by old.
}
func Compare ¶
func Compare(oldProgram *language.Program, oldRoot string, newProgram *language.Program, newRoot string, limits validation.Limits) (Compatibility, error)
Compare considers accepted payload sets, not Java API/ABI or native wire compatibility. Interval inclusion proofs concern logical constraints with sufficient resources; equal budgets do not imply equal execution costs. Native format, API context and publication policy require their own analysis.
type ContractSyntaxEvidence ¶
type ContractSyntaxEvidence struct {
Version string `json:"version"`
BaselineFingerprint string `json:"baselineFingerprint"`
CandidateFingerprint string `json:"candidateFingerprint"`
Equal bool `json:"equal"`
Differences []SyntaxDifference `json:"differences"`
}
func CompareContractSyntax ¶
func CompareContractSyntax(baseline *language.Program, baselineRoot string, candidate *language.Program, candidateRoot string) (ContractSyntaxEvidence, error)
CompareContractSyntax proves only identical canonical checked language syntax, ignoring comments, source positions and layout. It retains roots, publication packages, imports, declaration/field/equation order, signatures, predicates, diagnostic codes/messages and budgets. A difference is not a proof of changed accepted values: arbitrary predicate equivalence remains undecidable. Callers must separately compare native resources, wire metadata, dependency identities and generated APIs before approving documentation-only release classifications.
func CompareOperationContractSyntax ¶
func CompareOperationContractSyntax(baseline, candidate OperationContract) (ContractSyntaxEvidence, error)
CompareOperationContractSyntax proves exact equality of the canonical checked module and the complete operation/root inventory. It is useful only as one input to documentation classification; native resources and APIs are outside this evidence.
type Finding ¶
type Finding struct {
Outcome Outcome `json:"outcome"`
Code string `json:"code"`
Explanation string `json:"explanation"`
}
func Satisfiable ¶
Satisfiable proves contradictions in numeric bounds or validates a concrete candidate. Failure to find a candidate is unknown, never unsatisfiable.
type OperationCompatibility ¶
type OperationCompatibility struct {
Fingerprint string `json:"fingerprint"`
Backward Finding `json:"backward"`
Forward Finding `json:"forward"`
}
func CompareOperations ¶
func CompareOperations(baseline, candidate OperationContract, limits validation.Limits) (OperationCompatibility, error)
CompareOperations compares a server operation surface without fabricating a payload root. Backward compatibility requires the candidate server to accept baseline requests, while every candidate response must remain acceptable to baseline consumers. Forward compatibility reverses both inclusions. Native schema/resource and generated-API compatibility remain separate. Inputs are capped at 4,096 operations/responses and 64 MiB of canonical source plus operation strings before defensive copies are allocated.
type OperationContract ¶
type OperationContract struct {
Program *language.Program
Operations []OperationEntrypoint
}
type OperationEntrypoint ¶
type OperationEntrypoint struct {
OperationID string
Method string
Path string
RequestRoot string
Responses []OperationResponseEntrypoint
}
type OperationResponseEntrypoint ¶
OperationResponseEntrypoint identifies one checked response status. ContextRoot is a relational request-response contract, not a marginal response contract.
type SchemaError ¶
func (*SchemaError) Error ¶
func (e *SchemaError) Error() string
type SchemaFinding ¶
SchemaFinding keeps unknown separate from a proof of an inhabited type. Findings follow declaration order, never map iteration order.
type SchemaReport ¶
type SchemaReport struct {
Roots []string `json:"roots"`
Findings []SchemaFinding `json:"findings"`
}
func CheckSchema ¶
func CheckSchema(program *language.Program, limits validation.Limits) (SchemaReport, error)
CheckSchema rejects proven-empty declarations, while returning explicit unknown findings for unsupported proofs and uninstantiated generic types. It is separate from language.Compile: type checking alone is not a proof. The current proof fragment is deliberately the same as Satisfiable.
func CheckSchemaRoots ¶
func CheckSchemaRoots(program *language.Program, roots []string, limits validation.Limits) (SchemaReport, error)
CheckSchemaRoots classifies every declaration but rejects a proven-empty schema only when that declaration is an explicit closed entrypoint. An impossible unused definition or optional child cannot make an inhabitable selected root empty. Root order and duplicates do not affect the report.
type SyntaxDifference ¶
SyntaxDifference names the changed surface, never the predicate literal, function body, or diagnostic-message contents. Order is deterministic.