Files
claude-task-master/tests/manual/progress/TESTING_GUIDE.md
Joe Danziger e3ed4d7c14 feat: CLI & MCP progress tracking for parse-prd command (#1048)
* initial cutover

* update log to debug

* update tracker to pass units

* update test to match new base tracker format

* add streamTextService mocks

* remove unused imports

* Ensure the CLI waits for async main() completion

* refactor to reduce code duplication

* update comment

* reuse function

* ensure targetTag is defined in streaming mode

* avoid throwing inside process.exit spy

* check for null

* remove reference to generate

* fix formatting

* fix textStream assignment

* ensure no division by 0

* fix jest chalk mocks

* refactor for maintainability

* Improve bar chart calculation logic for consistent visual representation

* use custom streaming error types; fix mocks

* Update streamText extraction in parse-prd.js to match actual service response

* remove check - doesn't belong here

* update mocks

* remove streaming test that wasn't really doing anything

* add comment

* make parsing logic more DRY

* fix formatting

* Fix textStream extraction to match actual service response

* fix mock

* Add a cleanup method to ensure proper resource disposal and prevent memory leaks

* debounce progress updates to reduce UI flicker during rapid updates

* Implement timeout protection for streaming operations (60-second timeout) with automatic fallback to non-streaming mode.

* clear timeout properly

* Add a maximum buffer size limit (1MB) to prevent unbounded memory growth with very large streaming responses.

* fix formatting

* remove duplicate mock

* better docs

* fix formatting

* sanitize the dynamic property name

* Fix incorrect remaining progress calculation

* Use onError callback instead of console.warn

* Remove unused chalk import

* Add missing custom validator in fallback parsing configuration

* add custom validator parameter in fallback parsing

* chore: fix package-lock.json

* chore: large code refactor

* chore: increase timeout from 1 minute to 3 minutes

* fix: refactor and fix streaming

* Merge remote-tracking branch 'origin/next' into joedanz/parse-prd-progress

* fix: cleanup and fix unit tests

* chore: fix unit tests

* chore: fix format

* chore: run format

* chore: fix weird CI unit test error

* chore: fix format

---------

Co-authored-by: Ralph Khreish <35776126+Crunchyman-ralph@users.noreply.github.com>
2025-08-12 22:37:07 +02:00

98 lines
2.6 KiB
Markdown

# Task Master Progress Testing Guide
Quick reference for testing streaming/non-streaming functionality with token tracking.
## 🎯 Test Modes
1. **MCP Streaming** - Has `reportProgress` + `mcpLog`, shows emoji indicators (🔴🟠🟢)
2. **CLI Streaming** - No `reportProgress`, shows terminal progress bars
3. **Non-Streaming** - No progress reporting, single response
## 🚀 Quick Commands
```bash
# Test Scripts (accept: mcp-streaming, cli-streaming, non-streaming, both, all)
node test-parse-prd.js [mode]
node test-analyze-complexity.js [mode]
node test-expand.js [mode] [num_subtasks]
node test-expand-all.js [mode] [num_subtasks]
node parse-prd-analysis.js [accuracy|complexity|all]
# CLI Commands
node scripts/dev.js parse-prd test.txt # Local dev (streaming)
node scripts/dev.js analyze-complexity --research
node scripts/dev.js expand --id=1 --force
node scripts/dev.js expand --all --force
task-master [command] # Global CLI (non-streaming)
```
## ✅ Success Indicators
### Indicators
- **Priority**: 🔴🔴🔴 (high), 🟠🟠⚪ (medium), 🟢⚪⚪ (low)
- **Complexity**: ●●● (7-10), ●●○ (4-6), ●○○ (1-3)
### Token Format
`Tokens (I/O): 2,150/1,847 ($0.0423)` (~4 chars per token)
### Progress Bars
```
Single: Generating subtasks... |████████░░| 80% (4/5)
Dual: Expanding 3 tasks | Task 2/3 |████████░░| 66%
Generating 5 subtasks... |██████░░░░| 60%
```
### Fractional Progress
`(completedTasks + currentSubtask/totalSubtasks) / totalTasks`
Example: 33% → 46% → 60% → 66% → 80% → 93% → 100%
## 🐛 Quick Fixes
| Issue | Fix |
|-------|-----|
| No streaming | Check `reportProgress` is passed |
| NaN% progress | Filter duplicate `subtask_progress` events |
| Missing tokens | Check `.env` has API keys |
| Broken bars | Terminal width > 80 |
| projectRoot.split | Use `projectRoot` not `session` |
```bash
# Debug
TASKMASTER_DEBUG=true node test-expand.js
npm run lint
```
## 📊 Benchmarks
- Single task: 10-20s (5 subtasks)
- Expand all: 30-45s (3 tasks)
- Streaming: ~10-20% faster
- Updates: Every 2-5s
## 🔄 Test Workflow
```bash
# Quick check
node test-parse-prd.js both && npm test
# Full suite (before release)
for test in parse-prd analyze-complexity expand expand-all; do
node test-$test.js all
done
node parse-prd-analysis.js all
npm test
```
## 🎯 MCP Tool Example
```javascript
{
"tool": "parse_prd",
"args": {
"input": "prd.txt",
"numTasks": "8",
"force": true,
"projectRoot": "/path/to/project"
}
}