toolanswer

package
v1.138.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package toolanswer holds a managed script's declared answers to what the tools answer (#1953). A test that declares the answer a call gets (testing.answer) is checked here against the tool's answer contract (toolkit.AnswerContract), so a test cannot pass by relying on a shape the tool never returns: an answer lacking a field the tool always returns, a field of the wrong type, or a key a nested object never carries is refused, naming the field.

The top level of an answer admits keys the contract does not name, because the platform adds its own there after the tool returns (the call reference, the enrichment blocks).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Lister

type Lister interface {
	All() []registry.Toolkit
}

Lister is the live toolkit registry, which gains and loses toolkits as connections are added and removed.

type Live

type Live struct {
	Kits  Lister
	Extra []toolkit.AnswerContract
}

Live is the contracts of the toolkits a registry holds at the moment a declared answer is checked, and Extra's: the contracts of the tools the platform registers outside any toolkit (notify). A nil registry holds none.

func (Live) Check

func (l Live) Check(tool string, args, answer map[string]any) (bool, error)

Check is Set.Check over the registry's toolkits now and Extra.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is the answer contracts a deployment's tools declare.

func New

func New(contracts ...toolkit.AnswerContract) *Set

New is the set of the given contracts.

func (*Set) Check

func (s *Set) Check(tool string, args, answer map[string]any) (checked bool, err error)

Check holds answer, declared for a call to tool with args, to the tool's contract. checked is false when no contract covers the call, and the answer was not checked.

Jump to

Keyboard shortcuts

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