diff --git a/harness/composition_test.go b/harness/composition_test.go index 2756639..173443d 100644 --- a/harness/composition_test.go +++ b/harness/composition_test.go @@ -590,11 +590,11 @@ func TestAcceptedPureRequestIdentitiesRecordInOrder(t *testing.T) { for _, restored := range []bool{false, true} { view := newRequestView(capture, "", testEntryID, nil) reasserted := capture.SystemPrompt - view.recordPure(HookIdentity{ExtensionID: "ext.test", HookID: "pure.noop"}, RequestConsequence{Prompt: &reasserted}) + view.recordAccepted(HookIdentity{ExtensionID: "ext.test", HookID: "pure.noop"}, RequestConsequence{Prompt: &reasserted}) if restored { changed, baseline := "changed", capture.SystemPrompt - view.recordPure(HookIdentity{ExtensionID: "ext.test", HookID: "pure.change"}, RequestConsequence{Prompt: &changed}) - view.recordPure(HookIdentity{ExtensionID: "ext.test", HookID: "pure.restore"}, RequestConsequence{Prompt: &baseline}) + view.recordAccepted(HookIdentity{ExtensionID: "ext.test", HookID: "pure.change"}, RequestConsequence{Prompt: &changed}) + view.recordAccepted(HookIdentity{ExtensionID: "ext.test", HookID: "pure.restore"}, RequestConsequence{Prompt: &baseline}) } evidence := view.evidenceFor() want := []HookIdentity{{ExtensionID: "ext.test", HookID: "pure.noop"}} diff --git a/harness/context.go b/harness/context.go index db43d6a..fd3f21a 100644 --- a/harness/context.go +++ b/harness/context.go @@ -152,19 +152,12 @@ func (v *requestView) applyConsequence(con RequestConsequence) { } } -// recordPure applies one accepted pure consequence and records its identity. +// recordAccepted applies one accepted consequence and records its identity. // Every successfully accepted hook identity — pure or effectful, no-op, // changed or restored alike — enters the contributors once, in configured -// order; a rejected or failed consequence never does. -func (v *requestView) recordPure(identity HookIdentity, con RequestConsequence) { - v.applyConsequence(con) - v.contributors = append(v.contributors, identity) -} - -// recordEffectful applies the codec-adopted committed consequence of one -// settled effectful hook and records its identity unconditionally, including -// for a reasserted no-op. -func (v *requestView) recordEffectful(identity HookIdentity, con RequestConsequence) { +// order; a rejected or failed consequence never does. Validation, effect +// timing and codec adoption stay with the caller. +func (v *requestView) recordAccepted(identity HookIdentity, con RequestConsequence) { v.applyConsequence(con) v.contributors = append(v.contributors, identity) } diff --git a/harness/effect.go b/harness/effect.go index 55ac589..d87e018 100644 --- a/harness/effect.go +++ b/harness/effect.go @@ -2545,7 +2545,7 @@ func (h *Harness) runRequestHooks(ctx context.Context, c *coordinator, operation if err != nil { return err } - view.recordPure(HookIdentity{ExtensionID: hook.ExtensionID, HookID: hook.ID}, consequence) + view.recordAccepted(HookIdentity{ExtensionID: hook.ExtensionID, HookID: hook.ID}, consequence) continue } if err := h.runRequestHookEffect(ctx, c, operationID, hook, requestID, view); err != nil { @@ -2654,7 +2654,7 @@ func (h *Harness) runRequestHookEffect(ctx context.Context, c *coordinator, oper return cerr } applied := *entry.Consequence - view.recordEffectful(HookIdentity{ExtensionID: hook.ExtensionID, HookID: hook.ID}, applied) + view.recordAccepted(HookIdentity{ExtensionID: hook.ExtensionID, HookID: hook.ID}, applied) return nil } diff --git a/harness/payload.go b/harness/payload.go index cd4feaf..536570c 100644 --- a/harness/payload.go +++ b/harness/payload.go @@ -3741,8 +3741,8 @@ func decodeMessageToolCall(raw json.RawMessage) (model.ToolCall, error) { // decodeMessageValue reads one message value with exact keys and // reconstructs it through the shared message constructor, which re-enforces -// the closed role set, per-role source rules, and deep ownership. An empty or -// null name is rejected and absence is the unnamed zero value. +// the closed role set, per-role source rules, and deep ownership. A null name +// is rejected; an empty string or absence is the unnamed zero value. func decodeMessageValue(raw json.RawMessage) (model.Message, error) { obj, err := decodePayloadObject(raw) if err != nil {