Carry optional prompt labels through results

This commit is contained in:
2026-10-17 05:54:32 +00:00
parent 8cbb7c0daf
commit ec3245c97e
40 changed files with 363 additions and 121 deletions

View File

@@ -80,7 +80,7 @@ type RunResult struct {
RawOutput string
Validation ValidationResult
PromptID string
PromptVersion string
PromptVersion *string
PromptHash string
SessionID string
RenderedPromptHash string
@@ -100,7 +100,7 @@ type RunResult struct {
// It must never include resolved API key values, model output, or validation data.
type PreparedRun struct {
PromptID string
PromptVersion string
PromptVersion *string
PromptHash string
SelectedProfileID string
SelectedBackendID string
@@ -137,13 +137,13 @@ type Artifact struct {
// PromptIdentity identifies one configured prompt and its descriptive version label.
type PromptIdentity struct {
ID string
Version string
Version *string
}
// PromptDefinition represents a configured prompt execution definition.
type PromptDefinition struct {
ID string `yaml:"id"`
Version string `yaml:"version"`
Version *string `yaml:"version"`
DefaultProfile string `yaml:"default_profile"`
Description string `yaml:"description"`
SessionID string `yaml:"session_id" json:"session_id,omitempty"`
@@ -156,7 +156,7 @@ type PromptDefinition struct {
// PromptInspection is the resolved result of exact prompt inspection.
type PromptInspection struct {
PromptID string
PromptVersion string
PromptVersion *string
PromptHash string
DefaultProfileID string
Inputs []PromptInput

View File

@@ -68,7 +68,7 @@ type ExecutionEvent struct {
RunID string
Time time.Time
PromptID string
PromptVersion string
PromptVersion *string
ProfileID string
BackendID string
Model string

View File

@@ -49,7 +49,7 @@ type RequirementIssue struct {
// RequirementInspection contains the inventories discovered for one prompt.
type RequirementInspection struct {
PromptID string
PromptVersion string
PromptVersion *string
ProfileID string
Inputs []InputRequirement
Variables []VariableRequirement

View File

@@ -65,7 +65,7 @@ type SmokeTestTarget struct {
BackendID string
ProfileID string
PromptID string
PromptVersion string
PromptVersion *string
DefaultSourceBackendID string
SelectionSource string
Endpoint string
@@ -180,6 +180,7 @@ func CloneSmokeTestRequest(request SmokeTestRequest) (SmokeTestRequest, error) {
func CloneSmokeTestReport(report SmokeTestReport) (SmokeTestReport, error) {
cloned := report
cloned.Applicable = cloneBool(report.Applicable)
cloned.Target.PromptVersion = cloneString(report.Target.PromptVersion)
cloned.Facts = cloneSmokeTestFacts(report.Facts)
cloned.Timing = cloneSmokeTestTiming(report.Timing)
var err error

View File

@@ -77,11 +77,15 @@ func TestCloneSmokeTestReportOwnsMutableValues(t *testing.T) {
reachable := true
status := 200
wait := 3 * time.Millisecond
promptVersion := "v1"
report := SmokeTestReport{
Applicable: &applicable,
Target: SmokeTestTarget{EffectiveSettings: ExecutionTarget{
ExtraParams: map[string]any{"nested": map[string]any{"value": "original"}},
}},
Target: SmokeTestTarget{
PromptVersion: &promptVersion,
EffectiveSettings: ExecutionTarget{
ExtraParams: map[string]any{"nested": map[string]any{"value": "original"}},
},
},
Facts: SmokeTestFacts{EndpointReachable: &reachable},
Attempts: []SmokeTestAttempt{{
HTTPStatus: &status,
@@ -99,9 +103,10 @@ func TestCloneSmokeTestReportOwnsMutableValues(t *testing.T) {
*cloned.Attempts[0].HTTPStatus = 503
*cloned.Attempts[0].Facts.EndpointReachable = false
*cloned.Attempts[0].Timing.CapacityWait = time.Second
*cloned.Target.PromptVersion = "changed"
cloned.Target.EffectiveSettings.ExtraParams["nested"].(map[string]any)["value"] = "changed"
if !applicable || !reachable || status != 200 || wait != 3*time.Millisecond {
if !applicable || !reachable || status != 200 || wait != 3*time.Millisecond || promptVersion != "v1" {
t.Fatal("cloned report shared optional scalar pointers")
}
if got := report.Target.EffectiveSettings.ExtraParams["nested"].(map[string]any)["value"]; got != "original" {