Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 804a4d32b2 | |||
| 67d446f611 | |||
| bcdd6fe06c | |||
| 382ccfb14b |
@@ -45,6 +45,13 @@ boundary and constraints that framework work must preserve.
|
|||||||
|
|
||||||
## Release Guidance
|
## Release Guidance
|
||||||
|
|
||||||
|
The [v0.23.3 release notes](docs/releases/v0.23.3.md) cover HTTP operation-timeout
|
||||||
|
attribution, custom caller cancellation causes, and response-read error identity.
|
||||||
|
|
||||||
|
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
|
The [v0.23.1 release notes](docs/releases/v0.23.1.md) cover corrected constructor
|
||||||
error wrapping for downstream classification, with loading diagnostics and
|
error wrapping for downstream classification, with loading diagnostics and
|
||||||
underlying causes preserved.
|
underlying causes preserved.
|
||||||
|
|||||||
97
context_identity_contract_test.go
Normal file
97
context_identity_contract_test.go
Normal file
@@ -0,0 +1,97 @@
|
|||||||
|
package promptkit_test
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
"testing/synctest"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.maximumdirect.net/promptkit"
|
||||||
|
)
|
||||||
|
|
||||||
|
type contextIdentityResponseBody struct {
|
||||||
|
ctx context.Context
|
||||||
|
cause error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b contextIdentityResponseBody) Read([]byte) (int, error) { <-b.ctx.Done(); return 0, b.cause }
|
||||||
|
func (contextIdentityResponseBody) Close() error { return nil }
|
||||||
|
|
||||||
|
func TestExecutionContextAndOriginalCauseIdentities(t *testing.T) {
|
||||||
|
for _, split := range []bool{false, true} {
|
||||||
|
for _, kind := range []string{"caller cancel", "caller deadline", "body operation deadline"} {
|
||||||
|
t.Run(map[bool]string{false: "run/", true: "prepared/"}[split]+kind, func(t *testing.T) {
|
||||||
|
synctest.Test(t, func(t *testing.T) {
|
||||||
|
cause := errors.New("private original cause")
|
||||||
|
ctx, cancel := context.WithCancelCause(context.Background())
|
||||||
|
defer cancel(nil)
|
||||||
|
want := error(context.Canceled)
|
||||||
|
failure := promptkit.ExecutionFailureCanceled
|
||||||
|
if kind == "caller deadline" {
|
||||||
|
var stop context.CancelFunc
|
||||||
|
ctx, stop = context.WithTimeoutCause(context.Background(), time.Second, cause)
|
||||||
|
defer stop()
|
||||||
|
}
|
||||||
|
if kind != "caller cancel" {
|
||||||
|
want = context.DeadlineExceeded
|
||||||
|
failure = promptkit.ExecutionFailureDeadline
|
||||||
|
}
|
||||||
|
cfg := simpleConfig("message")
|
||||||
|
cfg.HTTPClient = &http.Client{Transport: roundTripFunc(func(r *http.Request) (*http.Response, error) {
|
||||||
|
if kind == "body operation deadline" {
|
||||||
|
return &http.Response{StatusCode: http.StatusOK, Body: contextIdentityResponseBody{ctx: r.Context(), cause: cause}}, nil
|
||||||
|
}
|
||||||
|
if kind == "caller cancel" {
|
||||||
|
cancel(cause)
|
||||||
|
} else {
|
||||||
|
<-ctx.Done()
|
||||||
|
}
|
||||||
|
return nil, context.Cause(ctx)
|
||||||
|
})}
|
||||||
|
engine, err := promptkit.NewEngine(cfg)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var events []promptkit.ExecutionEvent
|
||||||
|
req := simpleGenerationRequest()
|
||||||
|
req.OperationTimeout = time.Minute
|
||||||
|
if kind == "body operation deadline" {
|
||||||
|
req.OperationTimeout = time.Second
|
||||||
|
}
|
||||||
|
req.Observer = func(e promptkit.ExecutionEvent) { events = append(events, e) }
|
||||||
|
var result *promptkit.RunResult
|
||||||
|
if split {
|
||||||
|
handle, prepareErr := engine.PrepareExecution(ctx, req)
|
||||||
|
if prepareErr != nil {
|
||||||
|
t.Fatal(prepareErr)
|
||||||
|
}
|
||||||
|
result, err = engine.RunPrepared(ctx, handle)
|
||||||
|
} else {
|
||||||
|
result, err = engine.Run(ctx, req)
|
||||||
|
}
|
||||||
|
for _, identity := range []error{want, cause, promptkit.ErrLLMGenerate, promptkit.ErrTransport} {
|
||||||
|
if !errors.Is(err, identity) {
|
||||||
|
t.Errorf("error=%v, want identity %v", err, identity)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if kind != "body operation deadline" {
|
||||||
|
var transportErr *url.Error
|
||||||
|
if !errors.As(err, &transportErr) {
|
||||||
|
t.Errorf("lost HTTP transport error: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if result != nil || errors.Is(err, promptkit.ErrOperationTimeout) != (kind == "body operation deadline") || strings.Contains(err.Error(), cause.Error()) {
|
||||||
|
t.Fatalf("incorrect outcome or disclosure: result=%v error=%v", result, err)
|
||||||
|
}
|
||||||
|
if len(events) != 3 || events[1].Failure != failure || events[2].Kind != promptkit.ExecutionFinished || events[2].Failure != failure {
|
||||||
|
t.Fatalf("attempt/terminal classification = %+v", events)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -159,6 +159,13 @@ caller deadlines, generation deadlines, and whole-request client timeouts
|
|||||||
retain `context.DeadlineExceeded`. The runner adds its generation category
|
retain `context.DeadlineExceeded`. The runner adds its generation category
|
||||||
without discarding those identities or depending on HTTP status mapping.
|
without discarding those identities or depending on HTTP status mapping.
|
||||||
|
|
||||||
|
When a transport failure carries a custom context cancellation cause, the
|
||||||
|
client also retains the standard context identity. It correlates that cause
|
||||||
|
with the returned failure rather than labeling unrelated transport errors from
|
||||||
|
context state alone. Cancellation while reading a successful response body
|
||||||
|
retains the original read failure alongside the context identity within the
|
||||||
|
redacting wrapper.
|
||||||
|
|
||||||
## Test Ownership
|
## Test Ownership
|
||||||
|
|
||||||
The
|
The
|
||||||
|
|||||||
@@ -26,81 +26,60 @@ License and notices: [CC BY-SA 4.0](licenses/CC-BY-SA-4.0.txt) |
|
|||||||
|
|
||||||
## ConfigKit
|
## 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
|
Copyright (C) 2026 Eric Rakestraw
|
||||||
|
|
||||||
SPDX-License-Identifier: LGPL-3.0-or-later
|
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
License and notices: [LGPL 3.0](../../LICENSE) |
|
License and notices: [LGPL 3.0](../../LICENSE) |
|
||||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/c1c7e87f2cdf77a0cbf3327831ac05578e756b9e/COPYRIGHT) |
|
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/configkit/src/commit/51ef3144158db1a09fabdbd1c7ae59908c84923b/COPYRIGHT) |
|
||||||
[LICENSE](https://forge.maximumdirect.net/base-layer/configkit/src/commit/c1c7e87f2cdf77a0cbf3327831ac05578e756b9e/LICENSE).
|
[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
|
## 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
|
Copyright (C) 2026 Eric Rakestraw
|
||||||
|
|
||||||
SPDX-License-Identifier: LGPL-3.0-or-later
|
SPDX-License-Identifier: LGPL-3.0-or-later
|
||||||
|
|
||||||
License and notices: [LGPL 3.0](../../LICENSE) |
|
License and notices: [LGPL 3.0](../../LICENSE) |
|
||||||
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/2180aa868ec2caa95fc8279fd59d5f0ebac41bd4/COPYRIGHT) |
|
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/82bac1a3ab935beddd4b8789d1e07f52135d4243/COPYRIGHT) |
|
||||||
[LICENSE](https://forge.maximumdirect.net/base-layer/releasekit/src/commit/2180aa868ec2caa95fc8279fd59d5f0ebac41bd4/LICENSE).
|
[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
|
## 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
|
SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
License and notices: [Apache 2.0](licenses/Apache-2.0.txt) |
|
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
|
## 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
|
SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
|
License and notices: [BSD 3-Clause](licenses/BSD-3-Clause.txt) |
|
||||||
[LICENSE](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/LICENSE) |
|
[LICENSE](https://github.com/golang/text/blob/6070ac32abcdd1670599eeb3ee4d513c8184a513/LICENSE) |
|
||||||
[PATENTS](https://github.com/golang/text/blob/6c97a165dd661335ff7bce6104a008558123c353/PATENTS).
|
[PATENTS](https://github.com/golang/text/blob/6070ac32abcdd1670599eeb3ee4d513c8184a513/PATENTS).
|
||||||
|
|
||||||
[Source](https://github.com/golang/text/tree/6c97a165dd661335ff7bce6104a008558123c353).
|
[Source](https://github.com/golang/text/tree/6070ac32abcdd1670599eeb3ee4d513c8184a513).
|
||||||
|
|
||||||
## 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).
|
|
||||||
|
|
||||||
## Go YAML v4
|
## 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
|
Copyright 2006-2010 Kirill Simonov
|
||||||
|
|
||||||
@@ -112,7 +91,34 @@ SPDX-License-Identifier: MIT AND Apache-2.0
|
|||||||
|
|
||||||
License and notices: [MIT](licenses/MIT.txt) |
|
License and notices: [MIT](licenses/MIT.txt) |
|
||||||
[Apache 2.0](licenses/Apache-2.0.txt) |
|
[Apache 2.0](licenses/Apache-2.0.txt) |
|
||||||
[LICENSE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/LICENSE) |
|
[LICENSE](https://github.com/yaml/go-yaml/blob/f2f9563503f11b7a60da0c532175dcc693ce8d5a/LICENSE) |
|
||||||
[NOTICE](https://github.com/yaml/go-yaml/blob/1c17b9cee72bf81ae73a8be50fbd7dd3a9985125/NOTICE).
|
[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`.
|
For optional local diagnosis, use `./scripts/releasekit.sh check VERSION`.
|
||||||
It is not a required step before publication. The upstream
|
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)
|
[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.9.0/docs/cli.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.
|
own shared checks and exit-status definitions.
|
||||||
|
|
||||||
## Deliver The Hosted Release
|
## 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.
|
Resolve uncertain hosted writes before retrying the same immutable version.
|
||||||
Matching content is accepted; conflicts are not overwritten. Do not rerun
|
Matching content is accepted; conflicts are not overwritten. Do not rerun
|
||||||
`publish` or move tags to repair delivery. Follow the upstream
|
`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
|
for result interpretation and recovery. These commands apply to tags containing
|
||||||
this delivery configuration; older releases retain their original workflows.
|
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
|
Discovery is local; reconciliation observes the original destination without
|
||||||
rerunning validation, changing tags, or delivering hosted content. Neither is
|
rerunning validation, changing tags, or delivering hosted content. Neither is
|
||||||
a routine gate after successful publication. Follow the upstream
|
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.
|
for outcomes, incomplete evidence, and older attempts without records.
|
||||||
|
|
||||||
Records are stored under Git's common directory by default and can contain
|
Records are stored under Git's common directory by default and can contain
|
||||||
credential-bearing endpoints. Keep them private, out of source control and
|
credential-bearing endpoints. Keep them private, out of source control and
|
||||||
shared logs; retain them while needed for recovery and remove them when that
|
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.
|
for storage and retention details.
|
||||||
|
|
||||||
Current absence does not prove a version was never published. Remove a retained
|
Current absence does not prove a version was never published. Remove a retained
|
||||||
|
|||||||
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)
|
||||||
36
docs/releases/v0.23.3.md
Normal file
36
docs/releases/v0.23.3.md
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
# Promptkit v0.23.3
|
||||||
|
|
||||||
|
This patch release corrects timeout attribution and preserves error identities
|
||||||
|
in the built-in OpenAI-compatible HTTP client.
|
||||||
|
|
||||||
|
## Fixed
|
||||||
|
|
||||||
|
- Operation budgets expiring during an in-flight HTTP generation request now
|
||||||
|
match both `ErrOperationTimeout` and `context.DeadlineExceeded`. Terminal
|
||||||
|
observations report a deadline failure instead of a transport failure.
|
||||||
|
- HTTP failures carrying custom caller cancellation or deadline causes retain
|
||||||
|
both the custom cause and the standard context identity. Unrelated transport
|
||||||
|
failures are not relabeled solely because a context has been canceled.
|
||||||
|
- Cancellation while reading a successful response body preserves the original
|
||||||
|
reader error alongside the context identity, without exposing its diagnostic
|
||||||
|
text through the redacted error message.
|
||||||
|
|
||||||
|
Regression coverage exercises `Run` and `RunPrepared`, public error identities,
|
||||||
|
and attempt and terminal classifications. See the [request and timeout
|
||||||
|
contracts](../../types.go), [public error GoDoc](../../engine.go), and
|
||||||
|
[error-handling guide](../consumers/pkg-promptkit.md#handle-errors).
|
||||||
|
|
||||||
|
## Compatibility And Upgrade
|
||||||
|
|
||||||
|
No configuration or request API migration is required from v0.23.2. Consumers
|
||||||
|
using `errors.Is` for cancellation or deadline handling now receive the
|
||||||
|
correct identities on the affected paths; applications continue to own their
|
||||||
|
status mapping and diagnostic presentation.
|
||||||
|
|
||||||
|
The Go consumer minimum remains 1.27.0, and dependency versions are unchanged.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
go get go.maximumdirect.net/promptkit@v0.23.3
|
||||||
|
```
|
||||||
|
|
||||||
|
[COPYRIGHT](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.3/COPYRIGHT) | [LICENSE](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.3/LICENSE) | [ATTRIBUTION](https://forge.maximumdirect.net/base-layer/promptkit/src/tag/v0.23.3/docs/oss/attribution.md)
|
||||||
@@ -3,6 +3,9 @@ package promptkit_test
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"net/http/httptest"
|
||||||
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
"testing/synctest"
|
"testing/synctest"
|
||||||
"time"
|
"time"
|
||||||
@@ -10,6 +13,70 @@ import (
|
|||||||
"go.maximumdirect.net/promptkit"
|
"go.maximumdirect.net/promptkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestBuiltInGenerationOperationTimeout(t *testing.T) {
|
||||||
|
for _, split := range []bool{false, true} {
|
||||||
|
t.Run(map[bool]string{false: "run", true: "prepared"}[split], func(t *testing.T) {
|
||||||
|
started := make(chan struct{}, 1)
|
||||||
|
release := make(chan struct{})
|
||||||
|
provider := httptest.NewServer(http.HandlerFunc(func(http.ResponseWriter, *http.Request) {
|
||||||
|
select {
|
||||||
|
case started <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
<-release
|
||||||
|
}))
|
||||||
|
defer provider.Close()
|
||||||
|
defer close(release)
|
||||||
|
|
||||||
|
config := simpleConfig("message")
|
||||||
|
zero := 0
|
||||||
|
config.TransientRetries = &zero
|
||||||
|
config.HTTPClient = provider.Client()
|
||||||
|
engine, err := promptkit.NewEngine(config)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var terminal promptkit.ExecutionEvent
|
||||||
|
req := promptkit.RunRequest{PromptID: "prompt", OperationTimeout: time.Second,
|
||||||
|
Execution: &promptkit.ExecutionTargetOverride{Endpoint: provider.URL + "/v1", TimeoutSeconds: &zero},
|
||||||
|
Observer: func(event promptkit.ExecutionEvent) {
|
||||||
|
if event.Kind == promptkit.ExecutionFinished {
|
||||||
|
terminal = event
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
parent := context.Background()
|
||||||
|
var result *promptkit.RunResult
|
||||||
|
if split {
|
||||||
|
handle, prepareErr := engine.PrepareExecution(parent, req)
|
||||||
|
if prepareErr != nil {
|
||||||
|
t.Fatal(prepareErr)
|
||||||
|
}
|
||||||
|
result, err = engine.RunPrepared(parent, handle)
|
||||||
|
} else {
|
||||||
|
result, err = engine.Run(parent, req)
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case <-started:
|
||||||
|
default:
|
||||||
|
t.Fatal("operation expired before provider received the request")
|
||||||
|
}
|
||||||
|
for _, target := range []error{promptkit.ErrOperationTimeout, context.DeadlineExceeded, promptkit.ErrLLMGenerate, promptkit.ErrTransport} {
|
||||||
|
if !errors.Is(err, target) {
|
||||||
|
t.Errorf("error=%v, want identity %v", err, target)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var transportErr *url.Error
|
||||||
|
if !errors.As(err, &transportErr) {
|
||||||
|
t.Errorf("error=%v, want retained HTTP transport cause", err)
|
||||||
|
}
|
||||||
|
if result != nil || parent.Err() != nil || terminal.Failure != promptkit.ExecutionFailureDeadline {
|
||||||
|
t.Fatalf("result=%v parent=%v terminal=%+v", result, parent.Err(), terminal)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestRunOperationTimeoutAttribution(t *testing.T) {
|
func TestRunOperationTimeoutAttribution(t *testing.T) {
|
||||||
synctest.Test(t, func(t *testing.T) {
|
synctest.Test(t, func(t *testing.T) {
|
||||||
engine := observationEngine(t, observationClientFunc(func(ctx context.Context, _ promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) {
|
engine := observationEngine(t, observationClientFunc(func(ctx context.Context, _ promptkit.GenerateRequest) (*promptkit.GenerateResponse, error) {
|
||||||
|
|||||||
14
go.mod
14
go.mod
@@ -3,16 +3,16 @@ module go.maximumdirect.net/promptkit
|
|||||||
go 1.27.0
|
go 1.27.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3
|
||||||
go.maximumdirect.net/configkit v1.2.0
|
go.maximumdirect.net/configkit v1.2.1
|
||||||
go.yaml.in/yaml/v4 v4.0.0-rc.6
|
go.yaml.in/yaml/v4 v4.0.0
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/yuin/goldmark/v2 v2.1.6 // indirect
|
github.com/yuin/goldmark/v2 v2.1.16 // indirect
|
||||||
go.maximumdirect.net/releasekit v0.9.0 // indirect
|
go.maximumdirect.net/releasekit v0.10.0 // indirect
|
||||||
golang.org/x/mod v0.40.0 // indirect
|
golang.org/x/mod v0.43.0 // indirect
|
||||||
golang.org/x/text v0.14.0 // indirect
|
golang.org/x/text v0.44.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
||||||
tool go.maximumdirect.net/releasekit/cmd/releasekit
|
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 h1:G/nrcoOa7ZXlpoa/91N3X7mM3r8eIlMBBJZvsz/mxKI=
|
||||||
github.com/dlclark/regexp2 v1.11.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8=
|
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.3 h1:1EYB5IzjZawrrnELUi78f9fPu57HuXjmddZPjrls/28=
|
||||||
github.com/santhosh-tekuri/jsonschema/v6 v6.0.2/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
github.com/santhosh-tekuri/jsonschema/v6 v6.0.3/go.mod h1:JXeL+ps8p7/KNMjDQk3TCwPpBy0wYklyWTfbkIzdIFU=
|
||||||
github.com/yuin/goldmark/v2 v2.1.6 h1:igy0q9JcqovoFXFx/XjtU8sHVhcUHavPj2sA3EoKJUE=
|
github.com/yuin/goldmark/v2 v2.1.16 h1:MXvCVo+Cb2SVJ5cwJUzXetDjI7HECRJCkcqylEQtcJo=
|
||||||
github.com/yuin/goldmark/v2 v2.1.6/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
|
github.com/yuin/goldmark/v2 v2.1.16/go.mod h1:G6M4/qOFtfn01/o14BU1UR2Lo5N3S9Qo7xCuz/sHjGQ=
|
||||||
go.maximumdirect.net/configkit v1.2.0 h1:c4tDJ6Xeh/Jg90UZplLxsnf500lvrZBVj0E3i1ysir8=
|
go.maximumdirect.net/configkit v1.2.1 h1:f+/6WjNl6CULbMr6ZSVwi4aty9rmuDfJlvpeU7I+HZM=
|
||||||
go.maximumdirect.net/configkit v1.2.0/go.mod h1:s1zLJ9GGB/1Q4a+aOHMLISonJxWFgNWpA6SpPlOafeA=
|
go.maximumdirect.net/configkit v1.2.1/go.mod h1:ewu6blSokUDCMovy8JBXAdXRikGmlHXAQpFghnPWRfs=
|
||||||
go.maximumdirect.net/releasekit v0.9.0 h1:sK+Aoj6gS6ATU/1reocjwBekp4YETYENwkcX5ti6mrE=
|
go.maximumdirect.net/releasekit v0.10.0 h1:3GOgaIigXTkvYaRkntWZASE//2NTR1+IhkoKmt64aJo=
|
||||||
go.maximumdirect.net/releasekit v0.9.0/go.mod h1:QE4BLrAhVJTzi+/YTcVl21K/qZp9ojRLg5kuoy3Zb44=
|
go.maximumdirect.net/releasekit v0.10.0/go.mod h1:cT5NZNEcf7SKDx4MPG40YNK9V4bNyIxcLLFuNlbGQ90=
|
||||||
go.yaml.in/yaml/v4 v4.0.0-rc.6 h1:1h7H1ohdUh93/FyE4YaDa1Zh64K6VVbjF4K6WUxMtH4=
|
go.yaml.in/yaml/v4 v4.0.0 h1:/LG1pNO84Z4l603j/xMn69CcS5OYhMQ/f7l2LoQUGuw=
|
||||||
go.yaml.in/yaml/v4 v4.0.0-rc.6/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
go.yaml.in/yaml/v4 v4.0.0/go.mod h1:aZqd9kCMsGL7AuUv/m/PvWLdg5sjJsZ4oHDEnfPPfY0=
|
||||||
golang.org/x/mod v0.40.0 h1:hUv+3cXcdRHz08UmSiOob7sadHig73uo5bkXxQ/tvUs=
|
golang.org/x/mod v0.43.0 h1:MFuq5J6s35W9D3IjkwyWc9vHh0nENOrt5K8Iof4ofmg=
|
||||||
golang.org/x/mod v0.40.0/go.mod h1:0/weTWkPWGBikyTWAX3dkjVztMmBA5hM0DH6BElSupE=
|
golang.org/x/mod v0.43.0/go.mod h1:4ec1JnuyBz5+FIVhg86UsA39YG8BpnrZdJYSNHmGzHY=
|
||||||
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
|
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
|
||||||
|
|||||||
50
internal/llm/context_identity_test.go
Normal file
50
internal/llm/context_identity_test.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package llm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"testing"
|
||||||
|
|
||||||
|
"go.maximumdirect.net/promptkit/internal/domain"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestTransportDoesNotRelabelIndependentFailureAfterCancellation(t *testing.T) {
|
||||||
|
ctx, cancel := context.WithCancelCause(context.Background())
|
||||||
|
defer cancel(nil)
|
||||||
|
independent := errors.New("independent transport failure")
|
||||||
|
client := NewOpenAICompatibleClient(OpenAICompatibleConfig{HTTPClient: &http.Client{Transport: roundTripFunc(func(*http.Request) (*http.Response, error) {
|
||||||
|
cancel(errors.New("unrelated caller cause"))
|
||||||
|
return nil, independent
|
||||||
|
})}})
|
||||||
|
_, err := client.Generate(ctx, contextIdentityRequest())
|
||||||
|
if !errors.Is(err, independent) || errors.Is(err, context.Canceled) {
|
||||||
|
t.Fatalf("unrelated failure relabeled: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type contextIdentityBody struct {
|
||||||
|
cancel context.CancelFunc
|
||||||
|
cause error
|
||||||
|
}
|
||||||
|
|
||||||
|
func (b contextIdentityBody) Read([]byte) (int, error) { b.cancel(); return 0, b.cause }
|
||||||
|
func (contextIdentityBody) Close() error { return nil }
|
||||||
|
|
||||||
|
func TestResponseReadCancellationRetainsOriginalCause(t *testing.T) {
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
cause := errors.New("private body failure")
|
||||||
|
client := NewOpenAICompatibleClient(OpenAICompatibleConfig{HTTPClient: &http.Client{Transport: roundTripFunc(func(*http.Request) (*http.Response, error) {
|
||||||
|
return &http.Response{StatusCode: http.StatusOK, Body: contextIdentityBody{cancel: cancel, cause: cause}}, nil
|
||||||
|
})}})
|
||||||
|
_, err := client.Generate(ctx, contextIdentityRequest())
|
||||||
|
if !errors.Is(err, context.Canceled) || !errors.Is(err, cause) || !errors.Is(err, ErrTransport) || strings.Contains(err.Error(), cause.Error()) {
|
||||||
|
t.Fatalf("lost body cause or redaction: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func contextIdentityRequest() domain.GenerateRequest {
|
||||||
|
return domain.GenerateRequest{Target: domain.ExecutionTarget{Endpoint: "http://example.test/v1", Model: "test"}}
|
||||||
|
}
|
||||||
@@ -220,6 +220,13 @@ func (p *PreparedGeneration) execute(ctx context.Context, captureEvidence bool)
|
|||||||
outcome.StatusCode = httpResp.StatusCode
|
outcome.StatusCode = httpResp.StatusCode
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
// net/http can return the context's custom cause instead of ctx.Err().
|
||||||
|
// Add the standard identity only when the transport failure carries that
|
||||||
|
// cause; an unrelated failure must not acquire a later cancellation.
|
||||||
|
if contextErr := requestContext.Err(); contextErr != nil &&
|
||||||
|
!errors.Is(err, contextErr) && errors.Is(err, context.Cause(requestContext)) {
|
||||||
|
err = errors.Join(contextErr, err)
|
||||||
|
}
|
||||||
outcome.Err = &requestFailedError{cause: err}
|
outcome.Err = &requestFailedError{cause: err}
|
||||||
return outcome
|
return outcome
|
||||||
}
|
}
|
||||||
@@ -234,7 +241,9 @@ func (p *PreparedGeneration) execute(ctx context.Context, captureEvidence bool)
|
|||||||
httpResp.ContentLength,
|
httpResp.ContentLength,
|
||||||
httpResp.Body,
|
httpResp.Body,
|
||||||
)
|
)
|
||||||
if err := observedContextError(requestContext, ctx, outcome.Err); err != nil {
|
// The provider status is already captured separately. Context failure
|
||||||
|
// supersedes it, rather than nesting a provider-status error as transport.
|
||||||
|
if err := observedContextError(requestContext, ctx, nil); err != nil {
|
||||||
outcome.Err = err
|
outcome.Err = err
|
||||||
}
|
}
|
||||||
return outcome
|
return outcome
|
||||||
@@ -300,10 +309,10 @@ func (p *PreparedGeneration) execute(ctx context.Context, captureEvidence bool)
|
|||||||
|
|
||||||
func observedContextError(attempt, caller context.Context, cause error) error {
|
func observedContextError(attempt, caller context.Context, cause error) error {
|
||||||
if err := caller.Err(); err != nil {
|
if err := caller.Err(); err != nil {
|
||||||
return &requestFailedError{cause: err}
|
return &requestFailedError{cause: errors.Join(err, cause)}
|
||||||
}
|
}
|
||||||
if err := attempt.Err(); err != nil {
|
if err := attempt.Err(); err != nil {
|
||||||
return &requestFailedError{cause: err}
|
return &requestFailedError{cause: errors.Join(err, cause)}
|
||||||
}
|
}
|
||||||
if errors.Is(cause, context.Canceled) || errors.Is(cause, context.DeadlineExceeded) {
|
if errors.Is(cause, context.Canceled) || errors.Is(cause, context.DeadlineExceeded) {
|
||||||
return &requestFailedError{cause: cause}
|
return &requestFailedError{cause: cause}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package usecase
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -17,7 +18,9 @@ type OperationScope struct {
|
|||||||
func NewOperationScope(parent context.Context, duration time.Duration) *OperationScope {
|
func NewOperationScope(parent context.Context, duration time.Duration) *OperationScope {
|
||||||
scope := &OperationScope{Context: parent, cancel: func() {}}
|
scope := &OperationScope{Context: parent, cancel: func() {}}
|
||||||
if duration > 0 {
|
if duration > 0 {
|
||||||
scope.cause = errors.New("operation deadline")
|
// Transports may return context.Cause rather than ctx.Err(). Retain
|
||||||
|
// deadline identity while keeping this cause unique to the invocation.
|
||||||
|
scope.cause = fmt.Errorf("operation deadline: %w", context.DeadlineExceeded)
|
||||||
scope.Context, scope.cancel = context.WithTimeoutCause(parent, duration, scope.cause)
|
scope.Context, scope.cancel = context.WithTimeoutCause(parent, duration, scope.cause)
|
||||||
}
|
}
|
||||||
return scope
|
return scope
|
||||||
|
|||||||
Reference in New Issue
Block a user