{
  "track_id": "test_batching_post_refactor_polish_20260607",
  "name": "Test Batching — Post-Refactor Polish",
  "initialized": "2026-06-08",
  "owner": "tier2-tech-lead",
  "priority": "medium",
  "status": "active",
  "type": "developer tooling + observability polish",
  "scope": {
    "new_files": [
      "scripts/test_failure_parser.py",
      "tests/test_test_failure_parser.py",
      "tests/test_live_gui_foregrounding.py"
    ],
    "modified_files": [
      "scripts/run_tests_batched.py",
      "tests/conftest.py",
      "tests/test_command_palette_sim.py",
      "tests/test_workflow_sim.py",
      "tests/test_undo_redo_sim.py"
    ],
    "deleted_files": "~45 scratch files in tests/artifacts/ (after reference verification)"
  },
  "blocked_by": {
    "test_batching_refactor_20260606": "must be SHIPPED before this track begins; the new orchestrator's _run_batch is the integration point"
  },
  "blocks": [],
  "estimated_phases": 5,
  "spec": "spec.md",
  "plan": "plan.md",
  "current_state_audit_commit": "2db14361",
  "current_state_audit": {
    "already_implemented": [
      "App._diag_layout_state() at src/gui_2.py:507-544 (commit 818537b3) — logs show_windows count, visible defaults, stale window name warnings",
      "manualslop_layout_default.ini at tests/artifacts/manualslop_layout_default.ini (2,699 bytes; whitelisted in .gitignore line 17)",
      "tests/conftest.py:418-421 copies the layout artifact into the test workspace (replaces the prior 'do NOT copy' block from 7a4f71e7)",
      "_default_windows updated at src/app_controller.py:1832-1855 (MMA Dashboard=False, Log Management=True, Diagnostics=True)",
      "_STALE_WINDOW_NAMES set at src/gui_2.py:530-533 (10 names; Theme removed)",
      "Skip markers from e09e6823 resolved in 8d58d7fc (warmup races), a36aad50 (gui_events_v2), 91b34ae8 (live_gui_filedialog), ff523f7e (project_switch_persona)",
      "RUN_MMA_INTEGRATION env-var gate at tests/test_mma_step_mode_sim.py:24-27 (opt-in integration gate, not a broken test)",
      "scripts/cleanup_orphaned_processes.py (commit 5e1867bb) — manages stale subprocesses; preserves MCP servers"
    ],
    "gaps_to_fill": [
      "New orchestrator (post-refactor) uses subprocess.run(capture_output=True) and only prints stdout tail on failure — no per-file failure list (regression in failure visibility vs current)",
      "_extract_failed_files (if implemented in refactor's Phase 0) is in the LEGACY script that gets renamed to .legacy in refactor's Phase 3, then deleted in Phase 4; needs to be lifted to a shared location",
      "live_gui fixture doesn't bring sloppy.py's window to front (conftest.py:live_gui)",
      "live_gui tests have no per-test focus signal",
      "tests/artifacts/ has ~45 scratch files (gitignored, but clutter the directory)"
    ]
  },
  "verification_criteria": [
    "scripts/test_failure_parser.py exists and exports extract_failed_files (no re import; grep returns empty)",
    "11+ unit tests in tests/test_test_failure_parser.py all pass",
    "Legacy run_tests_batched.py (if not yet deleted by refactor) imports extract_failed_files from the new module",
    "New run_tests_batched.py _run_batch calls extract_failed_files on captured output; per-file failure list in SUMMARY",
    "tests/conftest.py:_foreground_subprocess_window exists; 3 unit tests pass; live_gui fixture calls it after subprocess.Popen",
    "tests/conftest.py:focus_test_panel exists; 3+ *_sim.py tests call it in setup",
    "Scratch files from FR-19 deleted; directory contains only the preserved files/directories from FR-20",
    "Existing test suite still passes for batches 1-4 (no regressions)",
    "Batch 5's timeout (test_z_negative_flows) reported as exactly 1 failed file, not all 42",
    "All commits atomic per-task with descriptive messages",
    "No commits include the user's TOML files (config.toml, project.toml, project_history.toml)",
    "No commits include manualslop_layout.ini at the repo root"
  ],
  "anti_patterns_to_avoid": [
    "DO NOT use the native edit tool on .py files (destroys 1-space indent; use manual-slop_edit_file or manual-slop_py_update_definition)",
    "DO NOT use git restore / git checkout -- <file> / git reset without explicit user permission in the same message (HARD BAN)",
    "DO NOT commit the user's TOML files",
    "DO NOT add re (regex) to the failure parser (AGENTS.md standing ban)",
    "DO NOT add per-file re-run logic to the orchestrator",
    "DO NOT add inline comments to source code (docstrings are fine)",
    "DO NOT add new external dependencies (no pyproject.toml change)",
    "DO NOT use mock patches to pseudo API calls or hooks when the app source changes (adapt tests properly)"
  ],
  "links": {
    "spec": "spec.md",
    "plan": "plan.md",
    "parent_track": "conductor/tracks/test_batching_refactor_20260606/",
    "upstream_audit": "conductor/tracks/startup_speedup_20260606/state.toml (conftest_warmup_wait)",
    "architecture_docs": [
      "docs/guide_architecture.md",
      "docs/guide_testing.md",
      "docs/guide_api_hooks.md",
      "docs/guide_simulations.md"
    ],
    "policy_docs": [
      "AGENTS.md (no regex, no native edit, no git restore without permission)",
      "conductor/workflow.md (Skip-Marker Policy, Phase Completion Verification)",
      "conductor/product-guidelines.md (1-space indent, no comments, type hints)"
    ]
  }
}
