From ad57b00b91d8aa99e08bc475232fecd52d335f60 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sun, 15 Nov 2026 16:37:37 -0500 Subject: [PATCH] feat(gitea-plan,implement-slice): enforce bottom-up vertical per-submodule Red->Green TDD slicing - gitea-plan: require multi-module issues to group acceptance criteria and TDD test seams vertically by submodule or dependency layer rather than a single horizontal upfront test section. - implement-slice: require Step 3 Planned Workflows to decompose multi-module slices into bottom-up vertical per-submodule Red->Green tasks rather than horizontal batching (all tests in TASK-00, all code in TASK-01..02). - tests: assert vertical submodule TDD grouping and decomposition rules. --- skills/gitea-plan/SKILL.md | 4 +++- skills/gitea-plan/references/decomposition-tiers.md | 1 + skills/implement-slice/SKILL.md | 2 +- skills/implement-slice/references/orchestration-tiers.md | 5 +++++ tests/fixtures/test_skills_behavioral_contracts.py | 6 ++++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/skills/gitea-plan/SKILL.md b/skills/gitea-plan/SKILL.md index 0ee105c..9a67cf5 100644 --- a/skills/gitea-plan/SKILL.md +++ b/skills/gitea-plan/SKILL.md @@ -27,7 +27,9 @@ description: >- 2. **Assess scope and select tier.** Assign `Small`, `Medium`, or `Large`. Emit explicit `### Project Board Policy: (Rationale)`. 3. **Decompose into deliverable outcome slices.** Map work into verifiable issues - with test seams and falsifiable acceptance criteria (Context, Solution, Criteria). + with test seams and falsifiable acceptance criteria (Context, Solution, Criteria), + grouping TDD test seams vertically by submodule or capability rather than a single + monolithic upfront test block across all modules. 4. **Run independent reproducibility audit.** Spawn clean-room subagent with raw input manifest (commit SHA, specs, proposed issue markdown). Review 5-section evaluation to resolve material ambiguities before human gate. diff --git a/skills/gitea-plan/references/decomposition-tiers.md b/skills/gitea-plan/references/decomposition-tiers.md index 87053d6..f04b208 100644 --- a/skills/gitea-plan/references/decomposition-tiers.md +++ b/skills/gitea-plan/references/decomposition-tiers.md @@ -7,6 +7,7 @@ Reference for `gitea-plan`. Guidelines for scaling planning ceremony to risk and - An **Issue** represents an **independently deliverable outcome** (what is built, verified, and closed by a pull request). It defines falsifiable acceptance criteria and expected behavior. - A **Commit** represents an **atomic, reversible implementation checkpoint** (a step within that issue's branch). Commits must compile and pass tests, but do not need to represent an entire closed issue on their own. - **Anti-pattern**: Never create 1:1 Gitea issues for micro-commits (such as "fix typo", "add helper function", or "clean up lint"). Group cohesive checkpoints under a single deliverable issue. +- **Vertical Submodule TDD Grouping**: Inside a multi-module issue, organize acceptance criteria and TDD test drafts vertically by submodule or dependency layer (e.g. `protocols` -> `ssap` -> `pointer` -> `manager`) rather than a single horizontal "write all tests for the entire issue first" section, so `implement-slice` executes incremental Red->Green cycles per submodule. --- diff --git a/skills/implement-slice/SKILL.md b/skills/implement-slice/SKILL.md index 0a28982..846c6fe 100644 --- a/skills/implement-slice/SKILL.md +++ b/skills/implement-slice/SKILL.md @@ -19,7 +19,7 @@ description: >- ## Steps 1. **Preflight branch check, readiness audit, and `Backlog -> Ready`.** Check session mode per `profile/AGENTS.md`. Classify working tree per [handoff-contracts](references/handoff-contracts.md) (`CLEAN_BASE`, `ADOPTABLE_DIFF`, `CONFLICTING_STATE`, `WRONG_BASE`). Stop on conflicts. Read target Gitea issue/milestone/board state via `gt issue`, `gt milestone`, direction docs (`ARCHITECTURE.md`, `ROADMAP.md`, `docs/designs/*.md`, `AGENTS.md`), and `git status --short`. Reconcile issue acceptance criteria against current `HEAD` (handing off to `reconcile-docs` if canonical design docs drifted during upstream slices, or updating the Gitea issue after owner approval) and, when `--dry-run` is not active, move the issue card `Backlog -> Ready` on the project board. Hand off to `gitea-plan` if tracking issues must be created first. 2. **Select orchestration topology (`complexity x risk`).** Combine planning size with assurance risk per [orchestration-tiers](references/orchestration-tiers.md). Keep pure-orchestrator invariants: retain plan, status, commit SHAs, QA dispositions, blockers; never edit implementation files, repair Git via code edits, self-certify QA, or ingest full test logs unless resolving a failure. -3. **Lock Planned Workflow and pre-committed rubrics.** Formulate the Planned Workflow using the Canonical Node Schema (5-tuples: `node_id`, `claim`, `method`, `executor`, `pass_condition`). Project a dynamic Mermaid diagram deriving directly from node IDs with visible rework edges. If `--dry-run` is active, halt after displaying the plan (enforce 0 file changes, 0 commits, 0 remote calls). Hard gate: pause for human approval. +3. **Lock Planned Workflow and pre-committed rubrics.** Formulate the Planned Workflow using the Canonical Node Schema (5-tuples: `node_id`, `claim`, `method`, `executor`, `pass_condition`), decomposing multi-module slices into bottom-up vertical per-submodule `Red -> Green` tasks rather than horizontal "all tests first, all code second" batching per [orchestration-tiers](references/orchestration-tiers.md). Project a dynamic Mermaid diagram deriving directly from node IDs with visible rework edges. If `--dry-run` is active, halt after displaying the plan (enforce 0 file changes, 0 commits, 0 remote calls). Hard gate: pause for human approval. 4. **Move card `Ready -> Work in Progress`, assign workspaces, and delegate.** Once the human approves Step 3, move the issue card `Ready -> Work in Progress` on the project board per [handoff-contracts](references/handoff-contracts.md). Govern branch/worktree lifecycle through `git-manager` per [orchestration-tiers](references/orchestration-tiers.md). Dispatch worker subagent(s) with the Implementation Assignment in [handoff-contracts](references/handoff-contracts.md). Never run concurrent workers in the same working tree. Update the runtime Execution Record table as nodes change state. 5. **Audit worker reports and run rubric QA.** Verify worker reports via read-only Git checks. Spawn read-only QA subagents running `verify-slice` against pre-committed rubrics. Update Execution Record with concrete evidence (SHA, exit codes). 6. **Triage outcomes and route rework.** Classify failures using [handoff-contracts](references/handoff-contracts.md): route code defects to existing worker via `send_message`; record justified rubric amendments if criteria change. Loop Steps 4-6 until all nodes pass. diff --git a/skills/implement-slice/references/orchestration-tiers.md b/skills/implement-slice/references/orchestration-tiers.md index a881cdb..f8e3784 100644 --- a/skills/implement-slice/references/orchestration-tiers.md +++ b/skills/implement-slice/references/orchestration-tiers.md @@ -71,6 +71,11 @@ Every task, check, and gate in the slice workflow is represented by a structured - **`evidence`**: Simple doc/format tasks record exit code and commit SHA; complex code tasks attach stdout, DOM snapshots, or test run logs. - **Separate QA Executor**: Documentation and routine edits use the implementation agent directly; high-risk slices mandate independent verifier subagents. +### Vertical Submodule TDD Decomposition (Anti-Horizontal Batching) +When a slice spans multiple modules or layers (for example, `protocols.py` -> `ssap.py` -> `pointer.py` -> `manager.py`), never decompose the workflow horizontally into `TASK-00: write all tests for every module` followed by `TASK-01..02: implement all modules`. Instead, sequence tasks as **bottom-up vertical Red->Green cycles per submodule or capability**: +1. Each submodule task writes its own focused Red test(s) (committing a Red `@pytest.mark.xfail(strict=True)` checkpoint when requested by repo SOP), implements that submodule to turn its tests Green, and commits the Green checkpoint before the next higher-level submodule writes its tests against the settled lower layer. +2. This preserves organic Git history (`git log` and `git bisect` trace each building block in dependency order) and prevents writing tests against imagined lower-level interfaces. + --- ## 5. Runtime Observability Timeline & Dry-Run Invariants diff --git a/tests/fixtures/test_skills_behavioral_contracts.py b/tests/fixtures/test_skills_behavioral_contracts.py index 63062fe..77833b7 100755 --- a/tests/fixtures/test_skills_behavioral_contracts.py +++ b/tests/fixtures/test_skills_behavioral_contracts.py @@ -474,6 +474,12 @@ class TestSkillsBehavioralContracts(unittest.TestCase): self.assertIn("journal-builder", install_sh) self.assertIn("draft-curation", install_sh) + # 3. Vertical per-submodule Red->Green decomposition in gitea-plan and implement-slice + plan_all = "\n".join(p.read_text() for p in (REPO_ROOT / "skills" / "gitea-plan").rglob("*.md")) + impl_all = "\n".join(p.read_text() for p in (REPO_ROOT / "skills" / "implement-slice").rglob("*.md")) + self.assertIn("Vertical Submodule TDD Grouping", plan_all) + self.assertIn("Vertical Submodule TDD Decomposition (Anti-Horizontal Batching)", impl_all) + def test_skill_inventory_and_skeletons(self): """Proves all 16 active skills meet line count (<= 80), em-dash, and path portability rules.""" for skill_name in EXPECTED_SKILLS: