Skip to content

Testing plan: clean up after a work item is closed

Derived from requirements.md and design.md. Each task in tasks.md names a row below.

Test matrix

#TypeApplies?Scope / what it provesWhere it runs
T1Unityescleanup.cleanup_work_item order, per-piece reporting, partial-failure isolation, dry run, portable record untouched (R1.1–1.4, R1.6, R4.1–4.3); control.parse_command accepts the new keyword and still refuses ambiguity (R2.1)uv run pytest cli/tests/test_cleanup.py cli/tests/test_control.py
T2Integration (scenario)yesThe three triggers end to end — authorized comment, close event with and without a sender, retroactive with no session record — against a real registry and a real Workspace on a temp git repo (R2.2, R3.1–3.4, R4.1–4.2, R6)uv run pytest cli/tests/test_cleanup_integration.py
T3Contract (OpenAPI)yesPOST /sessions/control accepts verb: cleanup; the documented verb list and CONTROL_VERBS agree (R2.5)uv run pytest cli/tests/test_api_routers_integration.py cli/tests/test_docs_parity.py
T4End-to-endn/a — an end-to-end run needs a live tmux server, a real harness CLI and a GitHub repo; T2 covers the same flow with the two native deps faked at their existing seams
T5UI / visualn/a — the-loop has no product UI
T6Snapshotn/a — no rendered artifact is asserted byte-for-byte
T7Performance / loadn/a — cleanup is a per-work-item, human-triggered action
T8Security / abuse caseyesThe four abuse cases from requirements.md: unauthorized commenter, close with no actor, PR merge on an open item, ambiguous commentuv run pytest cli/tests/test_cleanup_integration.py -k abuse
T9Accessibilityn/a — no UI
T10Migration / upgradeyesA pre-issue-186 session record and a pre-issue-186 graph-state.json (no cleanup node ever entered) clean up without migration; a config with no keywords.cleanup gets the defaultuv run pytest cli/tests/test_cleanup.py -k legacy
T11Manual exploratoryn/a — every path is reachable from the seams the suites already inject
T12Graph contractyescleanup compiles in pdlc-work-item-loop and pdlc-contribution-loop, is absent from pdlc-pr-loop, and Runtime.cleanup enters it / is idempotent / no-ops without it (R5.1, R5.2, R5.4)uv run pytest cli/tests/test_graph_cleanup.py cli/tests/test_graph_contract.py
T13Docs & schema parityyesEvery new config key is documented and every documented key exists; the phase vocabulary agrees across schema, config and template (R5.3)uv run pytest cli/tests/test_docs_parity.py cli/tests/test_harness_gate.py

Verification environment

  • Runtime: Python 3.11+, uv for dependency resolution, pytest as the runner.
  • Native dependencies: none are required. tmux is faked at the existing TmuxRunner seam the dispatcher suites already use; git is exercised for real in T2 against a throwaway repository under tmp_path, because the worktree removal path is precisely what must be proved.
  • Network: none. No GitHub call is made — the graph integrations resolve to the fake the graph suites already provide.
  • Commands: make check (lint + typecheck + the full suite) is the gate; the per-row commands above are what a task-level red→green cycle runs.

Evidence plan

RowEvidenceWhere
T1, T2, T8, T10, T12pytest output for the new suitesevidence/pytest-cleanup.txt
T3, T13pytest output for the parity suitesevidence/pytest-parity.txt
allFull make check transcriptevidence/make-check.txt

Verification results

Executed at the verification node, on the branch's final state.

#CommandOutcomeEvidence
T1uv run pytest cli/tests/test_cleanup.py cli/tests/test_control.pypass — 69 passedevidence/pytest-cleanup.txt
T2uv run pytest cli/tests/test_cleanup_integration.pypass — 16 passedevidence/pytest-cleanup.txt
T3uv run pytest cli/tests/test_api_routers_integration.py cli/tests/test_core_sessions.pypass — 15 passedevidence/pytest-cleanup.txt
T8uv run pytest cli/tests/test_cleanup_integration.py -k abusepass — 5 passed (the four abuse cases plus the unauthorized-closer one)evidence/pytest-cleanup.txt
T10uv run pytest cli/tests/test_cleanup.py -k legacypass — 2 passedevidence/pytest-cleanup.txt
T12uv run pytest cli/tests/test_graph_cleanup.py cli/tests/test_graph_contract.pypass — 23 passedevidence/pytest-cleanup.txt
T13uv run pytest cli/tests/test_docs_parity.py cli/tests/test_harness_gate.pypass — 28 passedevidence/pytest-parity.txt
allmake check (ruff, markdownlint, ruff format, pyright, config validation, full suite)pass — 0 lint findings, 0 pyright errors, 6 configs valid, 1629 passed / 1 skippedevidence/make-check.txt

One row was proved red before green beyond its own task's cycle, and is worth naming: the GitHub Enterprise regression in T2 (test_a_github_enterprise_work_item_finds_its_own_checkout). It was written after a self-review pass spotted that the checkout lookup reconstructed the repository from full_name alone — resolving every work item to the configured default host, and so missing the worktree of any item on another host. Reverting the fix reproduces the failure against …/workspace/.worktrees/ghe.corp.example/octo/repo/…; restoring it passes.

Released under the MIT License.