issue-plan: enforce test coverage stage and full project-phase coverage
Problem
/mach10:issue-plan generates staged implementation plans, but does not enforce two important aspects:
-
Test coverage planning is optional in practice. Step 4 mentions "Testing approach for each stage" as a bullet point, but there is no structured guidance requiring plans to include dedicated test coverage. As a result, plans may omit test stages or treat testing as an afterthought, leading to implementations with insufficient test coverage.
-
Project-phase coverage is not enforced. Plans can focus narrowly on code changes without explicitly addressing all affected project phases: API routes, models/ORM, services, UI templates, migrations, and documentation. This can lead to stages that miss necessary work (e.g., adding an API endpoint without a corresponding migration, or modifying a model without updating UI templates that render it).
Proposed Solution
Enhance the issue-plan command to ensure generated plans explicitly cover all relevant project phases and always include test coverage planning. This could be implemented as:
Option A: Additional sub-step in Step 4 (Analyze and Plan)
Add structured requirements to the planning step:
- Phase checklist: Before finalizing, the planner must verify that the plan addresses all affected layers: models/ORM, migrations, API routes, services, UI routes/templates, and documentation. Any layer not applicable should be explicitly marked as "N/A" with a reason.
- Test coverage stage: Each plan must include at least one dedicated testing stage (or testing work within each implementation stage) that specifies: what test types are needed (unit, integration, UI), what behaviors/endpoints/views to test, and expected coverage targets.
Option B: Separate verification step (Step 4.5)
Add a new step between planning and posting where the planner cross-checks the draft plan against:
- A project-phase matrix (models, migrations, routes, services, UI, docs, tests)
- Test coverage requirements for each stage
- Gaps where a phase is affected but no stage addresses it
The planner would revise the plan to fill any gaps before presenting it for approval.
Acceptance Criteria
- [ ] Every plan generated by
issue-planincludes explicit test coverage planning (what to test, what types of tests, which stage handles testing) - [ ] Every plan addresses all relevant project phases, or explicitly marks phases as not applicable
- [ ] The command prompt includes structured guidance (not just a bullet point) for both requirements
- [ ] Plans that only cover "code changes" without migrations, UI, or tests are caught before posting
Context
- Current
issue-planStep 4 mentions "Testing approach for each stage" but only as one bullet among several, with no enforcement or structure test-auditexists as a separate command but only audits existing tests post-hoc -- it doesn't help during planningissue-implementdelegates tofeature-devwhich has its own phases, but the plan itself should already account for full coverage so stages are properly scoped
Independent Assessment
Summary
This issue correctly identifies that issue-plan Step 4 lacks structured enforcement for test coverage planning and project-phase coverage. The "Testing approach for each stage" requirement is a single bullet point with no checklist, verification, or structured guidance.
Empirical Finding: feature-dev test creation is plan-driven
The issue's Context section states that "issue-implement delegates to feature-dev which has its own phases" -- implying feature-dev independently handles testing. An analysis of 74 actual /feature-dev:feature-dev sessions in this project's primary consumer repo reveals:
- 76% of sessions (56 of 74) created or modified test files during Phase 5 (Implementation), typically as Step 6 or Step 7
- 24% did not write tests -- these were verification stages, refactoring, or PR review fixes where new tests were not needed
- Test creation is proactive during implementation, not reactive from Phase 6 (Quality Review)
- Critically, feature-dev follows the plan's test guidance. When the plan explicitly lists test files and testing approach, feature-dev creates tests. When the plan omits testing, feature-dev may skip it.
This means issue-plan's test planning directly drives downstream test creation. Strengthening test coverage requirements in issue-plan would have a concrete downstream effect -- it is the mechanism that tells feature-dev what to test.
Note: feature-dev's own instructions (7-phase workflow) contain no explicit "write tests" directive. Phase 5 says "Build the feature" and Phase 6 reviews for "inadequate test coverage" but doesn't create tests. The empirical test creation happens because feature-dev follows the plan, not because its own instructions mandate it.
Assessment of proposed options
Option A (additional sub-step in Step 4) is simpler and sufficient. The planning step already produces the staged plan -- adding structured test and phase requirements there keeps the workflow compact.
Option B (separate verification step) provides stronger enforcement but adds complexity. Given that feature-dev already follows plan guidance reliably, the lighter touch of Option A should be effective.
Concerns
- Project-phase checklist is framework-specific. The proposed checklist (models/ORM, migrations, API routes, services, UI templates) assumes a web-app architecture. The implementation should make this adaptable -- perhaps a "relevant project layers" prompt rather than a fixed checklist, so it works for CLI tools, plugins, and libraries too.
- Scope is well-contained. The change is entirely within
commands/issue-plan.md(109 lines). No runtime, no tests to write (this is a plugin definition repo).
Concern: mandatory enforcement would degrade UX for non-webapp projects
Mach10 is used to develop mach10 itself -- a pure plugin definition repo with markdown files and YAML frontmatter. There are no tests, no test framework, and no testable runtime code. If issue-plan enforces mandatory test coverage stages, plans for mach10 would either:
- Force the planner to produce a meaningless test stage marked N/A every time
- Force the planner to invent tests for files that have nothing to unit-test
- Block plan approval if enforcement is strict enough to reject plans without test coverage
The same applies to the proposed project-phase checklist (models/ORM, migrations, API routes, services, UI templates). Mach10 has none of these. A mandatory phase matrix would produce a wall of N/A annotations on every plan.
This generalizes beyond mach10 to documentation repos, configuration/infrastructure repos, CLI tools without test infrastructure, and early-stage prototypes. The issue as written assumes every project consuming issue-plan resembles a web application with ORM, migrations, views, and tests.
Suggested approach
Enforcement should be contextual rather than mandatory:
- Testing: "Identify what testing is appropriate for this project and codebase. If the project has an existing test suite, each stage must specify what tests to add or modify. If the project has no testable runtime code (e.g., plugin definitions, documentation), note this and skip test planning."
- Project phases: Discover what layers exist in the codebase during exploration (Step 3), then verify the plan covers all discovered layers -- rather than checking against a fixed checklist that assumes a specific architecture.
This preserves the intent of the issue (catch plans that omit testing or miss project layers) without penalizing projects where those concerns don't apply.
Revised approach: CONTRIBUTING.md as the project-specific planning guide
Rather than hardcoding test and phase enforcement into issue-plan, both issue-plan and issue-review-plan should consult CONTRIBUTING.md (or DEVELOPMENT.md, .github/CONTRIBUTING.md) to discover project-specific planning requirements. This is the same lookup pattern pr-pre-merge already uses in its Step 2.
How it works
In issue-plan (creation): During or after codebase exploration (Step 3), read CONTRIBUTING.md if it exists. Extract any guidance on expected project layers, testing expectations, and planning requirements. Use this to inform the staged plan -- ensuring stages cover the layers and testing approach the project declares.
In issue-review-plan (validation): When reviewing a plan, read CONTRIBUTING.md to understand what the project expects. Flag gaps where the plan omits layers or testing that the project's contributing guide specifies.
Fallback: If no contributing guide exists, use reasonable defaults (the current behavior is effectively this already).
Why this is better than the original proposal
- Project-driven, not tool-driven. Each repo defines what "complete" means. A Django app's CONTRIBUTING.md lists models, migrations, views, and tests. Mach10's says "command definition files, no tests." A CLI tool's might list just source and integration tests.
- No degraded UX for non-webapp projects. No mandatory N/A annotations, no meaningless test stages for repos with nothing to test.
- Consistent with existing patterns.
pr-pre-mergealready does this exact lookup. Extending it to planning commands creates a unified approach across the workflow. - Scales naturally. New project requirements (e.g., "always update the API spec", "include migration scripts") get added to CONTRIBUTING.md without changing any mach10 commands.
Empirical context
Analysis of 74 feature-dev sessions shows that feature-dev creates tests ~76% of the time by following the plan's guidance. The plan is the upstream driver of downstream test creation. Making plans more informed (via CONTRIBUTING.md) directly improves test coverage outcomes without rigid mandates.
Implementation scope
- Modify
commands/issue-plan.md: add a sub-step to read CONTRIBUTING.md during exploration and incorporate its guidance into planning - Modify
commands/issue-review-plan.md: add a sub-step to read CONTRIBUTING.md and use it as review criteria - Both changes follow the existing
pr-pre-mergelookup pattern (CONTRIBUTING.md, DEVELOPMENT.md, .github/CONTRIBUTING.md)
Implementation Plan
Posted by: /mach10:issue-plan — this comment guides staged implementation via /mach10:issue-implement.
Analysis
The discussion on this issue converged on a CONTRIBUTING.md-driven approach rather than hardcoded phase checklists. This follows the existing pattern in pr-pre-merge (Step 2) and avoids degraded UX for non-webapp projects.
Stage 1: Add CONTRIBUTING.md-driven planning guidance to issue-plan and issue-review-plan
What this stage accomplishes:
- Adds a CONTRIBUTING.md lookup sub-step to
issue-planStep 3 (Explore the Codebase), following the same pattern aspr-pre-mergeStep 2 - Adds structured guidance in
issue-planStep 4 (Analyze and Plan) that uses discovered project requirements to inform test coverage planning and project-layer coverage - Adds a parallel CONTRIBUTING.md lookup to
issue-review-planStep 3, using discovered requirements as review criteria in Step 4 - Ensures fallback behavior: if no contributing guide exists, current defaults apply
Files modified:
commands/issue-plan.mdcommands/issue-review-plan.md
Key design decisions:
- CONTRIBUTING.md lookup follows the exact precedence used by
pr-pre-merge: CONTRIBUTING.md, DEVELOPMENT.md, .github/CONTRIBUTING.md - Test coverage guidance is contextual: "If the project has an existing test suite, each stage must specify what tests to add or modify. If the project has no testable runtime code, note this and skip test planning."
- Project-layer coverage is discovery-based: verify the plan covers all layers discovered during codebase exploration, rather than checking against a fixed architecture-specific checklist
- No testing stage needed: this is a plugin definition repo with no test framework
Acceptance criteria addressed:
- Every plan includes explicit test coverage planning (contextual, not mandatory)
- Every plan addresses all relevant project phases discovered during exploration
- The command prompt includes structured guidance (not just a bullet point) for both requirements
- Plans that miss layers or testing for projects that have them are caught before posting
Progress: Stage 1 implemented
Commit: 81d0028
Branch: feature/issue-25-contributing-planning-guidance
Changes
commands/issue-plan.md:
- Added Step 3a: CONTRIBUTING.md lookup (same precedence as
pr-pre-merge) before launching exploration agents. Extracted guidance is recorded as "project planning requirements" to inform both exploration and plan drafting. - Added "Planning requirements" section in Step 4 with structured guidance for project-layer coverage (cross-check against discovered layers) and test coverage planning (contextual: mandatory for projects with test suites, explicitly skipped for projects without testable runtime code).
commands/issue-review-plan.md:
- Added Step 3a: parallel CONTRIBUTING.md lookup, with extracted guidance recorded as "project review criteria" (reviewer-oriented framing).
- Added two holistic review criteria in Step 4: project-layer coverage and test coverage planning, checking whether the plan addresses all discovered layers and includes adequate test planning where applicable.
Design decisions
- Followed the exact
pr-pre-mergeStep 2 lookup pattern (CONTRIBUTING.md, DEVELOPMENT.md, .github/CONTRIBUTING.md) - Used distinct framing: "project planning requirements" in issue-plan (creation) vs. "project review criteria" in issue-review-plan (audit)
- Fallback behavior: if no contributing guide exists, current defaults apply -- no mandatory N/A annotations or meaningless test stages
Shipped in v0.4.2
Hey @merck-awakefield -- this is merged and released. Here's how to put it to work in your repo.
What changed
/mach10:issue-plan and /mach10:issue-review-plan now consult your project's contributing guide to discover project-specific layers and testing expectations. This means plans will automatically reflect what your project considers "complete" -- no more plans that silently skip migrations, UI work, or tests.
What you need to do
Add a CONTRIBUTING.md (or DEVELOPMENT.md, or .github/CONTRIBUTING.md) to your repo with two things:
-
Project layers -- list the architectural layers that changes typically touch. For a Django app this might look like:
## Project Structure Changes typically span these layers: - Models and migrations (app/models/) - API routes (app/api/) - Services/business logic (app/services/) - UI templates (app/templates/) - Documentation (docs/) -
Testing expectations -- describe what test coverage looks like for your project:
## Testing - Unit tests for models and services (tests/unit/) - Integration tests for API endpoints (tests/integration/) - Run tests with: pytest
How it flows
- Planning (
/mach10:issue-plan): Reads your contributing guide during codebase exploration, then uses it to ensure the staged plan covers all relevant layers and includes appropriate test planning for each stage. - Plan review (
/mach10:issue-review-plan): Reads your contributing guide and uses it as review criteria -- flags plans that miss layers or testing your project expects. - Pre-merge (
/mach10:pr-pre-merge): Already used this same lookup pattern, so all three commands now share a consistent view of your project's requirements.
If you don't have a contributing guide
Everything still works -- the commands fall back to discovery-based defaults (exploring the codebase to infer what layers exist). The contributing guide just makes it explicit and consistent.