Remove the nested v3/ subdirectory by moving all active source code, tests, configs, and assets directly to the project root. Archive v2/ (dead code, 847MB) to v2-archive.tar.gz. Key changes: - Move v3/src/ → src/, v3/tests/ → tests/, v3/packages/ → packages/ - Move v3/tsconfig.json, v3/vitest.config.ts to root - Merge v3/package.json into root package.json (ESM, scripts, deps, exports) - Merge v3/scripts/ into scripts/, v3/implementation/ into docs/implementation/ - Update all CI workflows to remove "cd v3 &&" and v3/ path prefixes - Fix all init installer path resolution (3-level-up → 2-level-up) - Fix hooks to use "node ./dist/cli/bundle.js" instead of bare "aqe" - Update settings.json ADR/DDD directories to docs/implementation/ - Fix helper scripts (statusline, adr-compliance, ddd-tracker, guidance-hooks) - Update 58 agent definitions: aqe/v3/ → aqe/ memory namespaces - Update 15 guidance shards: v3/src/ → src/ path references - Fix sync interfaces: remove v3/ and v2/ path references - Fix test path calculations (process.cwd() + '..' no longer needed) - Fix flaky perf test threshold (500ms → 1000ms for CI environments) - Fix complexity-analyzer test to match ADR-051 keyword-based eligibility Build passes, 17,901 tests pass, CLI and MCP bundles verified. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Integration Test Templates
Templates for testing MinCut and Consensus integration in domain coordinators. These templates provide copy-paste ready test files that ensure consistent testing patterns across all 12 AQE domains.
Quick Start
- Copy the relevant template to your domain's test folder
- Replace placeholder values (marked with
REPLACE:comments) - Implement domain-specific test cases
- Run tests to verify integration
Available Templates
MinCut Integration (mincut-domain-template.test.ts)
Tests for MinCut topology analysis integration (ADR-047).
Copy to: tests/integration/domains/[domain-name]/mincut-integration.test.ts
Test cases included:
- Bridge injection (constructor/setter)
- Topology health reporting
- Domain-filtered weak vertex detection
- Topology-based routing
- Critical topology handling
- Queen health extension
- MCP tools integration
Consensus Integration (consensus-domain-template.test.ts)
Tests for multi-model consensus verification (MM-001).
Copy to: tests/integration/domains/[domain-name]/consensus-integration.test.ts
Test cases included:
- Engine initialization
- Consensus requirement detection
- Finding verification
- Graceful degradation
- Batch verification
- Statistics tracking
- Consensus strategies
- Configuration management
How to Use the Templates
Step 1: Copy the Template
# For MinCut integration
cp v3/tests/integration/templates/mincut-domain-template.test.ts \
v3/tests/integration/domains/test-generation/mincut-integration.test.ts
# For Consensus integration
cp v3/tests/integration/templates/consensus-domain-template.test.ts \
v3/tests/integration/domains/security-compliance/consensus-integration.test.ts
Step 2: Replace Placeholder Values
Look for comments marked REPLACE: and update:
// BEFORE:
const DOMAIN_NAME: DomainName = 'test-generation'; // REPLACE with your domain
// AFTER:
const DOMAIN_NAME: DomainName = 'security-compliance';
Step 3: Import Your Domain Coordinator
// BEFORE:
// import { DomainCoordinator, createDomainCoordinator } from '../../../../src/domains/DOMAIN_NAME/coordinator';
// AFTER:
import {
SecurityComplianceCoordinator,
createSecurityComplianceCoordinator
} from '../../../../src/domains/security-compliance/coordinator';
Step 4: Implement Domain-Specific Tests
Uncomment and implement the placeholder test assertions:
// BEFORE (placeholder):
expect(true).toBe(true); // REPLACE: Remove this placeholder
// AFTER (implemented):
const coordinator = createSecurityComplianceCoordinator({
minCutBridge: bridge,
});
expect(coordinator.hasMinCutIntegration()).toBe(true);
Mock Helpers Reference
MinCut Template Mocks
// Create mock EventBus
const mockEventBus = createMockEventBus();
// Create mock AgentCoordinator with agents
const mockAgentCoordinator = createMockAgentCoordinator([
createMockAgent({ id: 'agent-1', domain: 'test-generation' }),
createMockAgent({ id: 'agent-2', domain: 'test-generation' }),
]);
// Create MinCut bridge with test config
const { bridge, mockEventBus, mockAgentCoordinator } = createTestBridge({
agents: [createMockAgent({ domain: 'test-generation' })],
useSharedGraph: true,
config: { persistData: false },
});
Consensus Template Mocks
// Create mock providers
const mockProviders = createMockProviders([
{ id: 'claude', defaultAssessment: 'confirmed', defaultConfidence: 0.9 },
{ id: 'gpt', defaultAssessment: 'confirmed', defaultConfidence: 0.85 },
]);
// Create test engine
const engine = createTestEngine({
providers: mockProviders,
minModels: 2,
verifySeverities: ['critical', 'high'],
});
// Create test finding
const finding = createTestFinding({
id: 'finding-1',
severity: 'critical',
type: 'sql-injection',
});
Example: Complete Integration Test
Here's an example of a completed MinCut integration test for the test-generation domain:
// tests/integration/domains/test-generation/mincut-integration.test.ts
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import {
TestGenerationCoordinator,
createTestGenerationCoordinator,
} from '../../../../src/domains/test-generation/coordinator';
import {
createQueenMinCutBridge,
resetMinCutState,
} from '../../../src/coordination/mincut';
// ... import mock helpers from template ...
const DOMAIN_NAME = 'test-generation' as const;
describe('test-generation MinCut Integration', () => {
let coordinator: TestGenerationCoordinator;
beforeEach(() => {
resetSharedMinCutState();
});
afterEach(() => {
resetSharedMinCutState();
});
describe('MinCut bridge injection', () => {
it('should accept MinCut bridge injection', async () => {
const { bridge } = createTestBridge();
await bridge.initialize();
coordinator = createTestGenerationCoordinator({
minCutBridge: bridge,
eventBus: createMockEventBus(),
});
expect(coordinator.hasMinCutIntegration()).toBe(true);
expect(coordinator.getTopologyHealth()).toBeDefined();
});
it('should work without MinCut bridge', async () => {
coordinator = createTestGenerationCoordinator({
minCutBridge: undefined,
eventBus: createMockEventBus(),
});
// Should still be operational
expect(coordinator.isOperational()).toBe(true);
// But topology features should be unavailable
expect(coordinator.hasMinCutIntegration()).toBe(false);
});
});
describe('topology-based test routing', () => {
it('should route tests away from weak domains', async () => {
const agents = [
createMockAgent({ id: 'gen-1', domain: 'test-generation' }),
createMockAgent({ id: 'exec-1', domain: 'test-execution' }),
];
const { bridge } = createTestBridge({ agents });
await bridge.initialize();
// Make test-execution weak by not connecting it
coordinator = createTestGenerationCoordinator({
minCutBridge: bridge,
eventBus: createMockEventBus(),
});
const routing = coordinator.getTestRoutingDecision({
testCount: 100,
preferredExecutor: 'test-execution',
});
// Should warn about weak target domain
expect(routing.warnings).toContainEqual(
expect.objectContaining({
type: 'weak-topology',
domain: 'test-execution',
})
);
});
});
});
Domain Checklist
Track which domains have MinCut and Consensus integration tests:
| Domain | MinCut Tests | Consensus Tests |
|---|---|---|
| test-generation | [ ] | [ ] |
| test-execution | [ ] | [ ] |
| coverage-analysis | [ ] | [ ] |
| quality-assessment | [ ] | [ ] |
| defect-intelligence | [ ] | [ ] |
| learning-optimization | [ ] | [ ] |
| security-compliance | [ ] | [ ] |
| chaos-resilience | [ ] | [ ] |
| requirements-validation | [ ] | [ ] |
| code-intelligence | [ ] | [ ] |
| contract-testing | [ ] | [ ] |
| visual-accessibility | [ ] | [ ] |
Running the Tests
# Run all integration tests
cd v3 && npm test -- --run tests/integration/
# Run specific domain's integration tests
cd v3 && npm test -- --run tests/integration/domains/test-generation/
# Run only MinCut integration tests
cd v3 && npm test -- --run --grep "MinCut Integration"
# Run only Consensus integration tests
cd v3 && npm test -- --run --grep "Consensus Integration"
Best Practices
-
Always reset state between tests - Use
resetSharedMinCutState()inbeforeEach/afterEach -
Test graceful degradation - Verify coordinators work without MinCut/Consensus
-
Use realistic mock data - Create agents and findings that match your domain
-
Test edge cases - Empty topology, single agent, all providers failing
-
Verify integration, not just unit behavior - Test that coordinator uses bridge correctly