-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
Two duplicate implementations of completion detection:
- Inline in
orchestrator.js(lines 2158-2195) -completion-detectoragent created dynamically - File
src/agents/git-pusher-agent.json- Same logic as 500-char minified JS string
Issues
- DRY violation: Same "all validators approved" logic duplicated
- No constants: Topic names (
VALIDATION_RESULT,IMPLEMENTATION_READY) are magic strings - Untestable: Inline JS in JSON, no unit tests for injection logic
- String-boolean hack:
approved === true || approved === 'true'scattered in both - Two injection paths:
startCluster()(line 736-757) AND_injectCompletionAgent()(line 2128-2200)
Affected Files
| File | Lines | Issue |
|---|---|---|
src/orchestrator.js |
736-757, 2128-2200 | Two injection paths with duplicated placeholder logic |
src/agents/git-pusher-agent.json |
10 | 500-char minified trigger script |
Existing Test Coverage (DO NOT BREAK)
| Test File | What It Tests |
|---|---|
tests/config-validator.test.js |
Completion handler validation |
tests/integration/trigger-evaluation.test.js |
helpers.allResponded(), helpers.hasConsensus() |
tests/orchestrator-subscription-race.test.js |
CLUSTER_COMPLETE not lost on fast completion |
tests/integration/orchestrator-flow.test.js |
Full message flow to cluster termination |
Acceptance Criteria
- Single source of truth for "all validators approved" logic
- Constants module for topic names (
TOPICS.VALIDATION_RESULT) - Factory function to create completion agents
- Regression tests BEFORE refactoring
- Unit tests for extracted modules
- All existing tests pass
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request