Bind schema selections throughout execution

This commit is contained in:
2026-11-20 15:36:44 +00:00
parent 2d96dfa696
commit 6fbbaa9cfa
20 changed files with 218 additions and 66 deletions

View File

@@ -245,19 +245,6 @@ func TestPublicConstructionPreservesMalformedYAMLCause(t *testing.T) {
t.Fatalf("loading diagnostics = %+v, want yaml.invalid", loadErr.Diagnostics())
}
func TestPublicConstructionPreservesOptionFailureCause(t *testing.T) {
path := filepath.Join(t.TempDir(), "missing.json")
engine, err := promptkit.NewEngine(promptkit.Config{}, promptkit.WithSchemaFile(path))
if engine != nil || !errors.Is(err, promptkit.ErrInvalidConfig) || !errors.Is(err, os.ErrNotExist) {
t.Fatalf("construction = (%#v, %v), want invalid config preserving the missing-file cause", engine, err)
}
cause := errors.Unwrap(err)
var pathErr *os.PathError
if cause == nil || errors.Is(cause, promptkit.ErrInvalidConfig) || !errors.As(cause, &pathErr) || pathErr.Path != path {
t.Fatalf("construction cause = %v, want the original path error without a category branch", cause)
}
}
func TestPublicConstructionRejectsSuppliedInvalidMainInput(t *testing.T) {
main := configkit.Input{}
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &main}})