<!-- task=m-iop-owned-single-request-agent-execution/04+02_preset_refresh plan=2 tag=REVIEW_API milestone-task=preset-binding -->

# Make Preset Refresh Verification Exercise the Single-request Diff

## For the Implementing Agent

Implement this plan exactly within the listed write boundary, run every verification command, fill all implementation-owned sections of `CODE_REVIEW-cloud-G02.md` with actual notes and stdout/stderr, keep both active files in place, and report ready for review. Finalization belongs only to the code-review skill. If blocked, record exact blocker evidence, attempted commands/output, and the resume condition in implementation-owned evidence fields; do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`.

## Background

The classifier, example config, contract, and living spec passed review, but the required focused command did not execute the newly added single-request test. That separate test also left both ordering neighbors absent and compared only non-empty/different strings, so it did not prove the planned ordering or exact value capture. This follow-up changes only the existing classifier test and its review evidence.

## Archive Evidence Snapshot

- Closed pair: `plan_local_G05_1.log`, `code_review_cloud_G06_1.log`; verdict FAIL with Required R1 and no Suggested or Nit findings.
- Fresh reviewer evidence showed that `go test -v ./apps/edge/internal/configrefresh -run 'TestClassifyExecutionPresetLiveApply$' -count=1` ran only the original test, while the separate single-request test passed without producing `routes` or `workspace_tools` changes for its ordering checks.
- Fresh config-refresh package tests, Edge vet, full Edge regression, and `git diff --check` passed. The reviewer repaired formatting-only drift in the test file before closing the pair.
- Predecessor packet 02 remains satisfied by `agent-task/archive/2026/08/m-iop-owned-single-request-agent-execution/02+01_preset_binding/complete.log`; Milestone contribution remains `preset-binding` / SDD S02.

## Finding Resolution Map

| Finding | Mode | Exact fix | Changed precondition |
|---------|------|-----------|----------------------|
| Required R1 | `direct-fix` | Fold the single-request fixture into `TestClassifyExecutionPresetLiveApply`, remove the standalone vacuous case, include `routes`, `single_request`, and `workspace_tools` in one ordered result, and compare the single-request Previous/Next strings with the exact current/candidate policy values. | The exact focused command now executes the single-request assertions against present sibling changes instead of passing on an unrelated test and skipped index conditions. |

## Analysis

### Files Read

- `apps/edge/internal/configrefresh/execution_preset_classify_test.go`
- `apps/edge/internal/configrefresh/classify.go`
- `configs/edge.yaml`
- `agent-contract/inner/edge-config-runtime-refresh.md`
- `agent-spec/runtime/provider-pool-config-refresh.md`
- `agent-task/m-iop-owned-single-request-agent-execution/04+02_preset_refresh/plan_local_G05_1.log`
- `agent-task/m-iop-owned-single-request-agent-execution/04+02_preset_refresh/code_review_cloud_G06_1.log`
- `agent-task/archive/2026/08/m-iop-owned-single-request-agent-execution/02+01_preset_binding/complete.log`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/PHASE.md`
- `agent-roadmap/phase/knowledge-tool-optimization-extension/milestones/iop-owned-single-request-agent-execution.md`
- `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-owned-single-request-agent-execution/SDD.md`
- `agent-ops/rules/project/domain/edge/rules.md`
- `agent-ops/rules/project/domain/testing/rules.md`
- `agent-test/local/rules.md`
- `agent-test/local/edge-smoke.md`

### SDD Criteria

- SDD: `agent-roadmap/sdd/knowledge-tool-optimization-extension/iop-owned-single-request-agent-execution/SDD.md`; status approved, lock released, no user review.
- First-line Milestone task: `preset-binding`; targeted Acceptance Scenario: S02.
- S02/Evidence Map requires preset decode, authorization, public model echo, workspace snapshot, and config contract evidence. This child contributes refresh-path/schema evidence only; R1 must make that classifier evidence deterministic without asserting that the whole scenario is complete.

### Verification Context

- No external verification handoff was supplied. Repository-native sources were the active plan/review, Edge domain/test rules, local Edge smoke profile, classifier source/test, SDD, contract, and living spec.
- Local preflight: repository root `/config/workspace/iop-s0`, Go `go1.26.2 linux/arm64`, shared dirty worktree, and the unique archived packet 02 completion path above.
- Fresh reviewer commands proved the focused-command mismatch, while config-refresh package tests, `go vet ./apps/edge/...`, full fresh Edge tests, and `git diff --check` passed.
- Constraints: no external provider or credential is needed; preserve unrelated shared-worktree changes. Gap: exact single-request values and sibling ordering are not currently exercised by the required focused command. Confidence: high.

### Test Coverage Gaps

- `appendExecutionPresetChanges` emits the production `single_request` path, but the required focused command does not run the separate test that references it.
- The separate test changes only `single_request`; `routesIdx` and `wsIdx` remain `-1`, so the ordering conditions cannot fail.
- Previous/Next checks prove only non-empty unequal strings, not capture of the exact current and candidate policy snapshots.

### Symbol References

- No production symbol is renamed or removed. Delete only the redundant standalone test function after moving its assertions into `TestClassifyExecutionPresetLiveApply`.

### Split Judgment

- Keep one compact test-only packet: the focused command, ordered result fixture, and exact value assertions are one verification invariant.
- Subtask `04+02_preset_refresh` depends on predecessor index 02, satisfied by `agent-task/archive/2026/08/m-iop-owned-single-request-agent-execution/02+01_preset_binding/complete.log`.

### Scope Rationale

- Modify only the classifier test and active review evidence. Do not change classifier production code, config examples, contract/spec documents, preset validation, authorization, coordinator, provider execution, Node/workspace execution, protobuf, or SSE; fresh review found no issue in those completed portions.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer `finalize-task-policy.sh` in `pair` mode.
- Build closures for scope, context, verification, evidence, ownership, and decision are true; scores `0/0/0/1/1 = G02`; base `local-fit`, final `recovery-boundary`, lane `cloud`, canonical filename `PLAN-cloud-G02.md`.
- Build signals: `large_indivisible_context=false`, no matched loop-risk signatures (`loop_risk_count=0`), `review_rework_count=1`, `evidence_integrity_failure=true`; recovery boundary matched and risk boundary did not.
- Review closures are true; scores `0/0/0/1/1 = G02`; route `official-review`, lane `cloud`, canonical filename `CODE_REVIEW-cloud-G02.md`.
- Capability gap: none.

## Dependencies and Execution Order

1. Preserve the satisfied packet 02 dependency evidence.
2. Repair R1 in the existing classifier test, then run the focused and full regression commands.

## Implementation Checklist

- [ ] Resolve Required R1 in `TestClassifyExecutionPresetLiveApply`: exercise a changed single-request policy in the exact targeted test, assert the full deterministic sibling ordering, and compare exact Previous/Next values.
- [ ] Run dependency, formatting, focused fresh, config-refresh package, Edge vet, full fresh Edge regression, and `git diff --check` verification.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

## Implementation Plan

### [REVIEW_API-1] Restore deterministic single-request refresh evidence

**Problem**

- `apps/edge/internal/configrefresh/execution_preset_classify_test.go:103` defines the single-request case outside the function selected by the required command.
- `apps/edge/internal/configrefresh/execution_preset_classify_test.go:193` checks only empty/equal strings, and lines 209-224 allow absent route/workspace indices to skip every ordering assertion.
- `agent-task/m-iop-owned-single-request-agent-execution/04+02_preset_refresh/code_review_cloud_G06_1.log:98` therefore records a command/output pair that does not prove its following single-request claim.

**Solution**

Move the changed policy snapshots into the existing `preset-m-mod` current/candidate fixtures, retain that fixture's route and workspace-tool changes, add the `single_request` path to the full expected ordering, and compare its Previous/Next values with `fmt.Sprintf("%v", currentPolicy)` and `fmt.Sprintf("%v", candidatePolicy)`. Remove the standalone test so there is one authoritative focused oracle.

Before (`apps/edge/internal/configrefresh/execution_preset_classify_test.go:193`):

```go
if srChange.Previous == "" {
	t.Errorf("single_request change previous must not be empty")
}
if srChange.Next == "" {
	t.Errorf("single_request change next must not be empty")
}
if routesIdx >= 0 && srIdx >= 0 && routesIdx >= srIdx {
	t.Errorf("single_request path must appear after routes")
}
```

After:

```go
import (
	"fmt"
	"testing"
)

want := []expectedChange{
	// ... routes and selector ...
	{path: `execution_presets["preset-m-mod"].single_request`, class: configrefresh.StatusApplied},
	{path: `execution_presets["preset-m-mod"].workspace_tools`, class: configrefresh.StatusApplied},
}

if c.Path == `execution_presets["preset-m-mod"].single_request` {
	if c.Previous != fmt.Sprintf("%v", current.ExecutionPresets[1].SingleRequest) {
		t.Errorf("single_request previous = %q, want exact current snapshot", c.Previous)
	}
	if c.Next != fmt.Sprintf("%v", candidate.ExecutionPresets[1].SingleRequest) {
		t.Errorf("single_request next = %q, want exact candidate snapshot", c.Next)
	}
}
```

**Modified Files and Checklist**

- [ ] `apps/edge/internal/configrefresh/execution_preset_classify_test.go` — merge the policy change into the targeted fixture, assert the full order and exact values, and remove the standalone vacuous test.
- [ ] `agent-task/m-iop-owned-single-request-agent-execution/04+02_preset_refresh/CODE_REVIEW-cloud-G02.md` — record actual implementation and verification evidence.

**Test Strategy**

- Update the existing `TestClassifyExecutionPresetLiveApply` only. Its current route and workspace-tool diffs provide real ordering neighbors; the new single-request row and exact value assertions close R1 without another test file.

**Verification**

- `go test -v ./apps/edge/internal/configrefresh -run '^TestClassifyExecutionPresetLiveApply$' -count=1`
- Expected: the exact targeted test passes while executing the merged single-request path/order/value assertions.

## Modified Files Summary

| File | Item |
|------|------|
| `apps/edge/internal/configrefresh/execution_preset_classify_test.go` | REVIEW_API-1 |
| `agent-task/m-iop-owned-single-request-agent-execution/04+02_preset_refresh/CODE_REVIEW-cloud-G02.md` | REVIEW_API-1 |

## Final Verification

1. `test -f agent-task/m-iop-owned-single-request-agent-execution/02+01_preset_binding/complete.log || test "$(compgen -G 'agent-task/archive/*/*/m-iop-owned-single-request-agent-execution/02+01_preset_binding/complete.log' | wc -l)" -eq 1`
2. `test -z "$(gofmt -l apps/edge/internal/configrefresh/execution_preset_classify_test.go)"`
3. `go test -v ./apps/edge/internal/configrefresh -run '^TestClassifyExecutionPresetLiveApply$' -count=1`
4. `go test ./apps/edge/internal/configrefresh -count=1`
5. `go vet ./apps/edge/...`
6. `go test ./apps/edge/... -count=1`
7. `git diff --check`

Expected: all commands exit 0; the focused command executes the merged exact single-request assertion; the full expected list places `routes` before `single_request` and `single_request` before `workspace_tools`; Previous/Next equal the current/candidate policy renderings; no standalone vacuous test remains. Cached test output is not accepted because every Go test command uses `-count=1`.

**After completing all code changes, fill implementation-owned sections in `CODE_REVIEW-*-G??.md`.**
