Keep native execution membership presentation stable
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
# Library Adoption Implementation Plan
|
# Library Adoption Implementation Plan
|
||||||
|
|
||||||
**Status:** Implementation complete; [review remediation](remediation.md) is in progress.
|
**Status:** Implementation complete; [review remediation](remediation.md) is complete.
|
||||||
Planning baseline:
|
Planning baseline:
|
||||||
`12fd2fba6b88e30eb482227ac786201caa84616b`.
|
`12fd2fba6b88e30eb482227ac786201caa84616b`.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ConfigKit, PromptKit, and CommandKit Upgrade
|
# ConfigKit, PromptKit, and CommandKit Upgrade
|
||||||
|
|
||||||
**Status:** Implementation complete; [review remediation](remediation.md) is in progress.
|
**Status:** Implementation complete; [review remediation](remediation.md) is complete.
|
||||||
The [implementation plan](implementation.md) records the completed stages.
|
The [implementation plan](implementation.md) records the completed stages.
|
||||||
|
|
||||||
**Reviewed:** 2026-11-23, against Audita commit
|
**Reviewed:** 2026-11-23, against Audita commit
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# Library Adoption Remediation
|
# Library Adoption Remediation
|
||||||
|
|
||||||
**Status:** Findings from the implementation, integration, and algorithm
|
**Status:** Findings from the implementation, integration, and algorithm
|
||||||
reviews; remediation is in progress.
|
reviews; all five issues are complete.
|
||||||
|
|
||||||
**Reviewed source:** `338e93a7ebda9a86593069d63f9d5a7fe23ccaf5`
|
**Reviewed source:** `338e93a7ebda9a86593069d63f9d5a7fe23ccaf5`
|
||||||
(`Complete library adoption validation and cleanup`).
|
(`Complete library adoption validation and cleanup`).
|
||||||
@@ -17,7 +17,7 @@ The intended architecture is substantially in place. The initial review found
|
|||||||
test-maintenance and documentation gaps; the follow-up integration review also
|
test-maintenance and documentation gaps; the follow-up integration review also
|
||||||
confirmed an output-safety gap involving operator-owned schema files.
|
confirmed an output-safety gap involving operator-owned schema files.
|
||||||
The algorithm review adds a debug-assembly memory opportunity and a diagnostic
|
The algorithm review adds a debug-assembly memory opportunity and a diagnostic
|
||||||
ordering defect. R1–R3 remain outstanding.
|
ordering defect. Completion markers below record the fixes.
|
||||||
|
|
||||||
## R1: Remove the Test Fixtures' Implicit YAML Layout Requirement
|
## R1: Remove the Test Fixtures' Implicit YAML Layout Requirement
|
||||||
|
|
||||||
@@ -226,6 +226,10 @@ limit, benchmark gate, or change to the debug artifact schema.
|
|||||||
|
|
||||||
## R5: Order Native Group Members at the Debug Presentation Boundary
|
## R5: Order Native Group Members at the Debug Presentation Boundary
|
||||||
|
|
||||||
|
**Complete.** The diagnostic serializer sorts detached native membership lists
|
||||||
|
for invocation and per-call summaries. Deterministic permutation tests pass
|
||||||
|
and verify original snapshot ownership, native facts, and event order.
|
||||||
|
|
||||||
**Priority:** P3 — deterministic diagnostic presentation.
|
**Priority:** P3 — deterministic diagnostic presentation.
|
||||||
|
|
||||||
**Affected code:**
|
**Affected code:**
|
||||||
@@ -327,3 +331,11 @@ performance data and made no application-code changes. Existing tests for
|
|||||||
`internal/framework/llm`, `internal/framework/processreport`, and
|
`internal/framework/llm`, `internal/framework/processreport`, and
|
||||||
`internal/framework/runner` passed; remediation links and whitespace checks
|
`internal/framework/runner` passed; remediation links and whitespace checks
|
||||||
also passed.
|
also passed.
|
||||||
|
|
||||||
|
## Remediation Validation
|
||||||
|
|
||||||
|
All five issues are complete. With Go 1.27.4, `go test -race ./...`,
|
||||||
|
`go vet ./...`, and `go mod tidy -diff` passed on the completed code.
|
||||||
|
Linux amd64 and arm64 builds succeeded. Changed Go files are formatted;
|
||||||
|
affected local documentation links and whitespace checks passed. Each issue
|
||||||
|
was addressed in its own commit with the completion marker recorded above.
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package processreport
|
package processreport
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"slices"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
|
"gitea.maximumdirect.net/eric/audita/v4/internal/framework/llm"
|
||||||
@@ -49,14 +51,27 @@ func BuildLLMExecution(snapshot llm.ObservationSnapshot) any {
|
|||||||
RequestedPromptID: call.RequestedPromptID, CallID: call.CallID, Context: call.Context,
|
RequestedPromptID: call.RequestedPromptID, CallID: call.CallID, Context: call.Context,
|
||||||
Prompt: call.Prompt, Started: call.Started, Finished: finished,
|
Prompt: call.Prompt, Started: call.Started, Finished: finished,
|
||||||
ElapsedMS: call.WallDuration.Milliseconds(), Failure: call.Failure,
|
ElapsedMS: call.WallDuration.Milliseconds(), Failure: call.Failure,
|
||||||
PromptKit: group.Snapshot(),
|
PromptKit: orderedMembers(group.Snapshot()),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return struct {
|
return struct {
|
||||||
Summary llm.ExecutionSummary `json:"summary"`
|
Summary llm.ExecutionSummary `json:"summary"`
|
||||||
Calls []executionCall `json:"calls"`
|
Calls []executionCall `json:"calls"`
|
||||||
Events []llm.ExecutionObservation `json:"events"`
|
Events []llm.ExecutionObservation `json:"events"`
|
||||||
}{llm.Summarize(snapshot), calls, events}
|
}{orderedExecutionSummary(snapshot), calls, events}
|
||||||
|
}
|
||||||
|
|
||||||
|
// orderedMembers changes only the detached diagnostic presentation.
|
||||||
|
func orderedMembers(summary pk.ExecutionGroupSummary) pk.ExecutionGroupSummary {
|
||||||
|
summary.Members = slices.Clone(summary.Members)
|
||||||
|
slices.SortFunc(summary.Members, func(a, b pk.ExecutionGroupMember) int { return strings.Compare(a.RunID, b.RunID) })
|
||||||
|
return summary
|
||||||
|
}
|
||||||
|
|
||||||
|
func orderedExecutionSummary(snapshot llm.ObservationSnapshot) llm.ExecutionSummary {
|
||||||
|
summary := llm.Summarize(snapshot)
|
||||||
|
summary.PromptKit = orderedMembers(summary.PromptKit)
|
||||||
|
return summary
|
||||||
}
|
}
|
||||||
|
|
||||||
// IndexLLMObservations assigns the same proposal identities used by the ledger.
|
// IndexLLMObservations assigns the same proposal identities used by the ledger.
|
||||||
|
|||||||
@@ -160,3 +160,43 @@ func TestPerCallGroupsRetainCoverageAndDeduplicateTerminals(t *testing.T) {
|
|||||||
t.Fatalf("complete: %+v", complete)
|
t.Fatalf("complete: %+v", complete)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestNativeMembersHaveStableDetachedPresentation(t *testing.T) {
|
||||||
|
members := []pk.ExecutionGroupMember{{RunID: "z", TerminalObserved: true}, {RunID: "a"}}
|
||||||
|
snapshot := llm.ObservationSnapshot{
|
||||||
|
Calls: []llm.LogicalCall{{CallID: 1}},
|
||||||
|
Group: &pk.ExecutionGroupSummary{Members: members, Attempts: 7},
|
||||||
|
Events: []llm.ExecutionObservation{
|
||||||
|
{CallID: 1, PromptKit: pk.ExecutionEvent{RunID: "z", Kind: pk.ExecutionFinished, Attempts: 2}},
|
||||||
|
{CallID: 1, PromptKit: pk.ExecutionEvent{RunID: "a", Kind: pk.ExecutionAttempt}},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
raw, err := json.Marshal(BuildLLMExecution(snapshot))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
var report struct {
|
||||||
|
Summary llm.ExecutionSummary
|
||||||
|
Calls []executionCall
|
||||||
|
Events []llm.ExecutionObservation
|
||||||
|
}
|
||||||
|
if err := json.Unmarshal(raw, &report); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
for _, summary := range []pk.ExecutionGroupSummary{report.Summary.PromptKit, report.Calls[0].PromptKit} {
|
||||||
|
if len(summary.Members) != 2 || summary.Members[0].RunID != "a" || summary.Members[1].RunID != "z" || summary.Members[0].TerminalObserved || !summary.Members[1].TerminalObserved {
|
||||||
|
t.Fatalf("members: %+v", summary.Members)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if members[0].RunID != "z" || report.Summary.PromptKit.Attempts != 7 || report.Calls[0].PromptKit.Attempts != 2 || report.Events[0].PromptKit.RunID != "z" {
|
||||||
|
t.Fatal("rendering changed evidence or input")
|
||||||
|
}
|
||||||
|
snapshot.Group.Members = []pk.ExecutionGroupMember{members[1], members[0]}
|
||||||
|
again, err := json.Marshal(BuildLLMExecution(snapshot))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
if string(raw) != string(again) {
|
||||||
|
t.Fatal("membership permutation changed presentation")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user