Skip to content

Commit cb3f34f

Browse files
committed
Refactor: Add maintenance report v2 and implementation plan.
1 parent 9e098cc commit cb3f34f

5 files changed

Lines changed: 108 additions & 2 deletions

File tree

TASKS.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ Put done tasks into the Archive.
1818

1919
## Active Tasks
2020

21-
- [/] Implement documentation harmonization and refactor tests for dynamic synchronization. (@apiad) (See plan: plans/maintenance-improvements.md)
21+
- [ ] Implement dynamic structural testing suite and finalize documentation sync. (See plan: plans/implement-maintenance-v2.md)
2222

2323
---
2424

2525
## Archive
2626

27+
- [x] Implement documentation harmonization and refactor tests for dynamic synchronization. (2026-03-23) (See plan: plans/maintenance-improvements.md)
28+
2729
- [x] Improve the `/draft` command and evolve the `writer` agent to include a review-driven "Refinement Phase." (2026-03-23) (See plan: plans/improve-draft-command-and-writer-agent.md)
2830

2931
- [x] Improve the `/review` command and evolve the `reviewer` agent to a non-destructive, multi-phase audit workflow. (2026-03-23) (See plan: plans/improve-review-command.md)

journal/2026-03-23.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@
1313
[2026-03-23T06:50:29] - Refactor /maintenance command into a read-only audit workflow using codebase_investigator.
1414
[2026-03-23T07:10:07] - Perform maintenance audit and generate implementation plan for documentation harmonization.
1515
[2026-03-23T07:14:22] - Harmonize documentation, refactor tests with dynamic sync, and integrate uv/pytest.
16+
[2026-03-23T07:22:14] - Commit maintenance v2 plan and research before starting work.

plans/implement-maintenance-v2.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Implementation Plan: Dynamic Structural Testing and Documentation Sync
2+
3+
## 1. Objective
4+
This plan addresses the gaps identified in `research/maintainance-report-2026-03-23-v2.md`. It implements a scalable, dynamic testing strategy for all commands and agents, refactors brittle legacy tests to focus on migration integrity, and ensures full documentation synchronization for the `/scaffold` and `/onboard` commands.
5+
6+
## 2. Architectural Impact
7+
- **Dynamic Validation:** Replaces hardcoded individual tests with a discovery-based suite (`tests/test_structure.py`) that automatically covers new commands/agents.
8+
- **Maintenance Efficiency:** Reduces test code volume by removing redundant structural checks from specialized test files.
9+
- **Documentation Integrity:** Enforces a 1:1 mapping between available commands and the User Guide, eliminating brittle "skip lists" in the synchronization tests.
10+
11+
## 3. File Operations
12+
13+
| Action | File Path | Description |
14+
| :--- | :--- | :--- |
15+
| **Create** | `tests/test_structure.py` | New test file using `pytest.mark.parametrize` for blanket coverage. |
16+
| **Modify** | `tests/test_review_command.py` | Cleanup of structural/content assertions; retain migration checks. |
17+
| **Modify** | `docs/user-guide.md` | Add/Update documentation for `/scaffold` and `/onboard`. |
18+
| **Modify** | `tests/test_sync.py` | Remove hardcoded skips for `scaffold` and `onboard`. |
19+
20+
## 4. Step-by-Step Execution
21+
22+
### Step 1: Implement Dynamic Structural Testing
23+
Create `tests/test_structure.py` with the following requirements:
24+
- **Command Discovery:** Use `os.listdir(".gemini/commands/")` to find all `.toml` files.
25+
- **Command Logic:** Verify each command is valid TOML and has non-empty `description` and `prompt` strings.
26+
- **Agent Discovery:** Use `os.listdir(".gemini/agents/")` to find all `.md` files.
27+
- **Agent Logic:** Verify each agent is valid Markdown and contains the agent's name (filename without extension) in the content.
28+
29+
### Step 2: Refactor `tests/test_review_command.py`
30+
- **Delete:** `test_reviewer_agent_exists`, `test_review_command_exists`, `test_reviewer_agent_is_valid_markdown`, `test_review_command_is_valid_toml`, `test_maintenance_command_is_audit`, `test_planner_agent_read_only`, `test_writer_agent_exists`, `test_draft_command_is_multimode`.
31+
- **Retain:** `test_editor_agent_gone`, `test_revise_command_gone`, `test_reporter_agent_gone` to ensure migration state persists.
32+
33+
### Step 3: Documentation Sync
34+
- **Update `docs/user-guide.md`**: Ensure the `/scaffold` and `/onboard` sections have consistent "How it works" and "Why it works" formatting.
35+
- **Update `tests/test_sync.py`**: Remove the exclusion list in `test_commands_synced_in_user_guide` so that `scaffold` and `onboard` are strictly checked for documentation presence.
36+
37+
### Step 4: Final Validation
38+
- Run the full test suite using `make test`.
39+
- Verify the total number of tests in `test_structure.py` matches the number of files in `.gemini/commands/` (15) and `.gemini/agents/` (6).
40+
41+
## 5. Testing Strategy
42+
1. **Dynamic discovery check:** Add a dummy command `temp_test.toml` and verify `make test` automatically picks it up and fails (due to lack of content).
43+
2. **Sync check:** Temporarily remove `/scaffold` from `docs/user-guide.md` and verify `tests/test_sync.py` fails.
44+
3. **Migration check:** Ensure `tests/test_review_command.py` passes, confirming legacy files have not been reintroduced.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Maintenance Report Card - 2026-03-23 (v2)
2+
3+
## Executive Summary
4+
This second audit focused on the **lenient structural testing** of all commands and agents. While the initial synchronization tests (`tests/test_sync.py`) were a significant improvement, many commands and agents still lack basic structural verification. Furthermore, some tests remain brittle by asserting on specific prompt content.
5+
6+
---
7+
8+
## 🛠️ Testing Inventory & Gaps
9+
10+
### Commands (.gemini/commands/) - 15 Total
11+
- **Covered (5):** `review`, `maintenance`, `draft`, `plan`, `document`. (Through `test_review_command.py` and `test_sync.py`)
12+
- **Missing (10):** `commit`, `cron`, `debug`, `issues`, `learn`, `onboard`, `release`, `research`, `scaffold`, `task`.
13+
- **Gaps:** No basic TOML validity or key presence (`description`, `prompt`) checks for these commands.
14+
15+
### Agents (.gemini/agents/) - 6 Total
16+
- **Covered (3):** `reviewer`, `planner`, `writer`. (Through `test_review_command.py`)
17+
- **Missing (3):** `debugger`, `learner`, `researcher`.
18+
- **Gaps:** No basic Markdown structure (e.g., presence of a title or specific name in frontmatter) checks for these agents.
19+
20+
---
21+
22+
## 🔍 Synchronization Issues
23+
24+
### 1. Brittle Documentation Skips
25+
- **Issue:** `tests/test_sync.py` contains hardcoded skips for `scaffold` and `onboard` regarding their presence in `docs/user-guide.md`.
26+
- **Impact:** If these commands are ever removed or renamed, the tests won't catch it. The documentation should be updated, and the skips removed.
27+
28+
### 2. Brittle Content Matching
29+
- **Issue:** `tests/test_review_command.py` still checks for specific strings like `"codebase_investigator"` or `"Maintenance Report Card"`.
30+
- **Impact:** Small wording changes in the prompts will break the tests unnecessarily.
31+
32+
---
33+
34+
## 📝 Actionable Recommendations
35+
36+
### 1. Unified Dynamic Testing Strategy
37+
Implement a new test file, `tests/test_structure.py`, that uses `pytest.mark.parametrize` to dynamically discover and test all files in `.gemini/commands/` and `.gemini/agents/`.
38+
39+
#### **Command Requirements (Lenient):**
40+
- Must be valid TOML.
41+
- Must contain `description` (string) and `prompt` (string) keys.
42+
- Prompt must not be empty.
43+
44+
#### **Agent Requirements (Lenient):**
45+
- Must be valid Markdown.
46+
- Must contain the agent's name (case-insensitive) in the content or as a header.
47+
- Should contain a `tools` section (if relevant to the framework's schema).
48+
49+
### 2. Cleanup `tests/test_review_command.py`
50+
- Move generalized structural tests to the new dynamic suite.
51+
- Keep only migration-specific tests (e.g., checking that `editor.md` or `revise.toml` no longer exist).
52+
53+
### 3. Finalize Documentation Sync
54+
- Ensure `scaffold` and `onboard` are fully documented in `docs/user-guide.md`.
55+
- Remove the hardcoded skips from `tests/test_sync.py`.
56+
57+
---
58+
59+
## 💡 Orchestration Tip
60+
Use the `/plan` command, pointing to this report, to formulate a strategy for implementing `tests/test_structure.py`. This will provide "blanket" coverage for all current and future commands/agents with minimal maintenance overhead.

temp.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)