arcvision 0.2.14 โ 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCVISION_DIRECTORY_STRUCTURE.md +104 -0
- package/CLI_STRUCTURE.md +110 -0
- package/CONFIGURATION.md +119 -0
- package/IMPLEMENTATION_SUMMARY.md +99 -0
- package/README.md +149 -89
- package/architecture.authority.ledger.json +46 -0
- package/arcvision-0.2.3.tgz +0 -0
- package/arcvision-0.2.4.tgz +0 -0
- package/arcvision-0.2.5.tgz +0 -0
- package/arcvision.context.diff.json +2181 -0
- package/arcvision.context.json +1021 -0
- package/arcvision.context.v1.json +2163 -0
- package/arcvision.context.v2.json +2173 -0
- package/arcvision_context/README.md +93 -0
- package/arcvision_context/architecture.authority.ledger.json +83 -0
- package/arcvision_context/arcvision.context.json +6884 -0
- package/debug-cycle-detection.js +56 -0
- package/dist/index.js +1626 -25
- package/docs/ENHANCED_ACCURACY_SAFETY_PROTOCOL.md +172 -0
- package/docs/accuracy-enhancement-artifacts/enhanced-validation-config.json +98 -0
- package/docs/acig-robustness-guide.md +164 -0
- package/docs/authoritative-gate-implementation.md +168 -0
- package/docs/cli-strengthening-summary.md +232 -0
- package/docs/invariant-system-summary.md +100 -0
- package/docs/invariant-system.md +112 -0
- package/generate_large_test.js +42 -0
- package/large_test_repo.json +1 -0
- package/output1.json +2163 -0
- package/output2.json +2163 -0
- package/package.json +46 -36
- package/scan_calcom_report.txt +0 -0
- package/scan_leafmint_report.txt +0 -0
- package/scan_output.txt +0 -0
- package/scan_trigger_report.txt +0 -0
- package/schema/arcvision_context_schema_v1.json +136 -1
- package/src/arcvision-guard.js +433 -0
- package/src/core/authority-core-detector.js +382 -0
- package/src/core/authority-ledger.js +300 -0
- package/src/core/blastRadius.js +299 -0
- package/src/core/call-resolver.js +196 -0
- package/src/core/change-evaluator.js +509 -0
- package/src/core/change-evaluator.js.backup +424 -0
- package/src/core/change-evaluator.ts +285 -0
- package/src/core/chunked-uploader.js +180 -0
- package/src/core/circular-dependency-detector.js +404 -0
- package/src/core/cli-error-handler.js +458 -0
- package/src/core/cli-validator.js +458 -0
- package/src/core/compression.js +64 -0
- package/src/core/context_builder.js +741 -0
- package/src/core/dependency-manager.js +134 -0
- package/src/core/di-detector.js +202 -0
- package/src/core/diff-analyzer.js +76 -0
- package/src/core/example-invariants.js +135 -0
- package/src/core/failure-mode-synthesizer.js +341 -0
- package/src/core/invariant-analyzer.js +294 -0
- package/src/core/invariant-detector.js +548 -0
- package/src/core/invariant-enforcer.js +171 -0
- package/src/core/invariant-evaluation-utils.js +172 -0
- package/src/core/invariant-hooks.js +152 -0
- package/src/core/invariant-integration-example.js +186 -0
- package/src/core/invariant-registry.js +298 -0
- package/src/core/invariant-registry.ts +100 -0
- package/src/core/invariant-types.js +66 -0
- package/src/core/invariants-index.js +88 -0
- package/src/core/method-tracker.js +170 -0
- package/src/core/override-handler.js +304 -0
- package/src/core/ownership-resolver.js +227 -0
- package/src/core/parser-enhanced.js +80 -0
- package/src/core/parser.js +610 -0
- package/src/core/path-resolver.js +240 -0
- package/src/core/pattern-matcher.js +246 -0
- package/src/core/progress-tracker.js +71 -0
- package/src/core/react-nextjs-detector.js +245 -0
- package/src/core/readme-generator.js +167 -0
- package/src/core/retry-handler.js +57 -0
- package/src/core/scanner.js +289 -0
- package/src/core/semantic-analyzer.js +204 -0
- package/src/core/structural-context-owner.js +442 -0
- package/src/core/symbol-indexer.js +164 -0
- package/src/core/tsconfig-utils.js +73 -0
- package/src/core/type-analyzer.js +272 -0
- package/src/core/watcher.js +18 -0
- package/src/core/workspace-scanner.js +88 -0
- package/src/engine/context_builder.js +280 -0
- package/src/engine/context_sorter.js +59 -0
- package/src/engine/context_validator.js +200 -0
- package/src/engine/id-generator.js +16 -0
- package/src/engine/pass1_facts.js +260 -0
- package/src/engine/pass2_semantics.js +333 -0
- package/src/engine/pass3_lifter.js +99 -0
- package/src/engine/pass4_signals.js +201 -0
- package/src/index.js +830 -0
- package/src/plugins/express-plugin.js +48 -0
- package/src/plugins/plugin-manager.js +58 -0
- package/src/plugins/react-plugin.js +54 -0
- package/temp_original.js +0 -0
- package/test/determinism-test.js +83 -0
- package/test-authoritative-context.js +53 -0
- package/test-real-authoritative-context.js +118 -0
- package/test-upload-enhancements.js +111 -0
- package/test_repos/allowed-clean-architecture/.arcvision/invariants.json +57 -0
- package/test_repos/allowed-clean-architecture/adapters/controllers/UserController.js +95 -0
- package/test_repos/allowed-clean-architecture/adapters/http/HttpServer.js +78 -0
- package/test_repos/allowed-clean-architecture/application/dtos/CreateUserRequest.js +37 -0
- package/test_repos/allowed-clean-architecture/application/services/UserService.js +61 -0
- package/test_repos/allowed-clean-architecture/arcvision_context/README.md +93 -0
- package/test_repos/allowed-clean-architecture/arcvision_context/arcvision.context.json +2796 -0
- package/test_repos/allowed-clean-architecture/domain/interfaces/UserRepository.js +25 -0
- package/test_repos/allowed-clean-architecture/domain/models/User.js +39 -0
- package/test_repos/allowed-clean-architecture/index.js +45 -0
- package/test_repos/allowed-clean-architecture/infrastructure/database/DatabaseConnection.js +56 -0
- package/test_repos/allowed-clean-architecture/infrastructure/repositories/InMemoryUserRepository.js +61 -0
- package/test_repos/allowed-clean-architecture/package.json +15 -0
- package/test_repos/blocked-legacy-monolith/.arcvision/invariants.json +78 -0
- package/test_repos/blocked-legacy-monolith/arcvision_context/README.md +93 -0
- package/test_repos/blocked-legacy-monolith/arcvision_context/arcvision.context.json +2882 -0
- package/test_repos/blocked-legacy-monolith/database/dbConnection.js +35 -0
- package/test_repos/blocked-legacy-monolith/index.js +38 -0
- package/test_repos/blocked-legacy-monolith/modules/emailService.js +31 -0
- package/test_repos/blocked-legacy-monolith/modules/paymentProcessor.js +37 -0
- package/test_repos/blocked-legacy-monolith/package.json +15 -0
- package/test_repos/blocked-legacy-monolith/shared/utils.js +19 -0
- package/test_repos/blocked-legacy-monolith/utils/helpers.js +23 -0
- package/test_repos/risky-microservices-concerns/.arcvision/invariants.json +69 -0
- package/test_repos/risky-microservices-concerns/arcvision_context/README.md +93 -0
- package/test_repos/risky-microservices-concerns/arcvision_context/arcvision.context.json +3070 -0
- package/test_repos/risky-microservices-concerns/common/utils.js +77 -0
- package/test_repos/risky-microservices-concerns/gateways/apiGateway.js +84 -0
- package/test_repos/risky-microservices-concerns/index.js +20 -0
- package/test_repos/risky-microservices-concerns/libs/deprecatedHelper.js +36 -0
- package/test_repos/risky-microservices-concerns/package.json +15 -0
- package/test_repos/risky-microservices-concerns/services/orderService.js +42 -0
- package/test_repos/risky-microservices-concerns/services/userService.js +48 -0
- package/verify_engine.js +116 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Common Utilities - Growing beyond reasonable size limits
|
|
2
|
+
|
|
3
|
+
// TODO: refactor this massive utility file into smaller, focused modules
|
|
4
|
+
// FIXME: split authentication, validation, and formatting logic into separate files
|
|
5
|
+
|
|
6
|
+
function authenticateUser(credentials) {
|
|
7
|
+
// Authentication logic
|
|
8
|
+
return credentials.username === 'admin' && credentials.password === 'password';
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function validateEmail(email) {
|
|
12
|
+
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function formatCurrency(amount) {
|
|
16
|
+
return `$${amount.toFixed(2)}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function formatDate(date) {
|
|
20
|
+
return date.toISOString().split('T')[0];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function generateId() {
|
|
24
|
+
return Math.random().toString(36).substr(2, 9);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function calculateTax(amount, rate = 0.08) {
|
|
28
|
+
return amount * rate;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function validatePhone(phone) {
|
|
32
|
+
return /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/.test(phone);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function sanitizeInput(input) {
|
|
36
|
+
return input.replace(/[^a-zA-Z0-9\s]/g, '');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function encryptPassword(password) {
|
|
40
|
+
// Simple encryption for demo purposes
|
|
41
|
+
return Buffer.from(password).toString('base64');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function decryptPassword(encrypted) {
|
|
45
|
+
return Buffer.from(encrypted, 'base64').toString();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// More functions that make this file unwieldy...
|
|
49
|
+
function complexBusinessLogic(data) {
|
|
50
|
+
// This function is getting too complex
|
|
51
|
+
// manualLoadBalancing logic should be extracted
|
|
52
|
+
return data.map(item => ({
|
|
53
|
+
...item,
|
|
54
|
+
processed: true,
|
|
55
|
+
timestamp: new Date()
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function anotherUtilityFunction(param) {
|
|
60
|
+
// Yet another function making this file larger
|
|
61
|
+
return param.toUpperCase();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
module.exports = {
|
|
65
|
+
authenticateUser,
|
|
66
|
+
validateEmail,
|
|
67
|
+
formatCurrency,
|
|
68
|
+
formatDate,
|
|
69
|
+
generateId,
|
|
70
|
+
calculateTax,
|
|
71
|
+
validatePhone,
|
|
72
|
+
sanitizeInput,
|
|
73
|
+
encryptPassword,
|
|
74
|
+
decryptPassword,
|
|
75
|
+
complexBusinessLogic,
|
|
76
|
+
anotherUtilityFunction
|
|
77
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// API Gateway - Contains concerning complexity patterns
|
|
2
|
+
|
|
3
|
+
const express = require('express');
|
|
4
|
+
const userService = require('../services/userService');
|
|
5
|
+
const orderService = require('../services/orderService');
|
|
6
|
+
|
|
7
|
+
class ApiGateway {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.app = express();
|
|
10
|
+
this.setupRoutes();
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
setupRoutes() {
|
|
14
|
+
// Complex routing logic that should be simplified
|
|
15
|
+
// complexRoutingLogic pattern present
|
|
16
|
+
|
|
17
|
+
this.app.get('/api/users/:id', async (req, res) => {
|
|
18
|
+
try {
|
|
19
|
+
const user = await userService.getUser(req.params.id);
|
|
20
|
+
res.json(user);
|
|
21
|
+
} catch (error) {
|
|
22
|
+
res.status(500).json({ error: error.message });
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
this.app.get('/api/orders/:id', async (req, res) => {
|
|
27
|
+
try {
|
|
28
|
+
const order = await orderService.getOrder(req.params.id);
|
|
29
|
+
res.json(order);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
res.status(500).json({ error: error.message });
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// Manual load balancing logic - concerning pattern
|
|
36
|
+
// manualLoadBalancing pattern present
|
|
37
|
+
this.app.post('/api/process-complex-request', async (req, res) => {
|
|
38
|
+
try {
|
|
39
|
+
// Simulating manual load balancing decisions
|
|
40
|
+
const serverInstance = this.selectServerInstance(req.body.priority);
|
|
41
|
+
const result = await this.routeToService(serverInstance, req.body);
|
|
42
|
+
res.json(result);
|
|
43
|
+
} catch (error) {
|
|
44
|
+
res.status(500).json({ error: error.message });
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Manual load balancing logic - should be handled by infrastructure
|
|
50
|
+
selectServerInstance(priority) {
|
|
51
|
+
// This manual load balancing logic is concerning
|
|
52
|
+
const instances = ['server-1', 'server-2', 'server-3'];
|
|
53
|
+
if (priority === 'high') {
|
|
54
|
+
return instances[0]; // Route high priority to first server
|
|
55
|
+
} else if (priority === 'medium') {
|
|
56
|
+
return instances[1]; // Route medium to second
|
|
57
|
+
} else {
|
|
58
|
+
return instances[2]; // Route low to third
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
async routeToService(instance, requestData) {
|
|
63
|
+
// Complex routing logic that mixes concerns
|
|
64
|
+
console.log(`Routing to ${instance} with data:`, requestData);
|
|
65
|
+
|
|
66
|
+
// This kind of routing logic belongs in infrastructure, not application code
|
|
67
|
+
if (requestData.type === 'user') {
|
|
68
|
+
return await userService.getUser(requestData.id);
|
|
69
|
+
} else if (requestData.type === 'order') {
|
|
70
|
+
return await orderService.getOrder(requestData.id);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return { error: 'Unknown request type' };
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
start(port = 3001) {
|
|
77
|
+
this.app.listen(port, () => {
|
|
78
|
+
console.log(`API Gateway listening on port ${port}`);
|
|
79
|
+
console.log('WARNING: Contains concerning architectural patterns');
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
module.exports = new ApiGateway();
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// Main Application Entry Point - Risky Microservices Architecture
|
|
2
|
+
|
|
3
|
+
const apiGateway = require('./gateways/apiGateway');
|
|
4
|
+
const userService = require('./services/userService');
|
|
5
|
+
const orderService = require('./services/orderService');
|
|
6
|
+
|
|
7
|
+
console.log('Starting Risky Microservices Architecture...');
|
|
8
|
+
console.log('WARNING: This application contains concerning architectural patterns!');
|
|
9
|
+
|
|
10
|
+
// Initialize services
|
|
11
|
+
console.log('Initializing services...');
|
|
12
|
+
console.log('Services ready with potential interdependencies');
|
|
13
|
+
|
|
14
|
+
// Start the API gateway
|
|
15
|
+
apiGateway.start(3001);
|
|
16
|
+
|
|
17
|
+
// Health check endpoint
|
|
18
|
+
setInterval(() => {
|
|
19
|
+
console.log('Health check: Services operational but with architectural concerns');
|
|
20
|
+
}, 30000);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Deprecated Helper Library - Should not be used in new code
|
|
2
|
+
|
|
3
|
+
// WARNING: This library is deprecated and should not be used
|
|
4
|
+
// Kept for backward compatibility only
|
|
5
|
+
|
|
6
|
+
function processUserData(userData) {
|
|
7
|
+
// Legacy processing logic
|
|
8
|
+
console.log('Using deprecated user data processor');
|
|
9
|
+
return {
|
|
10
|
+
...userData,
|
|
11
|
+
processed: true,
|
|
12
|
+
legacyFlag: true,
|
|
13
|
+
// More legacy transformations...
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function legacyFormatResponse(data) {
|
|
18
|
+
// Old response formatting
|
|
19
|
+
return {
|
|
20
|
+
success: true,
|
|
21
|
+
data: data,
|
|
22
|
+
timestamp: new Date().toISOString(),
|
|
23
|
+
legacyVersion: '1.0'
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function deprecatedValidation(input) {
|
|
28
|
+
// Outdated validation logic
|
|
29
|
+
return input && input.length > 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
module.exports = {
|
|
33
|
+
processUserData,
|
|
34
|
+
legacyFormatResponse,
|
|
35
|
+
deprecatedValidation
|
|
36
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "risky-microservices-concerns",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Microservices with concerning architectural patterns for ArcVision testing",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"start": "node index.js",
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"express": "^4.18.2"
|
|
12
|
+
},
|
|
13
|
+
"author": "ArcVision Test Suite",
|
|
14
|
+
"license": "MIT"
|
|
15
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
// Order Service - Creates inter-service dependency cycle
|
|
2
|
+
|
|
3
|
+
const userService = require('./userService'); // Creates circular dependency risk
|
|
4
|
+
const commonUtils = require('../common/utils');
|
|
5
|
+
|
|
6
|
+
class OrderService {
|
|
7
|
+
constructor() {
|
|
8
|
+
this.userService = userService;
|
|
9
|
+
this.utils = commonUtils;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async getOrder(orderId) {
|
|
13
|
+
// Order fetching logic
|
|
14
|
+
return { id: orderId, amount: 100, status: 'completed' };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async getUserOrders(userId) {
|
|
18
|
+
// Risky: Calling user service from order service creates tight coupling
|
|
19
|
+
const user = await this.userService.getUser(userId);
|
|
20
|
+
|
|
21
|
+
// Complex business logic that should probably be elsewhere
|
|
22
|
+
// manualLoadBalancing logic here - triggers pattern detection
|
|
23
|
+
|
|
24
|
+
return [
|
|
25
|
+
{ id: 1, amount: 50, status: 'completed' },
|
|
26
|
+
{ id: 2, amount: 150, status: 'pending' }
|
|
27
|
+
];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async createOrder(orderData) {
|
|
31
|
+
// Order creation logic with complex routing
|
|
32
|
+
// complexRoutingLogic present - triggers pattern detection
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
id: Math.floor(Math.random() * 1000),
|
|
36
|
+
...orderData,
|
|
37
|
+
status: 'created'
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = new OrderService();
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// User Service - Has concerning inter-service dependencies
|
|
2
|
+
|
|
3
|
+
const orderService = require('../services/orderService'); // Risky: Direct service-to-service dependency
|
|
4
|
+
const commonUtils = require('../common/utils');
|
|
5
|
+
const deprecatedHelper = require('../libs/deprecatedHelper'); // Risky: Using deprecated library
|
|
6
|
+
|
|
7
|
+
class UserService {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.orderService = orderService;
|
|
10
|
+
this.utils = commonUtils;
|
|
11
|
+
this.deprecatedHelper = deprecatedHelper;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
async getUser(userId) {
|
|
15
|
+
// TODO: refactor this complex logic into separate modules
|
|
16
|
+
const user = await this.fetchUserFromDB(userId);
|
|
17
|
+
|
|
18
|
+
// Risky: Direct dependency on order service
|
|
19
|
+
const orders = await this.orderService.getUserOrders(userId);
|
|
20
|
+
|
|
21
|
+
// FIXME: split this business logic into proper service boundaries
|
|
22
|
+
const enrichedUser = {
|
|
23
|
+
...user,
|
|
24
|
+
orderCount: orders.length,
|
|
25
|
+
totalSpent: orders.reduce((sum, order) => sum + order.amount, 0)
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return enrichedUser;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async createUser(userData) {
|
|
32
|
+
// Using deprecated helper - risky pattern
|
|
33
|
+
const processedData = this.deprecatedHelper.processUserData(userData);
|
|
34
|
+
return this.saveUser(processedData);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async fetchUserFromDB(userId) {
|
|
38
|
+
// Database logic here
|
|
39
|
+
return { id: userId, name: 'John Doe', email: 'john@example.com' };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async saveUser(userData) {
|
|
43
|
+
// Save logic here
|
|
44
|
+
return { ...userData, id: Math.floor(Math.random() * 1000) };
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
module.exports = new UserService();
|
package/verify_engine.js
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const { scan } = require('./src/core/scanner');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
async function testEngine() {
|
|
6
|
+
try {
|
|
7
|
+
console.log("๐งช STARTING ENGINE VERIFICATION...");
|
|
8
|
+
|
|
9
|
+
// Target: arcvision-dashboard (sibling directory)
|
|
10
|
+
const targetDir = path.resolve(__dirname, '../arcvision-dashboard');
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(targetDir)) {
|
|
13
|
+
console.log(`โ ๏ธ Target directory not found: ${targetDir}`);
|
|
14
|
+
console.log("Testing with src/core instead...");
|
|
15
|
+
|
|
16
|
+
// Test with local src/core directory
|
|
17
|
+
const localTarget = path.resolve(__dirname, './src/core');
|
|
18
|
+
if (!fs.existsSync(localTarget)) {
|
|
19
|
+
console.error(`โ Local test directory not found: ${localTarget}`);
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
const context = await scan(localTarget);
|
|
23
|
+
await validateContext(context);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const context = await scan(targetDir);
|
|
28
|
+
|
|
29
|
+
// Validation Checks
|
|
30
|
+
console.log("\n๐งช VERIFICATION CHECKS:");
|
|
31
|
+
|
|
32
|
+
// 1. Check for Nodes
|
|
33
|
+
if (context.nodes.length > 0) {
|
|
34
|
+
console.log(`โ
Nodes found: ${context.nodes.length}`);
|
|
35
|
+
} else {
|
|
36
|
+
console.error("โ No nodes found!");
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 2. Check for Edges
|
|
40
|
+
if (context.edges.length > 0) {
|
|
41
|
+
console.log(`โ
Edges found: ${context.edges.length}`);
|
|
42
|
+
} else {
|
|
43
|
+
console.warn("โ ๏ธ No edges found (might be expected if no dependencies, but unlikely)");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 3. Check for Pass 3 Roles
|
|
47
|
+
const services = context.nodes.filter(n => n.role === 'service' || n.role === 'controller');
|
|
48
|
+
if (services.length > 0) {
|
|
49
|
+
console.log(`โ
Structural Roles Inferred: Found ${services.length} services/controllers`);
|
|
50
|
+
} else {
|
|
51
|
+
console.log(`โน๏ธ No specific roles inferred (found ${context.nodes.length} total nodes with roles)`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// 4. Check for Pass 2 Semantic Edges
|
|
55
|
+
const semanticEdges = context.edges.filter(e => e.relation === 'calls' || e.relation === 'depends_on');
|
|
56
|
+
if (semanticEdges.length > 0) {
|
|
57
|
+
console.log(`โ
Semantic Edges Resolved: ${semanticEdges.length} (calls/depends_on)`);
|
|
58
|
+
} else {
|
|
59
|
+
console.log(`โน๏ธ No semantic edges found. ${context.edges.length - semanticEdges.length} import edges only.`);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// 5. Check for Pass 4 Signals
|
|
63
|
+
const criticalFiles = context.nodes.filter(n => n.blast_radius > 0);
|
|
64
|
+
if (criticalFiles.length > 0) {
|
|
65
|
+
console.log(`โ
Signals Computed: ${criticalFiles.length} files have dependencies`);
|
|
66
|
+
} else {
|
|
67
|
+
console.warn("โ ๏ธ Blast radius appears to be 0 for all files");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
console.log("\nโจ VERIFICATION COMPLETE");
|
|
71
|
+
process.exit(0);
|
|
72
|
+
|
|
73
|
+
} catch (e) {
|
|
74
|
+
console.error("โ VERIFICATION FAILED:", e);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
async function validateContext(context) {
|
|
80
|
+
console.log("\n๐งช CONTEXT VALIDATION:");
|
|
81
|
+
|
|
82
|
+
// Basic structure checks
|
|
83
|
+
if (!context.nodes || !Array.isArray(context.nodes)) {
|
|
84
|
+
console.error("โ Missing or invalid nodes array");
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (!context.edges || !Array.isArray(context.edges)) {
|
|
89
|
+
console.error("โ Missing or invalid edges array");
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (!context.metrics) {
|
|
94
|
+
console.error("โ Missing metrics object");
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(`โ
Nodes: ${context.nodes.length}`);
|
|
99
|
+
console.log(`โ
Edges: ${context.edges.length}`);
|
|
100
|
+
console.log(`โ
Schema version: ${context.schema_version || 'missing'}`);
|
|
101
|
+
console.log(`โ
Metrics present: ${!!context.metrics}`);
|
|
102
|
+
|
|
103
|
+
// Check for expected multi-pass outputs
|
|
104
|
+
const nodesWithRoles = context.nodes.filter(n => n.role);
|
|
105
|
+
const nodesWithLayers = context.nodes.filter(n => n.layer);
|
|
106
|
+
const nodesWithSignals = context.nodes.filter(n => n.blast_radius !== undefined);
|
|
107
|
+
|
|
108
|
+
console.log(`โ
Nodes with roles: ${nodesWithRoles.length}`);
|
|
109
|
+
console.log(`โ
Nodes with layers: ${nodesWithLayers.length}`);
|
|
110
|
+
console.log(`โ
Nodes with signals: ${nodesWithSignals.length}`);
|
|
111
|
+
|
|
112
|
+
console.log("\nโจ VALIDATION COMPLETE");
|
|
113
|
+
process.exit(0);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
testEngine();
|