# Plan: Post-live-suite follow-ups (4 small fixes, one PR)

Follow-ups from the PR #257 live-suite work, batched into one PR. All facts marked
VERIFIED below were confirmed live by the reviewer on 2026-07-10 (sandbox course
260866, canvas.asu.edu) — treat as ground truth, do not re-probe, never run
`ASUCB_LIVE_TEST=1`.

## 1. Reviewer enum in agent_review_and_merge.py

`scripts/agent_review_and_merge.py:35` has `VALID_REVIEWERS = {"codex", "opus",
"opus-extra-high"}` — predates current models and blocked an honest merge-gate run.

- Add `"fable"` to `VALID_REVIEWERS`. Keep the existing three.
- Update the module docstring (lines ~13, ~19) and `--reviewer` help text to match.
- Update tests: `tests/test_agent_review_and_merge.py` pins membership (~lines
  314–320) and an exact-set assertion (~line 323) — extend both; add a
  `test_fable_is_valid`. Check `tests/test_agent_review_merge_security.py` for
  enum references too.
- Update CLAUDE.md §PR-Only Workflow: reviewer wording "Codex OR Opus 4.7 Extra
  High" → "Codex OR a high-capability Claude reviewer (Opus 4.7 Extra High,
  Fable 5)" — minimal edit, both places it appears (roles list + auto-merge gate
  sentence + the `--reviewer {codex|opus|opus-extra-high}` usage line becomes
  `{codex|opus|opus-extra-high|fable}`). The user explicitly authorized this
  procedural-contract edit in chat on 2026-07-10.
- Update AGENTS.md (~line 101) reviewer wording only if it names Opus as the
  parent fallback — make it "the parent session" so it stays model-agnostic.
  AGENTS.md must not contradict CLAUDE.md.

## 2. Release checklist: live suite before tagging

- CLAUDE.md Write Rule 4 (the release-checklist paragraph): add one sentence —
  before tagging a release, run the live integration suite against the sandbox:
  `ASUCB_LIVE_TEST=1 .venv/bin/python3 -m pytest tests/integration/ -q`
  (course 260866; see tests/integration/README.md).
- AGENTS.md release sentence (~line 101): append the same step in its condensed
  style ("plus a live-suite run (`ASUCB_LIVE_TEST=1`) before tagging").

## 3. ResourceWarnings in test_setup_env_init.py

Repro: `.venv/bin/python3 -m pytest tests/test_setup_env_init.py -q -W error::Warning`
→ 3 failures: `ResourceWarning: unclosed file ... T/tmp*/.env mode='r'` plus
PytestUnraisableExceptionWarning on `_io.FileIO ... mode='rb'`.

- Root-cause first: scripts/setup_env.py uses context managers throughout, so the
  leak is likely in the test file itself or in how dotenv is invoked from the
  tests. Find the actual unclosed handle (e.g. `python -X dev` or tracemalloc via
  `-W error::ResourceWarning` traceback), then fix at the source.
- If the leak is in scripts/ code after all, the fix there is in-scope (this is
  the one item allowed to touch scripts/ besides agent_review_and_merge.py).
- Acceptance: the repro command passes 12/12 with `-W error::Warning`.

## 4. Pin HTML-entity serialization in the live roundtrip tests

VERIFIED live 2026-07-10 (create_page + get_page round-trip, course 260866):

    input:    <p>ITEST-E1: Fish &amp; Chips</p><p>ITEST-E2: 3 &lt; 5</p>
              <p>ITEST-E3: “Hello” and it’s fine</p><p>ITEST-E4: before — after</p>
    returned: byte-identical — entities stay entities (&amp;, &lt;), curly
              quotes and em-dash stay literal Unicode.

- In `tests/integration/test_live_html_roundtrip.py` `TestHtmlEntities`, replace
  the tolerant either-form assertions with exact pins:
  - `test_ampersand_entity_survives`: assert `"Fish &amp; Chips" in returned`.
  - `test_lt_entity_survives`: assert `"3 &lt; 5" in returned`.
  - `test_curly_quotes_survive`: assert the literal Unicode forms
    (`"“Hello”" in returned` and `"it’s" in returned`).
  - `test_em_dash_survives`: assert `"—" in returned`.
- Update the class + module docstrings: these are now live-verified (2026-07-10,
  course 260866, reviewer probe); remove the "not independently confirmed" caveat
  for entities. Update tests/integration/README.md pinned-behaviors list.

## Process & acceptance

- Branch `fix/live-suite-followups`, one commit, conventional title:
  `fix: post-live-suite follow-ups (reviewer enum, release checklist, env warnings, entity pinning)`
  with the Claude Sonnet Co-Authored-By trailer. Open PR to main.
- Only files touched: scripts/agent_review_and_merge.py, the two test files named
  above, tests/integration/README.md, CLAUDE.md, AGENTS.md, (setup_env.py or
  tests/test_setup_env_init.py per §3 root cause), and this plan doc.
- `.venv/bin/python3 -m pytest tests/ -q` fully green (integration tests skip).
- `.venv/bin/python3 -m pytest tests/test_setup_env_init.py -q -W error::Warning` green.
- Do NOT bump VERSION/manifests/CHANGELOG — release cut is decided post-merge.
- Never set ASUCB_LIVE_TEST. Reviewer re-runs the live suite before merge.
