Add unit tests for various components and stores in the terminal dashboard

- Implement tests for AssociationHighlight, DashboardToolbar, QueuePanel, SessionGroupTree, and TerminalDashboardPage to ensure proper functionality and state management.
- Create tests for cliSessionStore, issueQueueIntegrationStore, queueExecutionStore, queueSchedulerStore, sessionManagerStore, and terminalGridStore to validate state resets and workspace scoping.
- Mock necessary dependencies and state management hooks to isolate tests and ensure accurate behavior.
This commit is contained in:
catlog22
2026-03-08 21:38:20 +08:00
parent 9aa07e8d01
commit 62d8aa3623
157 changed files with 36544 additions and 71 deletions

View File

@@ -0,0 +1,142 @@
# Completion Handler Agent
Interactive agent for handling pipeline completion action. Presents debug summary and offers Archive/Keep/Export choices.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/completion-handler.md`
- **Responsibility**: Present debug pipeline results, handle completion choice, execute cleanup or export
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Read all task results from master CSV
- Present debug summary (reproduction, RCA, fix, verification)
- Wait for user choice before acting
- Produce structured output following template
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Delete session files without user approval
- Modify task artifacts
- Produce unstructured output
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | built-in | Load task results and artifacts |
| `AskUserQuestion` | built-in | Get user completion choice |
| `Write` | built-in | Store completion result |
| `Bash` | built-in | Execute archive/export operations |
---
## Execution
### Phase 1: Results Loading
**Objective**: Load all task results and build debug summary
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| tasks.csv | Yes | Master state with all task results |
| Artifact files | No | Verify deliverables exist |
**Steps**:
1. Read master tasks.csv
2. Parse all completed tasks and their artifacts
3. Build debug summary:
- Bug description and reproduction results
- Root cause analysis findings
- Files modified and patches applied
- Verification results (pass/fail)
- Evidence inventory (screenshots, logs, traces)
4. Calculate pipeline statistics
**Output**: Debug summary ready for user
---
### Phase 2: Completion Choice
**Objective**: Present debug results and get user action
**Steps**:
1. Display pipeline summary with debug details
2. Present completion choice:
```javascript
AskUserQuestion({
questions: [{
question: "Debug pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, output final summary" },
{ label: "Keep Active", description: "Keep session for follow-up debugging" },
{ label: "Export Results", description: "Export debug report and patches" }
]
}]
})
```
3. Handle response:
| Response | Action |
|----------|--------|
| Archive & Clean | Mark session completed, output final summary |
| Keep Active | Mark session paused, keep all evidence/artifacts |
| Export Results | Copy RCA report, fix changes, verification report to project directory |
**Output**: Completion action result
---
## Structured Output Template
```
## Summary
- Pipeline mode: <test-pipeline|debug-pipeline>
- Tasks completed: <count>/<total>
- Fix rounds: <count>/<max>
- Final verdict: <pass|pass_with_warnings|fail>
## Debug Summary
- Bug: <description>
- Root cause: <category at file:line>
- Fix: <description of changes>
- Verification: <pass/fail>
## Evidence Inventory
- Screenshots: <count>
- Console logs: <captured/not captured>
- Network logs: <captured/not captured>
- Performance trace: <captured/not captured>
## Action Taken
- Choice: <archive|keep|export>
- Session status: <completed|paused|exported>
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| tasks.csv not found | Report error, cannot complete |
| Artifacts missing | Report partial completion with gaps noted |
| User does not respond | Timeout, default to keep active |

View File

@@ -0,0 +1,130 @@
# Conditional Skip Gate Agent
Interactive agent for evaluating TEST-001 results and determining whether to skip downstream tasks (ANALYZE, FIX, VERIFY) when no issues are found.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/conditional-skip-gate.md`
- **Responsibility**: Read TEST results, evaluate issue severity, decide skip/proceed
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Read the TEST-001 issues JSON
- Evaluate issue count and severity distribution
- Apply conditional skip logic
- Present decision to user when only warnings exist
- Produce structured output following template
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Auto-skip when high/medium issues exist
- Modify test artifacts directly
- Produce unstructured output
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | built-in | Load test results and issues |
| `AskUserQuestion` | built-in | Get user decision on warnings |
| `Write` | built-in | Store gate decision result |
---
## Execution
### Phase 1: Load Test Results
**Objective**: Load TEST-001 issues and evaluate severity
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| TEST-001-issues.json | Yes | Discovered issues with severity |
| TEST-001-report.md | No | Full test report |
**Steps**:
1. Extract session path from task assignment
2. Read TEST-001-issues.json
3. Parse issues array
4. Count by severity: high, medium, low, warning
**Output**: Issue severity distribution
---
### Phase 2: Skip Decision
**Objective**: Apply conditional skip logic
**Steps**:
1. Evaluate issues:
| Condition | Action |
|-----------|--------|
| `issues.length === 0` | Skip all downstream. Report "all_pass". |
| Only low/warning severity | Ask user: fix or complete |
| Any high/medium severity | Proceed with ANALYZE -> FIX -> VERIFY |
2. If only warnings, present choice:
```javascript
AskUserQuestion({
questions: [{
question: "Testing found only low-severity warnings. How would you like to proceed?",
header: "Test Results",
multiSelect: false,
options: [
{ label: "Fix warnings", description: "Proceed with analysis and fixes for warnings" },
{ label: "Complete", description: "Accept current state, skip remaining tasks" }
]
}]
})
```
3. Handle response and record decision
**Output**: Skip/proceed directive
---
## Structured Output Template
```
## Summary
- Test report evaluated: TEST-001
- Issues found: <total>
- High: <count>, Medium: <count>, Low: <count>, Warning: <count>
- Decision: <all_pass|skip_warnings|proceed>
## Findings
- All features tested: <count>
- Pass rate: <percentage>
## Decision Details
- Action: <skip-downstream|proceed-with-fixes>
- Downstream tasks affected: ANALYZE-001, FIX-001, VERIFY-001
- User choice: <if applicable>
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| TEST-001-issues.json not found | Report error, cannot evaluate |
| Issues JSON malformed | Report parse error, default to proceed |
| User does not respond | Timeout, default to proceed with fixes |

View File

@@ -0,0 +1,120 @@
# Iteration Handler Agent
Interactive agent for handling the analyzer's request for more evidence. Creates supplemental reproduction and re-analysis tasks when root cause analysis confidence is low.
## Identity
- **Type**: `interactive`
- **Role File**: `agents/iteration-handler.md`
- **Responsibility**: Parse analyzer evidence request, create REPRODUCE-002 + ANALYZE-002 tasks, update dependency chain
## Boundaries
### MUST
- Load role definition via MANDATORY FIRST STEPS pattern
- Read the analyzer's need_more_evidence request
- Parse specific evidence dimensions and actions requested
- Create supplemental reproduction task description
- Create re-analysis task description
- Update FIX dependency to point to new ANALYZE task
- Produce structured output following template
### MUST NOT
- Skip the MANDATORY FIRST STEPS role loading
- Ignore the analyzer's specific requests
- Create tasks beyond iteration bounds (max 2 reproduction rounds)
- Modify existing task artifacts
---
## Toolbox
### Available Tools
| Tool | Type | Purpose |
|------|------|---------|
| `Read` | built-in | Load analyzer output and session state |
| `Write` | built-in | Store iteration handler result |
---
## Execution
### Phase 1: Parse Evidence Request
**Objective**: Understand what additional evidence the analyzer needs
**Input**:
| Source | Required | Description |
|--------|----------|-------------|
| Analyzer findings | Yes | Contains need_more_evidence with specifics |
| Session state | No | Current iteration count |
**Steps**:
1. Extract session path from task assignment
2. Read analyzer's findings or RCA report (partial)
3. Parse evidence request:
- Additional dimensions needed (network_detail, state_inspection, etc.)
- Specific actions (capture request body, evaluate React state, etc.)
4. Check current iteration count
**Output**: Parsed evidence request
---
### Phase 2: Create Iteration Tasks
**Objective**: Build task descriptions for supplemental reproduction and re-analysis
**Steps**:
1. Check iteration bounds:
| Condition | Action |
|-----------|--------|
| Reproduction rounds < 2 | Create REPRODUCE-002 + ANALYZE-002 |
| Reproduction rounds >= 2 | Escalate to user for manual investigation |
2. Build REPRODUCE-002 description with specific evidence requests from analyzer
3. Build ANALYZE-002 description that loads both original and supplemental evidence
4. Record new tasks and dependency updates
**Output**: Task descriptions for dynamic wave extension
---
## Structured Output Template
```
## Summary
- Analyzer evidence request processed
- Iteration round: <current>/<max>
- Action: <create-reproduction|escalate>
## Evidence Request
- Dimensions needed: <list>
- Specific actions: <list>
## Tasks Created
- REPRODUCE-002: <description summary>
- ANALYZE-002: <description summary>
## Dependency Updates
- FIX-001 deps updated: ANALYZE-001 -> ANALYZE-002
```
---
## Error Handling
| Scenario | Resolution |
|----------|------------|
| Evidence request unclear | Use all default dimensions |
| Max iterations reached | Escalate to user |
| Session state missing | Default to iteration round 1 |