Document and validate preflight readiness
This commit is contained in:
@@ -78,9 +78,11 @@ func verificationLine(result llm.ProfileVerification) string {
|
||||
value := "unknown"
|
||||
if count.count.Known {
|
||||
value = fmt.Sprintf("%d", count.count.Value)
|
||||
if !count.count.Complete {
|
||||
value += " (partial)"
|
||||
}
|
||||
}
|
||||
if count.count.Complete {
|
||||
value += " (complete)"
|
||||
} else {
|
||||
value += " (incomplete)"
|
||||
}
|
||||
parts = append(parts, count.name+"="+value)
|
||||
}
|
||||
|
||||
@@ -15,7 +15,9 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
|
||||
commandkit "go.maximumdirect.net/commandkit"
|
||||
pk "go.maximumdirect.net/promptkit"
|
||||
)
|
||||
|
||||
func TestPreflightBindingsAndRunAlias(t *testing.T) {
|
||||
@@ -181,3 +183,17 @@ func TestPreflightCancellationRetainsPartialProfileDiagnostics(t *testing.T) {
|
||||
t.Fatalf("status=%d calls=%d cause=%v stderr=%q", result.Status, calls, result.Cause, stderr.String())
|
||||
}
|
||||
}
|
||||
|
||||
func TestPreflightUsagePreservesUnknownAndCompleteness(t *testing.T) {
|
||||
report := &pk.SmokeTestReport{Usage: pk.ObservedTokenUsage{
|
||||
PromptTokens: pk.ObservedTokenCount{Known: true, Complete: false, Value: 4},
|
||||
CompletionTokens: pk.ObservedTokenCount{Known: true, Complete: true, Value: 0},
|
||||
TotalTokens: pk.ObservedTokenCount{Known: false, Complete: true},
|
||||
}}
|
||||
line := verificationLine(llm.ProfileVerification{ProfileID: "fixture", Status: llm.VerificationSuccess, Report: report})
|
||||
for _, want := range []string{"prompt=4 (incomplete)", "completion=0 (complete)", "total=unknown (complete)", "reasoning=unknown (incomplete)"} {
|
||||
if !strings.Contains(line, want) {
|
||||
t.Fatalf("missing %q in %q", want, line)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/chunking"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/diagnostics"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/core/reporting"
|
||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/processreport"
|
||||
@@ -39,11 +37,6 @@ func finishProcess(inv commandkit.Invocation, input processInput, prepared *prep
|
||||
}
|
||||
result := prepared.Prepared.Output.Finish(inv.Context, primary, transcript, render)
|
||||
if result != nil {
|
||||
var infeasible *chunking.InfeasibleTargetError
|
||||
var outputFailure diagnostics.FileFailure
|
||||
if inv.Context.Err() == nil && errors.As(result, &infeasible) && !errors.As(result, &outputFailure) {
|
||||
return commandkit.Usage(infeasible.Error()).WithCause(result)
|
||||
}
|
||||
return commandkit.Failure(result.Error()).WithCause(result)
|
||||
}
|
||||
_ = reporter.AtEnd().Info(reporting.CompletionLine(snapshot))
|
||||
|
||||
Reference in New Issue
Block a user