Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 382ccfb14b | |||
| 7406616794 | |||
| 4939fdb283 |
@@ -45,6 +45,14 @@ boundary and constraints that framework work must preserve.
|
||||
|
||||
## Release Guidance
|
||||
|
||||
The [v0.23.2 release notes](docs/releases/v0.23.2.md) cover configuration,
|
||||
validation, and release-tool dependency updates without an API migration or
|
||||
Go minimum increase.
|
||||
|
||||
The [v0.23.1 release notes](docs/releases/v0.23.1.md) cover corrected constructor
|
||||
error wrapping for downstream classification, with loading diagnostics and
|
||||
underlying causes preserved.
|
||||
|
||||
The [v0.23.0 release notes](docs/releases/v0.23.0.md) cover per-operation
|
||||
timeouts and opt-in prepared-request notifications for ordinary and coordinated
|
||||
execution.
|
||||
|
||||
@@ -215,6 +215,49 @@ func TestPublicConstructionPreservesConfigKitLoadError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestPublicConstructionPreservesMalformedYAMLCause(t *testing.T) {
|
||||
const sourceLabel = "prompts.yml"
|
||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Main: &configkit.Input{
|
||||
Source: configkit.Bytes(sourceLabel, []byte("profiles: [\n")),
|
||||
}}})
|
||||
var loadErr *configkit.LoadError
|
||||
if engine != nil || !errors.Is(err, promptkit.ErrInvalidConfig) || !errors.As(err, &loadErr) {
|
||||
t.Fatalf("construction = (%#v, %v), want invalid config preserving LoadError", engine, err)
|
||||
}
|
||||
cause := errors.Unwrap(err)
|
||||
var causeLoadErr *configkit.LoadError
|
||||
if cause == nil || errors.Is(cause, promptkit.ErrInvalidConfig) || !errors.As(cause, &causeLoadErr) || causeLoadErr != loadErr {
|
||||
t.Fatalf("construction cause = %v, want the original loading failure without a category branch", cause)
|
||||
}
|
||||
for _, diagnostic := range loadErr.Diagnostics() {
|
||||
if diagnostic.Code != "yaml.invalid" {
|
||||
continue
|
||||
}
|
||||
if diagnostic.Primary == nil {
|
||||
t.Fatal("YAML diagnostic has no source location")
|
||||
}
|
||||
source, ok := loadErr.Source(diagnostic.Primary.SourceID)
|
||||
if !ok || source.Label != sourceLabel {
|
||||
t.Fatalf("YAML diagnostic source = %+v, found=%v, want %q", source, ok, sourceLabel)
|
||||
}
|
||||
return
|
||||
}
|
||||
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}})
|
||||
|
||||
@@ -26,81 +26,60 @@ License and notices: [CC BY-SA 4.0](licenses/CC-BY-SA-4.0.txt) |
|
||||
|
||||
## ConfigKit
|
||||
|
||||
Selected module: `go.maximumdirect.net/configkit` at `v1.2.0`.
|
||||
Selected module: `go.maximumdirect.net/configkit` at `v1.2.1`.
|
||||
|
||||
Copyright (C) 2026 Eric Rakestraw
|
||||
|
||||
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
License and notices: [LGPL 3.0](../../LICENSE) |
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/c1c7e87f2cdf77a0cbf3327831ac05578e756b9e/COPYRIGHT) |
|
||||
[LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/c1c7e87f2cdf77a0cbf3327831ac05578e756b9e/LICENSE).
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/51ef3144158db1a09fabdbd1c7ae59908c84923b/COPYRIGHT) |
|
||||
[LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/51ef3144158db1a09fabdbd1c7ae59908c84923b/LICENSE).
|
||||
|
||||
[Source](https://forge.maximumdirect.net/base-layer/configkit/src/commit/c1c7e87f2cdf77a0cbf3327831ac05578e756b9e).
|
||||
[Source](https://forge.maximumdirect.net/base-layer/configkit/src/commit/51ef3144158db1a09fabdbd1c7ae59908c84923b).
|
||||
|
||||
## ReleaseKit
|
||||
|
||||
Selected module: `go.maximumdirect.net/releasekit` at `v0.9.0` (maintainer tool).
|
||||
Selected module: `go.maximumdirect.net/releasekit` at `v0.10.0` (maintainer tool).
|
||||
|
||||
Copyright (C) 2026 Eric Rakestraw
|
||||
|
||||
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||
|
||||
License and notices: [LGPL 3.0](../../LICENSE) |
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/2180aa868ec2caa95fc8279fd59d5f0ebac41bd4/COPYRIGHT) |
|
||||
[LICENSE](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/2180aa868ec2caa95fc8279fd59d5f0ebac41bd4/LICENSE).
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/COPYRIGHT) |
|
||||
[LICENSE](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/LICENSE).
|
||||
|
||||
[Source](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/2180aa868ec2caa95fc8279fd59d5f0ebac41bd4).
|
||||
[Source](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243).
|
||||
|
||||
## jsonschema
|
||||
|
||||
Selected module: `github.com/santhosh-tekuri/jsonschema/v6` at `v6.0.2`.
|
||||
Selected module: `github.com/santhosh-tekuri/jsonschema/v6` at `v6.0.3`.
|
||||
|
||||
SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
|
||||
[LICENSE](https://github.com/santhosh-tekuri/jsonschema/blob/29cbed948d24a04700eb94436416b18a07953b71/LICENSE).
|
||||
[LICENSE](https://github.com/santhosh-tekuri/jsonschema/blob/b0fc661f4939578bc429f408c18202573dbafcc4/LICENSE).
|
||||
|
||||
[Source](https://github.com/santhosh-tekuri/jsonschema/tree/29cbed948d24a04700eb94436416b18a07953b71).
|
||||
[Source](https://github.com/santhosh-tekuri/jsonschema/tree/b0fc661f4939578bc429f408c18202573dbafcc4).
|
||||
|
||||
## Go Text
|
||||
|
||||
Selected module: `golang.org/x/text` at `v0.14.0` (transitive dependency).
|
||||
Selected module: `golang.org/x/text` at `v0.44.0` (transitive dependency).
|
||||
|
||||
Copyright (c) 2009 The Go Authors. All rights reserved.
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
|
||||
[LICENSE](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) |
|
||||
[PATENTS](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
|
||||
[LICENSE](https://github.com/golang/text/blob/6070ac32abcdd1670599eeb3ee4d513c8184a513/LICENSE) |
|
||||
[PATENTS](https://github.com/golang/text/blob/6070ac32abcdd1670599eeb3ee4d513c8184a513/PATENTS).
|
||||
|
||||
[Source](https://github.com/golang/text/tree/6c97a165dd661335ff7bce6104a008558123c353).
|
||||
|
||||
## Go YAML v3
|
||||
|
||||
Selected module: `gopkg.in/yaml.v3` at `v3.0.1` (transitive dependency).
|
||||
|
||||
Copyright (c) 2006-2010 Kirill Simonov
|
||||
|
||||
Copyright (c) 2006-2011 Kirill Simonov
|
||||
|
||||
Copyright (c) 2011-2019 Canonical Ltd
|
||||
|
||||
Copyright 2011-2016 Canonical Ltd.
|
||||
|
||||
SPDX-License-Identifier: MIT AND Apache-2.0
|
||||
|
||||
License and notices: [MIT](licenses/MIT.txt) |
|
||||
[Apache 2.0](licenses/Apache-2.0.txt) |
|
||||
[LICENSE](https://github.com/go-yaml/yaml/blob/f6f7691b1fdeb513f56608cd2c32c51f8194bf51/LICENSE) |
|
||||
[NOTICE](https://github.com/go-yaml/yaml/blob/f6f7691b1fdeb513f56608cd2c32c51f8194bf51/NOTICE).
|
||||
|
||||
[Source](https://github.com/go-yaml/yaml/tree/f6f7691b1fdeb513f56608cd2c32c51f8194bf51).
|
||||
[Source](https://github.com/golang/text/tree/6070ac32abcdd1670599eeb3ee4d513c8184a513).
|
||||
|
||||
## Go YAML v4
|
||||
|
||||
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0-rc.6` (transitive dependency).
|
||||
Selected module: `go.yaml.in/yaml/v4` at `v4.0.0`.
|
||||
|
||||
Copyright 2006-2010 Kirill Simonov
|
||||
|
||||
@@ -112,7 +91,34 @@ SPDX-License-Identifier: MIT AND Apache-2.0
|
||||
|
||||
License and notices: [MIT](licenses/MIT.txt) |
|
||||
[Apache 2.0](licenses/Apache-2.0.txt) |
|
||||
[LICENSE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/LICENSE) |
|
||||
[NOTICE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/NOTICE).
|
||||
[LICENSE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/LICENSE) |
|
||||
[NOTICE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/NOTICE).
|
||||
|
||||
[Source](https://github.com/yaml/go-yaml/tree/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125).
|
||||
[Source](https://github.com/yaml/go-yaml/tree/f2f9563503f11b7a60da0c532175dcc693ce8d5a).
|
||||
|
||||
## Goldmark
|
||||
|
||||
Selected module: `github.com/yuin/goldmark/v2` at `v2.1.16` (maintainer-tool dependency).
|
||||
|
||||
Copyright (c) 2019 Yusuke Inuzuka
|
||||
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
License and notices: [MIT](licenses/MIT.txt) |
|
||||
[LICENSE](https://github.com/yuin/goldmark/blob/c3f939122ba4dd6f80e05043ad195b82e77fcb41/LICENSE).
|
||||
|
||||
[Source](https://github.com/yuin/goldmark/tree/c3f939122ba4dd6f80e05043ad195b82e77fcb41).
|
||||
|
||||
## Go Modules
|
||||
|
||||
Selected module: `golang.org/x/mod` at `v0.43.0` (maintainer-tool dependency).
|
||||
|
||||
Copyright 2009 The Go Authors.
|
||||
|
||||
SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
|
||||
[LICENSE](https://go.googlesource.com/mod/+/d4f320b9266480df5ed3d791e0c68e64c58c5dde/LICENSE) |
|
||||
[PATENTS](https://go.googlesource.com/mod/+/d4f320b9266480df5ed3d791e0c68e64c58c5dde/PATENTS).
|
||||
|
||||
[Source](https://go.googlesource.com/mod/+/d4f320b9266480df5ed3d791e0c68e64c58c5dde).
|
||||
|
||||
@@ -74,8 +74,8 @@ Successful publication needs no separate remote read-back or CI wait.
|
||||
|
||||
For optional local diagnosis, use `./scripts/releasekit.sh check VERSION`.
|
||||
It is not a required step before publication. The upstream
|
||||
[candidate-check guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.9.0/docs/consumers/check.md)
|
||||
and [CLI contract](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.9.0/docs/cli.md)
|
||||
[candidate-check guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/check.md)
|
||||
and [CLI contract](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/cli.md)
|
||||
own shared checks and exit-status definitions.
|
||||
|
||||
## Deliver The Hosted Release
|
||||
@@ -116,7 +116,7 @@ module files and supply the token there. In a separate checkout, for example:
|
||||
Resolve uncertain hosted writes before retrying the same immutable version.
|
||||
Matching content is accepted; conflicts are not overwritten. Do not rerun
|
||||
`publish` or move tags to repair delivery. Follow the upstream
|
||||
[delivery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.9.0/docs/consumers/delivery.md)
|
||||
[delivery guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/delivery.md)
|
||||
for result interpretation and recovery. These commands apply to tags containing
|
||||
this delivery configuration; older releases retain their original workflows.
|
||||
|
||||
@@ -143,13 +143,13 @@ and explicitly select the matching attempt:
|
||||
Discovery is local; reconciliation observes the original destination without
|
||||
rerunning validation, changing tags, or delivering hosted content. Neither is
|
||||
a routine gate after successful publication. Follow the upstream
|
||||
[recovery procedure](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.9.0/docs/release.md#resolve-publication-failures)
|
||||
[recovery procedure](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/release.md#resolve-publication-failures)
|
||||
for outcomes, incomplete evidence, and older attempts without records.
|
||||
|
||||
Records are stored under Git's common directory by default and can contain
|
||||
credential-bearing endpoints. Keep them private, out of source control and
|
||||
shared logs; retain them while needed for recovery and remove them when that
|
||||
value expires. See the [evidence guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.9.0/docs/consumers/publish.md#retain-and-reconcile-publication-evidence)
|
||||
value expires. See the [evidence guide](https://forge.maximumdirect.net/base-layer/releasekit/src/tag/v0.10.0/docs/consumers/publish.md#retain-and-reconcile-publication-evidence)
|
||||
for storage and retention details.
|
||||
|
||||
Current absence does not prove a version was never published. Remove a retained
|
||||
|
||||
33
docs/releases/v0.23.1.md
Normal file
33
docs/releases/v0.23.1.md
Normal file
@@ -0,0 +1,33 @@
|
||||
# Promptkit v0.23.1
|
||||
|
||||
This patch release fixes construction-error wrapping so downstream consumers
|
||||
can classify failures from their underlying causes without treating the
|
||||
`ErrInvalidConfig` category as an independent failure.
|
||||
|
||||
## Fixed
|
||||
|
||||
`NewEngine` now uses single-cause wrapping for both configuration-loading and
|
||||
option-application failures. `errors.Is` still recognizes `ErrInvalidConfig`,
|
||||
and `errors.As` still exposes ConfigKit loading errors with their diagnostics
|
||||
and source context. Genuine joined causes, including cancellation, remain
|
||||
inspectable. Consumers retain responsibility for mapping those failures to
|
||||
application outcomes or exit statuses.
|
||||
|
||||
See the [constructor GoDoc](../../engine.go) and
|
||||
[error-handling guide](../consumers/pkg-promptkit.md#handle-errors) for the
|
||||
public error contracts and usage.
|
||||
|
||||
## Compatibility And Upgrade
|
||||
|
||||
No configuration or request changes are required when upgrading from v0.23.0.
|
||||
Consumers that inspect constructor error trees directly should account for
|
||||
the category no longer appearing as a separate sibling branch; use
|
||||
`errors.Is` and `errors.As` for category and typed-cause inspection.
|
||||
|
||||
The Go consumer minimum remains 1.27.0, and dependency versions are unchanged.
|
||||
|
||||
```sh
|
||||
go get go.maximumdirect.net/promptkit@v0.23.1
|
||||
```
|
||||
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.1/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.1/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.1/docs/oss/attribution.md)
|
||||
35
docs/releases/v0.23.2.md
Normal file
35
docs/releases/v0.23.2.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# Promptkit v0.23.2
|
||||
|
||||
This patch release refreshes configuration, validation, and maintainer-tool
|
||||
dependencies. No Promptkit configuration or request API migration is required.
|
||||
|
||||
## Dependency Updates
|
||||
|
||||
- ConfigKit v1.2.0 → v1.2.1 and go-yaml v4.0.0-rc.6 → v4.0.0 move
|
||||
configuration loading to stable go-yaml, with ConfigKit's corresponding
|
||||
loader-plugin adaptation.
|
||||
- jsonschema v6.0.2 → v6.0.3 includes fixes to validation-location reporting,
|
||||
numeric edge cases, and email validation.
|
||||
- Go Text (`golang.org/x/text`) v0.14.0 → v0.44.0 refreshes the transitive
|
||||
dependency used by jsonschema.
|
||||
- ReleaseKit v0.9.0 → v0.10.0 updates maintainer tooling, selecting Goldmark
|
||||
v2.1.16 and Go Modules (`golang.org/x/mod`) v0.43.0. ReleaseKit's Go 1.27.0
|
||||
minimum is already satisfied by Promptkit's existing minimum.
|
||||
|
||||
Dependency notices and revision links are maintained in the
|
||||
[attribution document](../oss/attribution.md). Maintainers should use the
|
||||
updated [release runbook](../release.md); publication and hosted delivery
|
||||
remain separate operations.
|
||||
|
||||
## Compatibility And Upgrade
|
||||
|
||||
The Go consumer minimum remains 1.27.0. Existing configuration, requests,
|
||||
and release commands require no changes from v0.23.1. Upstream validator
|
||||
fixes may affect validation results or diagnostic locations for edge cases.
|
||||
See the [consumer guide](../consumers/pkg-promptkit.md) for current usage.
|
||||
|
||||
```sh
|
||||
go get go.maximumdirect.net/promptkit@v0.23.2
|
||||
```
|
||||
|
||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.2/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.2/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.2/docs/oss/attribution.md)
|
||||
16
engine.go
16
engine.go
@@ -241,12 +241,12 @@ func WithSchemaFile(path string) Option {
|
||||
// content. A missing prompt collection is allowed. Schema documents and
|
||||
// request artifacts remain runtime resources.
|
||||
//
|
||||
// NewEngine returns an error matching ErrInvalidConfig for invalid
|
||||
// configuration or options, preserving a ConfigKit LoadError when loading
|
||||
// fails. Each constructed
|
||||
// Engine has independent backend-capacity pools. Construction does not perform
|
||||
// model requests or require credentials. A negative Config.TransientRetries
|
||||
// is invalid.
|
||||
// NewEngine returns an error matching ErrInvalidConfig through errors.Is for
|
||||
// invalid configuration or options. The error unwraps to the original
|
||||
// construction cause, preserving a ConfigKit LoadError when loading fails.
|
||||
// Each constructed Engine has independent backend-capacity pools. Construction
|
||||
// does not perform model requests or require credentials. A negative
|
||||
// Config.TransientRetries is invalid.
|
||||
func NewEngine(cfg Config, opts ...Option) (*Engine, error) {
|
||||
var options engineOptions
|
||||
for _, opt := range opts {
|
||||
@@ -254,7 +254,7 @@ func NewEngine(cfg Config, opts ...Option) (*Engine, error) {
|
||||
continue
|
||||
}
|
||||
if err := opt.apply(&options); err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrInvalidConfig, err)
|
||||
return nil, newPublicOperationError(ErrInvalidConfig, err)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ func NewEngine(cfg Config, opts ...Option) (*Engine, error) {
|
||||
options.internal,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("%w: %w", ErrInvalidConfig, err)
|
||||
return nil, newPublicOperationError(ErrInvalidConfig, err)
|
||||
}
|
||||
return &Engine{internal: assembled}, nil
|
||||
}
|
||||
|
||||
@@ -21,6 +21,10 @@ type publicOperationError struct {
|
||||
message string
|
||||
}
|
||||
|
||||
func newPublicOperationError(owner, cause error) *publicOperationError {
|
||||
return &publicOperationError{owner: owner, cause: cause, message: fmt.Sprintf("%v: %v", owner, cause)}
|
||||
}
|
||||
|
||||
func (e *publicOperationError) Error() string { return e.message }
|
||||
func (e *publicOperationError) Unwrap() error { return e.cause }
|
||||
func (e *publicOperationError) Is(target error) bool { return errors.Is(e.owner, target) }
|
||||
@@ -44,7 +48,7 @@ func mapPublicError(err error) error {
|
||||
}
|
||||
// The projection already retains ordinary causes; adding the original
|
||||
// again would duplicate its entire subtree at each enclosing operation.
|
||||
return &publicOperationError{owner: owner, cause: mapped, message: fmt.Sprintf("%v: %v", owner, mapped)}
|
||||
return newPublicOperationError(owner, mapped)
|
||||
}
|
||||
}
|
||||
return mapUnownedPublicError(err)
|
||||
|
||||
@@ -10,6 +10,25 @@ import (
|
||||
"go.maximumdirect.net/promptkit/internal/usecase"
|
||||
)
|
||||
|
||||
func TestConstructionErrorPreservesJoinedCause(t *testing.T) {
|
||||
operational := errors.New("independent operational failure")
|
||||
cause := errors.Join(operational, context.Canceled)
|
||||
engine, err := NewEngine(Config{}, optionFunc(func(*engineOptions) error {
|
||||
return cause
|
||||
}))
|
||||
if engine != nil || err == nil {
|
||||
t.Fatalf("construction = (%#v, %v), want failure", engine, err)
|
||||
}
|
||||
if unwrapped := errors.Unwrap(err); unwrapped != cause {
|
||||
t.Fatalf("construction cause = %v, want the unchanged joined cause", unwrapped)
|
||||
}
|
||||
for _, target := range []error{ErrInvalidConfig, operational, context.Canceled} {
|
||||
if !errors.Is(err, target) {
|
||||
t.Errorf("construction error = %v, want identity %v", err, target)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMapPublicErrorPreservesGenerationCancellation(t *testing.T) {
|
||||
internalErr := fmt.Errorf("%w: %w", usecase.ErrLLMGenerate, context.Canceled)
|
||||
|
||||
|
||||
14
go.mod
14
go.mod
@@ -3,16 +3,16 @@ module go.maximumdirect.net/promptkit
|
||||
go 1.27.0
|
||||
|
||||
require (
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
|
||||
go.maximumdirect.net/configkit v1.2.0
|
||||
go.yaml.in/yaml/v4 v4.0.0-rc.6
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
|
||||
go.maximumdirect.net/configkit v1.2.1
|
||||
go.yaml.in/yaml/v4 v4.0.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/yuin/goldmark/v2 v2.1.6 // indirect
|
||||
go.maximumdirect.net/releasekit v0.9.0 // indirect
|
||||
golang.org/x/mod v0.40.0 // indirect
|
||||
golang.org/x/text v0.14.0 // indirect
|
||||
github.com/yuin/goldmark/v2 v2.1.16 // indirect
|
||||
go.maximumdirect.net/releasekit v0.10.0 // indirect
|
||||
golang.org/x/mod v0.43.0 // indirect
|
||||
golang.org/x/text v0.44.0 // indirect
|
||||
)
|
||||
|
||||
tool go.maximumdirect.net/releasekit/cmd/releasekit
|
||||
|
||||
28
go.sum
28
go.sum
@@ -1,16 +1,16 @@
|
||||
github.com/dlclark/regexp2 v1.11.0 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
|
||||
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 h1:KRzFb2m7YtdldCEkzs6KqmJw4nqEVZGK7IN2kJkjTuQ=
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
||||
github.com/yuin/goldmark/v2 v2.1.6 h1:igy0q9JcqovoFXFx/XjtU8sHVhcUHavPj2sA3EoKJUE=
|
||||
github.com/yuin/goldmark/v2 v2.1.6/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
|
||||
go.maximumdirect.net/configkit v1.2.0 h1:c4tDJ6Xeh/Jg90UZplLxsnf500lvrZBVj0E3i1ysir8=
|
||||
go.maximumdirect.net/configkit v1.2.0/go.mod h1:s1zLJ9GGB/1Q4a+aOHMLISonJxWFgNWpA6SpPlOafeA=
|
||||
go.maximumdirect.net/releasekit v0.9.0 h1:sK+Aoj6gS6ATU/1reocjwBekp4YETYENwkcX5ti6mrE=
|
||||
go.maximumdirect.net/releasekit v0.9.0/go.mod h1:QE4BLrAhVJTzi+/YTcVl21K/qZp9ojRLg5kuoy3Zb44=
|
||||
go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4=
|
||||
go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
||||
golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=
|
||||
golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE=
|
||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
|
||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
||||
github.com/yuin/goldmark/v2 v2.1.16 h1:MXvCVo+Cb2SVJ5cwJUzXetDjI7HECRJCkcqylEQtcJo=
|
||||
github.com/yuin/goldmark/v2 v2.1.16/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
|
||||
go.maximumdirect.net/configkit v1.2.1 h1:f+/6WjNl6CULbMr6ZSVwi4aty9rmuDfJlvpeU7I+HZM=
|
||||
go.maximumdirect.net/configkit v1.2.1/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
|
||||
go.maximumdirect.net/releasekit v0.10.0 h1:3GOgaIigXTkvYaRkntWZASE//2NTR1+IhkoKmt64aJo=
|
||||
go.maximumdirect.net/releasekit v0.10.0/go.mod h1:cT5NZNEcf7SKDx4MPG40YNK9V4bNyIxcLLFuNlbGQ90=
|
||||
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
||||
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
||||
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
|
||||
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
|
||||
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
||||
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
||||
|
||||
Reference in New Issue
Block a user