Migrate native PromptKit test fixtures
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# PromptKit v0.18.0 implementation plan
|
# PromptKit v0.18.0 implementation plan
|
||||||
|
|
||||||
Status: Stages 1–2 complete; Stages 3–7 remain.
|
Status: Stages 1–3 complete; Stages 4–7 remain.
|
||||||
|
|
||||||
## Authority and execution
|
## Authority and execution
|
||||||
|
|
||||||
@@ -122,6 +122,8 @@ fixtures may still prevent the full test suite from running.
|
|||||||
|
|
||||||
## Stage 3: Convert native engine fixtures
|
## Stage 3: Convert native engine fixtures
|
||||||
|
|
||||||
|
**Complete.** Native fixtures use identified resource lists and explicit minimal bundle choices; focused engine-backed tests pass. Report path expectations remain for Stage 4.
|
||||||
|
|
||||||
1. Inspect ckprompt test configurations outside the composed example (Stage 5),
|
1. Inspect ckprompt test configurations outside the composed example (Stage 5),
|
||||||
including embedded YAML, MapFS files, and programmatic mappings. Start with `adapterEngine` and
|
including embedded YAML, MapFS files, and programmatic mappings. Start with `adapterEngine` and
|
||||||
`adapterEngineFrom` in `adapters_test.go`, then the requirements, validation,
|
`adapterEngineFrom` in `adapters_test.go`, then the requirements, validation,
|
||||||
|
|||||||
@@ -18,8 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const adapterPrompt = `prompts:
|
const adapterPrompt = `prompts:
|
||||||
briefing:
|
- id: briefing
|
||||||
version: "1"
|
|
||||||
default_profile: default
|
default_profile: default
|
||||||
inputs:
|
inputs:
|
||||||
- name: topic
|
- name: topic
|
||||||
@@ -36,8 +35,7 @@ const adapterPrompt = `prompts:
|
|||||||
output:
|
output:
|
||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
empty:
|
- id: empty
|
||||||
version: "1"
|
|
||||||
default_profile: default
|
default_profile: default
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -46,10 +44,10 @@ const adapterPrompt = `prompts:
|
|||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
backends:
|
backends:
|
||||||
local:
|
- id: local
|
||||||
endpoint: "https://example.invalid/v1"
|
endpoint: "https://example.invalid/v1"
|
||||||
profiles:
|
profiles:
|
||||||
default:
|
- id: default
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
temperature: 0
|
temperature: 0
|
||||||
@@ -61,15 +59,14 @@ profiles:
|
|||||||
visible: true
|
visible: true
|
||||||
null_value: null
|
null_value: null
|
||||||
sequence: [first, null, 3]
|
sequence: [first, null, 3]
|
||||||
requires-key:
|
- id: requires-key
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
api_key_required: true
|
api_key_required: true
|
||||||
`
|
`
|
||||||
|
|
||||||
const adapterRequirementsPrompt = `prompts:
|
const adapterRequirementsPrompt = `prompts:
|
||||||
briefing:
|
- id: briefing
|
||||||
version: "1"
|
|
||||||
default_profile: default
|
default_profile: default
|
||||||
session_id: '{{input "session-only"}} {{.session_variable}}'
|
session_id: '{{input "session-only"}} {{.session_variable}}'
|
||||||
messages:
|
messages:
|
||||||
@@ -79,10 +76,10 @@ const adapterRequirementsPrompt = `prompts:
|
|||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
backends:
|
backends:
|
||||||
local:
|
- id: local
|
||||||
endpoint: "https://example.invalid/v1"
|
endpoint: "https://example.invalid/v1"
|
||||||
profiles:
|
profiles:
|
||||||
default:
|
- id: default
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
`
|
`
|
||||||
@@ -101,13 +98,22 @@ func adapterEngineFrom(t *testing.T, label, configuration string, options ...pro
|
|||||||
}
|
}
|
||||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
||||||
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
||||||
}}, options...)
|
}}, append([]promptkit.Option{promptkit.WithBundledOpenRouter(false)}, options...)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("construct PromptKit fixture: %v", err)
|
t.Fatalf("construct PromptKit fixture: %v", err)
|
||||||
}
|
}
|
||||||
return engine
|
return engine
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func bundledEngine(t *testing.T) *promptkit.Engine {
|
||||||
|
t.Helper()
|
||||||
|
engine, err := promptkit.NewEngine(promptkit.Config{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("construct bundled PromptKit fixture: %v", err)
|
||||||
|
}
|
||||||
|
return engine
|
||||||
|
}
|
||||||
|
|
||||||
type recordingSmokeClient struct {
|
type recordingSmokeClient struct {
|
||||||
request promptkit.GenerateRequest
|
request promptkit.GenerateRequest
|
||||||
response *promptkit.GenerateResponse
|
response *promptkit.GenerateResponse
|
||||||
|
|||||||
@@ -9,11 +9,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/fstest"
|
"testing/fstest"
|
||||||
|
|
||||||
configkit "go.maximumdirect.net/configkit"
|
|
||||||
promptkit "go.maximumdirect.net/promptkit"
|
|
||||||
"go.maximumdirect.net/ckconfig"
|
"go.maximumdirect.net/ckconfig"
|
||||||
"go.maximumdirect.net/ckprompt"
|
"go.maximumdirect.net/ckprompt"
|
||||||
commandkit "go.maximumdirect.net/commandkit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
|
configkit "go.maximumdirect.net/configkit"
|
||||||
|
promptkit "go.maximumdirect.net/promptkit"
|
||||||
"go.yaml.in/yaml/v4"
|
"go.yaml.in/yaml/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -224,8 +224,7 @@ func TestPublicConfigDiffDiscoveryAndNarrowedCapabilities(t *testing.T) {
|
|||||||
func comparisonEngine(t *testing.T, greeting string) *promptkit.Engine {
|
func comparisonEngine(t *testing.T, greeting string) *promptkit.Engine {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
configuration := `prompts:
|
configuration := `prompts:
|
||||||
briefing:
|
- id: briefing
|
||||||
version: "1"
|
|
||||||
default_profile: default
|
default_profile: default
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -234,10 +233,10 @@ func comparisonEngine(t *testing.T, greeting string) *promptkit.Engine {
|
|||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
backends:
|
backends:
|
||||||
local:
|
- id: local
|
||||||
endpoint: "https://example.invalid/v1"
|
endpoint: "https://example.invalid/v1"
|
||||||
profiles:
|
profiles:
|
||||||
default:
|
- id: default
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
`
|
`
|
||||||
@@ -248,7 +247,7 @@ profiles:
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}})
|
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}}, promptkit.WithBundledOpenRouter(false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("construct comparison engine: %v", err)
|
t.Fatalf("construct comparison engine: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/fstest"
|
"testing/fstest"
|
||||||
|
|
||||||
configkit "go.maximumdirect.net/configkit"
|
|
||||||
promptkit "go.maximumdirect.net/promptkit"
|
|
||||||
"go.maximumdirect.net/ckconfig"
|
"go.maximumdirect.net/ckconfig"
|
||||||
"go.maximumdirect.net/ckprompt"
|
"go.maximumdirect.net/ckprompt"
|
||||||
commandkit "go.maximumdirect.net/commandkit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
|
configkit "go.maximumdirect.net/configkit"
|
||||||
|
promptkit "go.maximumdirect.net/promptkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type compositionInput struct{ Campaign commandkit.Supplied[string] }
|
type compositionInput struct{ Campaign commandkit.Supplied[string] }
|
||||||
@@ -144,8 +144,7 @@ func TestPromptKitAliasesComposeWithInstalledOperations(t *testing.T) {
|
|||||||
func TestPublicConfigurationAndDefinitionFamiliesRemainIndependent(t *testing.T) {
|
func TestPublicConfigurationAndDefinitionFamiliesRemainIndependent(t *testing.T) {
|
||||||
inputs, err := promptkit.FilesystemInputs("composition fixture", fstest.MapFS{
|
inputs, err := promptkit.FilesystemInputs("composition fixture", fstest.MapFS{
|
||||||
"config/prompts.yml": &fstest.MapFile{Data: []byte(`prompts:
|
"config/prompts.yml": &fstest.MapFile{Data: []byte(`prompts:
|
||||||
briefing:
|
- id: briefing
|
||||||
version: "1"
|
|
||||||
default_profile: default
|
default_profile: default
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -154,17 +153,17 @@ func TestPublicConfigurationAndDefinitionFamiliesRemainIndependent(t *testing.T)
|
|||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
backends:
|
backends:
|
||||||
local:
|
- id: local
|
||||||
endpoint: "https://example.invalid/v1"
|
endpoint: "https://example.invalid/v1"
|
||||||
profiles:
|
profiles:
|
||||||
default:
|
- id: default
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
`)}}, "config")
|
`)}}, "config")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}})
|
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{Underlays: []configkit.Underlay{{Inputs: inputs}}}}, promptkit.WithBundledOpenRouter(false))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("construct engine: %v", err)
|
t.Fatalf("construct engine: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,15 +9,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
promptkit "go.maximumdirect.net/promptkit"
|
|
||||||
"go.maximumdirect.net/ckconfig"
|
"go.maximumdirect.net/ckconfig"
|
||||||
commandkit "go.maximumdirect.net/commandkit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
|
promptkit "go.maximumdirect.net/promptkit"
|
||||||
"go.yaml.in/yaml/v4"
|
"go.yaml.in/yaml/v4"
|
||||||
)
|
)
|
||||||
|
|
||||||
const requirementsCommandPrompt = `prompts:
|
const requirementsCommandPrompt = `prompts:
|
||||||
briefing:
|
- id: briefing
|
||||||
version: "2"
|
|
||||||
default_profile: editorial
|
default_profile: editorial
|
||||||
session_id: '{{input "session-only"}} {{.session_variable}}'
|
session_id: '{{input "session-only"}} {{.session_variable}}'
|
||||||
messages:
|
messages:
|
||||||
@@ -26,8 +25,7 @@ const requirementsCommandPrompt = `prompts:
|
|||||||
output:
|
output:
|
||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
required-variable:
|
- id: required-variable
|
||||||
version: "1"
|
|
||||||
default_profile: editorial
|
default_profile: editorial
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -35,7 +33,7 @@ const requirementsCommandPrompt = `prompts:
|
|||||||
output:
|
output:
|
||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
ambiguous-first:
|
- id: ambiguous-first
|
||||||
default_profile: editorial
|
default_profile: editorial
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -43,7 +41,7 @@ const requirementsCommandPrompt = `prompts:
|
|||||||
output:
|
output:
|
||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
ambiguous-second:
|
- id: ambiguous-second
|
||||||
default_profile: editorial
|
default_profile: editorial
|
||||||
messages:
|
messages:
|
||||||
- role: user
|
- role: user
|
||||||
@@ -52,10 +50,10 @@ const requirementsCommandPrompt = `prompts:
|
|||||||
format: text
|
format: text
|
||||||
validation_mode: none
|
validation_mode: none
|
||||||
backends:
|
backends:
|
||||||
local:
|
- id: local
|
||||||
endpoint: "https://example.invalid/v1"
|
endpoint: "https://example.invalid/v1"
|
||||||
profiles:
|
profiles:
|
||||||
editorial:
|
- id: editorial
|
||||||
backend: local
|
backend: local
|
||||||
model: example
|
model: example
|
||||||
api_key_required: true
|
api_key_required: true
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"testing/fstest"
|
"testing/fstest"
|
||||||
|
|
||||||
configkit "go.maximumdirect.net/configkit"
|
|
||||||
promptkit "go.maximumdirect.net/promptkit"
|
|
||||||
"go.maximumdirect.net/ckconfig"
|
"go.maximumdirect.net/ckconfig"
|
||||||
commandkit "go.maximumdirect.net/commandkit"
|
commandkit "go.maximumdirect.net/commandkit"
|
||||||
|
configkit "go.maximumdirect.net/configkit"
|
||||||
|
promptkit "go.maximumdirect.net/promptkit"
|
||||||
)
|
)
|
||||||
|
|
||||||
type validationFailOnGenerate struct{ calls int }
|
type validationFailOnGenerate struct{ calls int }
|
||||||
@@ -37,7 +37,7 @@ func validationTestEngine(t *testing.T, configuration string, options ...promptk
|
|||||||
}
|
}
|
||||||
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
engine, err := promptkit.NewEngine(promptkit.Config{Sources: promptkit.ConfigurationSources{
|
||||||
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
Underlays: []configkit.Underlay{{Inputs: inputs}},
|
||||||
}}, options...)
|
}}, append([]promptkit.Option{promptkit.WithBundledOpenRouter(false)}, options...)...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("construct PromptKit validation fixture: %v", err)
|
t.Fatalf("construct PromptKit validation fixture: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user