<!-- task=m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression plan=3 tag=REVIEW_REVIEW_TEST -->

# Enforce exact dev-corp document preservation in the Pi regression

## For the Implementing Agent

Filling the implementation-owned sections of `CODE_REVIEW-*-G??.md` is the mandatory final implementation step. Make only the scoped assertion correction, run every verification command against the final file, paste actual output, keep the active PLAN/review files in place, and report ready for review. If blocked, record the exact blocker, attempted commands/output, and resume condition only in implementation-owned evidence. Do not ask the user, call user-input tools, create control-plane stop files, classify the next state, archive logs, or write `complete.log`; finalization belongs to the code-review skill.

## Background

The second review confirmed that the isolated installer suite passes, but its claimed full dev-corp preservation check still permits unexpected nested fields. The same review also found that one recorded deterministic-search line number did not match the final source. This follow-up is limited to one exact dictionary assertion and fresh evidence capture.

## Archive Evidence Snapshot

- Prior plan: `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/plan_local_G01_02.log`.
- Prior review: `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/code_review_cloud_G01_02.log`.
- Verdict: FAIL; 2 Required, 0 Suggested, 0 Nit.
- Required findings: replace the field projections with exact dev-corp dictionary equality, then rerun every fixed verification command and record output from the final source.
- Affected implementation file: `agent-client/pi/install_test.py`; production installer and README remain unchanged.
- Fresh reviewer evidence: the four normal tests and shell/diff checks pass, while a focused test-owned mutation added `unexpectedInstallerMutation` to dev-corp and the preservation test still passed (`MUTATION_UNDETECTED=true`).
- Roadmap carryover: this child contributes Pi evidence for S08 but has no `Roadmap Targets`; PASS must not check a Milestone Task id directly.

## Analysis

### Files Read

- `agent-client/pi/install_test.py`
- `agent-client/pi/install.sh`
- `agent-client/pi/README.md`
- `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/PLAN-local-G01.md`
- `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/CODE_REVIEW-cloud-G01.md`
- `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/plan_local_G01_01.log`
- `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/code_review_cloud_G01_01.log`
- `agent-roadmap/phase/operational-observability-provider-management/PHASE.md`
- `agent-roadmap/phase/operational-observability-provider-management/milestones/multi-provider-protocol-profile-native-messages.md`
- `agent-roadmap/sdd/operational-observability-provider-management/multi-provider-protocol-profile-native-messages/SDD.md`
- `agent-test/local/rules.md`
- `agent-test/local/testing-smoke.md`

### SDD Criteria

- SDD: `agent-roadmap/sdd/operational-observability-provider-management/multi-provider-protocol-profile-native-messages/SDD.md`; status `[approved]`, lock released.
- Targeted scenario: S08 / `responses-regression`, mapped to Milestone Task `responses-regression` and requiring the existing Pi Responses consumption path to remain unchanged.
- Evidence Map: S08 requires deterministic existing-Responses regression evidence. The exact preservation assertion and final real-installer test run supply Pi consumer evidence without adding a direct Roadmap completion claim.

### Verification Context

- Handoff: current FAIL findings, current source, and fresh reviewer execution in the local checkout.
- Preconditions: archived predecessor completion exists at `agent-task/archive/2026/08/m-multi-provider-protocol-profile-native-messages/02+01_messages_ingress/complete.log`; `/bin/python3` reports Python 3.12.3.
- Required criteria: the real installer runs only with test-created HOME roots; the full dev-corp dictionary fails on added, removed, or changed data; all four tests, shell syntax, deterministic source searches, and `git diff --check` pass.
- Constraints: no live credential, network, OS-user home read, production installer change, or repository-local verification artifact.
- External Verification Preflight: not applicable; all required verification executes in the current checkout with temporary homes.
- Gap and confidence: the gap is directly reproduced and isolated to `agent-client/pi/install_test.py:176-183`; confidence is high.

### Test Coverage Gaps

- Exact dev-corp preservation: not covered. The current four field assertions allow unexpected keys, proven by the focused reviewer mutation.
- Existing defaults, complete rerun idempotency, required test names, fake keys, and decoy/installer HOME separation: covered by the current suite.

### Symbol References

- None. No symbol rename or removal is planned.

### Split Judgment

- Keep one compact follow-up. The fixture value and its exact assertion are one regression oracle with one deterministic PASS boundary.
- Runtime dependency `02` remains satisfied by the archived predecessor `complete.log` cited above.

### Scope Rationale

- Change only `agent-client/pi/install_test.py` and implementation-owned evidence in the active review stub.
- Do not change `agent-client/pi/install.sh`, `agent-client/pi/README.md`, Edge/Node code, contracts, specs, roadmap state, or sibling task artifacts because the reviewer observed no production behavior failure.

### Final Routing

- `evaluation_mode=isolated-reassessment`; finalizer=`finalize-task-policy.sh` pair mode.
- Build closures: scope/context/verification/evidence/ownership/decision are all true; capability gap: none.
- Build grade scores: scope_coupling=0, state_concurrency=0, blast_irreversibility=0, evidence_diagnosis=0, verification_complexity=1; grade G01; base route=`local-fit`.
- Build signals: `large_indivisible_context=false`, matched loop risk=`structured_interpretation`, loop risk count=1, `review_rework_count=2`, `evidence_integrity_failure=true`; recovery boundary matched; final route=`recovery-boundary`, cloud.
- Review closures are all true; grade scores 0/0/0/0/1; route=`official-review`, cloud, Codex `gpt-5.6-sol`, xhigh.
- Canonical files: `PLAN-cloud-G01.md`, `CODE_REVIEW-cloud-G01.md`.

## Dependencies and Execution Order

1. Confirm the archived predecessor completion remains present.
2. Replace the projection assertions with exact document equality, then run all commands against the final source before filling review evidence.

## Implementation Checklist

- [ ] Store the seeded dev-corp provider as one expected dictionary and assert exact dictionary equality after installation so additions, removals, and nested changes fail.
- [ ] Run the focused verbose Python, shell syntax, deterministic exact-assertion/name/home searches, and diff verification against the final file with no live credential, network, or user-home access.
- [ ] Fill implementation-owned sections in CODE_REVIEW-*-G??.md with actual implementation notes and verification output.

### [REVIEW_REVIEW_TEST-1] Compare the complete dev-corp provider document

#### Problem

`agent-client/pi/install_test.py:176-183` labels its checks as full document equality but compares only `apiKey`, `baseUrl`, `api`, and `models`. An installer regression that adds another dev-corp field therefore passes, as proven by the reviewer mutation reproducer.

#### Solution

Before (`agent-client/pi/install_test.py:110-117`, `176-183`):

```python
"dev-corp": {
    "baseUrl": "https://dev.corp.example.com/v1",
    "api": "openai-chat",
    "apiKey": "sk-DEV-CORP-KEY",
    "models": [{"id": "dev-model-1", "name": "Dev Corp Model"}],
},

dev = models["providers"]["dev-corp"]
self.assertEqual(dev["apiKey"], "sk-DEV-CORP-KEY")
self.assertEqual(dev["baseUrl"], "https://dev.corp.example.com/v1")
self.assertEqual(dev["api"], "openai-chat")
self.assertEqual(dev["models"], [{"id": "dev-model-1", "name": "Dev Corp Model"}])
```

After:

```python
self.expected_dev_corp = {
    "baseUrl": "https://dev.corp.example.com/v1",
    "api": "openai-chat",
    "apiKey": "sk-DEV-CORP-KEY",
    "models": [{"id": "dev-model-1", "name": "Dev Corp Model"}],
}

"dev-corp": self.expected_dev_corp,

dev = models["providers"]["dev-corp"]
self.assertEqual(dev, self.expected_dev_corp)
```

#### Modified Files and Checklist

- [ ] `agent-client/pi/install_test.py`: reuse one expected dev-corp dictionary in the fixture and assert exact post-install equality.

#### Test Strategy

Update the existing `test_preserves_openai_responses_consumption_and_user_settings` oracle; do not add another test method. Exact dictionary equality must reject any additional, missing, changed, or nested dev-corp data while the existing isolated real-installer execution covers the production path.

#### Verification

```bash
python3 agent-client/pi/install_test.py -v
rg -n --sort path 'self\.assertEqual\(dev, self\.expected_dev_corp\)' agent-client/pi/install_test.py
```

Expected: all four tests pass, and the exact document assertion appears once.

## Modified Files Summary

| File | Items |
|------|-------|
| `agent-client/pi/install_test.py` | REVIEW_REVIEW_TEST-1 |
| `agent-task/m-multi-provider-protocol-profile-native-messages/04+02_pi_responses_regression/CODE_REVIEW-cloud-G01.md` | evidence |

## Final Verification

```bash
test -f agent-task/archive/2026/08/m-multi-provider-protocol-profile-native-messages/02+01_messages_ingress/complete.log
command -v python3 && python3 --version
python3 agent-client/pi/install_test.py -v
bash -n agent-client/pi/install.sh
rg -n --sort path 'self\.assertEqual\(dev, self\.expected_dev_corp\)' agent-client/pi/install_test.py
rg -n --sort path 'def test_(preserves_openai_responses_consumption_and_user_settings|is_idempotent)\(' agent-client/pi/install_test.py
if rg -n --sort path 'Path\.home\(\)|os\.path\.expanduser|getpwuid\(|pwd\.getpw' agent-client/pi/install_test.py; then echo 'unsafe live-home access remains' >&2; exit 1; fi
git diff --check
```

Expected: the predecessor exists; Python is available; all isolated tests and shell syntax pass; the exact preservation assertion and required test names are found; no live-home symbol remains; the diff is clean.

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