Repository navigation
Introduce additive Enterprise V2 foundation, migration artifacts, and security-governed platform primitives - #573
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces an additive “Enterprise V2” foundation alongside existing V1 runtime behavior, establishing new platform boundaries (apps/packages/services), core orchestration primitives, and initial governance/security scaffolding to support an incremental migration.
Changes:
- Adds the V2 platform bootstrap (
apps/api) with shared contracts/config, an event bus, a service registry, and an orchestrator driving task execution. - Introduces initial domain service engines (repair/deployment/monitoring/AI/ledger) plus a V1→V2 adapter and a V2 validation workflow + tests.
- Adds migration/baseline documentation artifacts and V2 release planning docs.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| VERSION.md | Records V1 current runtime version and V2 target version/mode. |
| tests/v2/enterprise-platform.test.js | Adds V2 foundation tests for startup, orchestration flow, and ledger linkage. |
| services/repair-engine/index.js | Introduces a repair engine scaffold with GitHub repo URL validation. |
| services/orchestrator/index.js | Adds orchestrator service to subscribe to scheduled tasks and dispatch to services. |
| services/monitoring-engine/index.js | Adds monitoring engine scaffold returning basic host metrics. |
| services/ledger-engine/index.js | Adds ledger engine scaffold with hashing and chain export/verify APIs. |
| services/deployment-engine/index.js | Adds deployment engine scaffold with simple environment/check results. |
| services/ai-engine/index.js | Adds AI engine scaffold for provider routing decisions. |
| services/adapters/v1-server-adapter.js | Adds V1 API surface map and legacy message→task adapter. |
| scripts/check-security-audit.js | Adds CI helper script to fail build on high/critical npm audit findings. |
| packages/shared/services/service-registry.js | Adds registry for lifecycle management (register/start/stop/list). |
| packages/shared/events/event-bus.js | Adds event bus abstraction over Node EventEmitter. |
| packages/shared/contracts/platform-contracts.js | Adds shared service names, event topics, and task validation. |
| packages/shared/config/runtime-config.js | Adds runtime config defaults + env parsing for V2 platform. |
| packages/security/policy/policy-engine.js | Adds policy engine for API key authentication and RBAC authorization. |
| packages/security/auth/rbac.js | Adds basic role→permission mapping and permission checks. |
| packages/plugins/sdk/plugin-manifest.js | Adds plugin manifest validation and permissions allowlist. |
| packages/plugins/sdk/plugin-loader.js | Adds plugin loader with allowed-roots enforcement and dynamic import. |
| docs/enterprise-v2/V1-BASELINE.md | Adds V1 freeze/baseline reference for migration planning. |
| docs/enterprise-v2/README.md | Adds Enterprise V2 workspace overview. |
| docs/enterprise-v2/PHASE0-INVENTORY.md | Adds Phase 0 inventory/risk findings for migration intelligence. |
| docs/enterprise-v2/MIGRATION-MATRIX.md | Adds V1→V2 mapping and compatibility plan. |
| docs/enterprise-v2/MIGRATION-GUIDE.md | Adds staged migration guide and rollback notes. |
| docs/enterprise-v2/CHANGELOG-V2.md | Adds a V2 changelog for the incremental track. |
| apps/api/index.js | Adds createEnterprisePlatform bootstrap wiring config, registry, services, and scheduling API. |
| .github/workflows/enterprise-v2-validation.yml | Adds V2 validation workflow (deps/audit/secrets/tests + V1 smoke check). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export const DEFAULT_RUNTIME_CONFIG = Object.freeze({ | ||
| version: '2.0.0', | ||
| environment: process.env.NODE_ENV || 'development', | ||
| queueConcurrency: Number(process.env.ATOMIC_QUEUE_CONCURRENCY || 4), | ||
| healthPollMs: Number(process.env.ATOMIC_HEALTH_POLL_MS || 30000), | ||
| policyDefaultRole: process.env.ATOMIC_DEFAULT_ROLE || 'viewer', | ||
| apiRateLimitPerMinute: Number(process.env.ATOMIC_API_RATE_LIMIT || 120), | ||
| enabledProviders: parseProviderList(process.env.ATOMIC_AI_PROVIDERS || 'openai,anthropic,gemini,ollama') | ||
| }); |
| const queue = []; | ||
| const inFlight = new Map(); |
| eventBus.subscribe(EventTopics.TASK_SCHEDULED, async (task) => { | ||
| validateTask(task); | ||
| queue.push(task); |
| async stop() { | ||
| await Promise.allSettled([...inFlight.values()]); | ||
| queue.length = 0; | ||
| }, |
| verify() { | ||
| for (let index = 1; index < chain.length; index++) { | ||
| if (chain[index].previousHash !== chain[index - 1].hash) return false; | ||
| } | ||
| return true; | ||
| }, |
| const segments = parsed.pathname.replace(/^\/+/, '').split('/').filter(Boolean); | ||
| const [owner, repo] = segments; | ||
| const ownerPattern = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37})$/; | ||
| const repoPattern = /^[A-Za-z0-9._-]+$/; | ||
| return parsed.protocol === 'https:' && | ||
| parsed.hostname === 'github.com' && | ||
| segments.length >= 2 && | ||
| ownerPattern.test(owner) && | ||
| repoPattern.test(repo.replace(/\.git$/i, '')); |
| constructor({ apiKeys = [], keySalt = process.env.ATOMIC_API_KEY_SALT || 'atomic-enterprise-v2' } = {}) { | ||
| this.keySalt = keySalt; | ||
| this.apiKeys = new Set(apiKeys.map((apiKey) => this.#hash(apiKey))); | ||
| } |
| export function createAiEngineService({ providers = ['openai', 'anthropic'] } = {}) { | ||
| return { | ||
| name: ServiceNames.AI, | ||
| async start() {}, |
| async load(name, absolutePath) { | ||
| const plugin = this.#plugins.get(name); | ||
| if (!plugin) throw new Error(`plugin not registered: ${name}`); | ||
| const resolvedPath = fs.realpathSync(path.resolve(absolutePath)); | ||
| if (this.#allowedRoots.length > 0) { | ||
| const isAllowed = this.#allowedRoots.some((root) => { | ||
| const relativePath = path.relative(root, resolvedPath); | ||
| return relativePath === '' || (!relativePath.startsWith('..') && !path.isAbsolute(relativePath)); | ||
| }); | ||
| if (!isAllowed) { | ||
| throw new Error(`plugin path is not in allowed roots: ${resolvedPath}`); | ||
| } | ||
| } |
…ger, repair, policy, ai-engine, and adapter
… and path.join in tests
SolanaRemix
left a comment
There was a problem hiding this comment.
Strengths & Approval Rationale
· Additive & Safe: The architecture is designed to be additive, leaving the core server.js V1 runtime untouched. This provides a clear rollback path and allows for gradual migration.
· Clear Structure: The introduction of apps/, packages/, and services/ directories creates clean architectural boundaries, improving maintainability and separation of concerns.
· Security-First: The inclusion of a gitleaks secret hygiene gate, an npm audit step, and a PolicyEngine in the new framework demonstrates a strong commitment to security.
· Comprehensive Documentation: The migration guides (MIGRATION-GUIDE.md, MIGRATION-MATRIX.md, PHASE0-INVENTORY.md) are excellent and provide a clear roadmap for the team.
Required Test Fixes & Follow-up Actions
The new V2 validation workflow (.github/workflows/enterprise-v2-validation.yml) and the test suite (tests/v2/enterprise-platform.test.js) are great additions. To proceed, the following issues must be addressed:
- Pass the New V2 Test Suite: All 7 tests in tests/v2/enterprise-platform.test.js must pass. The tests already cover core functionality like service registration, task orchestration, ledger integrity, and plugin security. This is the most critical requirement.
- Pass the Security Audit Gate: The npm audit step in the workflow must pass. If vulnerabilities are found, they must be remediated or explicitly justified and documented.
- Pass the "V1 Baseline Smoke": The node --check server.js command must successfully run, verifying that the V1 runtime remains syntactically valid and untouched.
- Fix the test.sh Script: The documentation (PHASE0-INVENTORY.md) correctly identifies that test.sh has instability due to arithmetic increment under set -e. This script should be fixed or replaced to ensure existing tests are reliable.
- Resolve Workflow Conflicts: The PHASE0-INVENTORY.md wisely points out overlapping auto-repair workflows. While not a merge blocker, creating a clear plan for consolidation should be the immediate follow-up task after merging.
Final Verdict
This PR is a solid, well-documented foundation. The code is clean and the strategy is prudent. I am confident in approving it once the V2 validation workflow completes successfully and all tests (new and existing) are fixed and passing.
To track this, please run the "🧭 Enterprise V2 Validation" workflow on this PR and ensure it is green. Once that is done, the PR is ready to be merged.
SolanaRemix
left a comment
There was a problem hiding this comment.
@copilot Required Actions:
- Run the V2 validation workflow - The .github/workflows/enterprise-v2-validation.yml must pass completely
- Fix failing tests - The tests/v2/enterprise-platform.test.js suite must pass 100%
- Resolve security audit - The npm audit gate must pass (critical/high vulnerabilities must be fixed)
- Pass V1 smoke test - Ensure node --check server.js runs without errors
Specific Issues Identified:
· Plugin security tests - The plugin-loader path traversal tests need to be verified and passing
· Service registration - All six core services must register and start correctly
· Ledger verification - The ledger chain integrity checks must pass
· Security vulnerabilities - Any high/critical npm audit findings must be addressed
Why Request Changes:
The PR is architecturally sound, but the automated validation gates in enterprise-v2-validation.yml are the minimum quality bar for this foundation work. Merging without passing these would introduce untested code into main.
The author should:
- Run the workflow on this PR
- Fix any test failures or security issues
- Re-request review when all checks pass green ✅
This ensures the Enterprise V2 foundation is stable and secure from the start, following the project's own migration guidelines.
Addressed in commit
The "🧭 Enterprise V2 Validation" workflow was triggered on this commit, but the run is currently |
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
2 similar comments
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
🐝 Agentic Swarm Elite v1.7.0
✅ Swarm Actions Completed
🤖 Swarm intelligence by Atomic Swarm Gods Elite v1.7.0 |
SolanaRemix
left a comment
There was a problem hiding this comment.
Here's your formatted "Request Changes" comment:
Request Changes: Fix Conventional Commits
We're almost there! The final test failing is the Conventional Commits check.
The Problem:
The commit messages don't follow the required format. Here are the failing ones:
· fix(ci): address wrong - subject must be lower-case
· fix(ci): add typescript - subject must be lower-case
· fix(ci): correct update - subject must be lower-case
· fix(ci): remove npm - subject must be lower-case
· fix: address code review - subject must be lower-case
· fix: address review - header must not be longer than 1 line
· fix: tighten plugin - subject must be lower-case
· fix: harden v2 module - subject must be lower-case
· fix: address v2 validation - subject must be lower-case
· feat: add enterprise - subject must be lower-case
The Simple Fix:
The issue is that the commit subject lines start with uppercase letters. They need to start with lowercase.
Option 1 (Easiest): Reword each commit using interactive rebase:
git rebase -i HEAD~10
# Change 'pick' to 'reword' for each commit
# Change the subject to start with lowercase
# Example: "Fix: tighten plugin" → "fix: tighten plugin"Option 2 (Quickest): Squash all commits into one with a proper message:
git reset --soft HEAD~10
git commit -m "feat: introduce Enterprise V2 foundation with CI fixes"
git push --forceWhat to Change:
All commit subjects should follow this pattern:
· Start with lowercase
· Use format: type(scope): lowercase subject
· Examples: fix(ci): address wrong token error or feat: add enterprise plugins
Once This Is Fixed:
✅ All tests will pass and the PR will be ready to merge!
Please reword or squash the commits to follow the conventional commit format, then push the changes.
SolanaRemix
left a comment
There was a problem hiding this comment.
Quick fix needed: The Conventional Commits check is failing because commit subjects start with uppercase. Please run this command to squash all commits into one proper message:
git reset --soft HEAD~10
git commit -m "feat: introduce enterprise V2 foundation with CI and security gates"
git push --force
Once pushed, all tests will pass and we can merge! 🚀
|
Quick fix needed: The Conventional Commits check is failing because commit subjects start with uppercase. Please run this command to squash all commits into one proper message: Once pushed, all tests will pass and we can merge! 🚀 |
|
@copilot resolve the merge conflicts on this branch. |
# Conflicts: # .github/workflows/atomic-prod.yml # .github/workflows/elite-security-ci.yml Co-authored-by: SolanaRemix <240965752+SolanaRemix@users.noreply.github.com>
Resolved. I merged |
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
2 similar comments
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete
✅ Status: Successfully repaired with elite self-healing capabilities 🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0 |
🐝 Agentic Swarm Elite v1.7.0
✅ Swarm Actions Completed
🤖 Swarm intelligence by Atomic Swarm Gods Elite v1.7.0 |
| "node_modules/engine.io": { | ||
| "version": "6.6.9", | ||
| "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-6.6.9.tgz", | ||
| "integrity": "sha512-clKkw4C7nJ22mGgoVcCg6V/W/TxdNyIOTr89k2ONZu81qqkddPFDF0LXcbAwhzPD8DjkiRCjzuiO6Y+fkpD4vg==", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "@types/cors": "^2.8.12", | ||
| "@types/node": ">=10.0.0", | ||
| "@types/ws": "^8.5.12", | ||
| "accepts": "~1.3.4", | ||
| "base64id": "2.0.0", | ||
| "cookie": "~0.7.2", | ||
| "cors": "~2.8.5", | ||
| "debug": "~4.4.1", | ||
| "engine.io-parser": "~5.2.1", | ||
| "ws": "~8.21.0" | ||
| }, | ||
| "engines": { | ||
| "node": ">=10.2.0" | ||
| } | ||
| }, |
| "node_modules/proxy-addr": { | ||
| "version": "2.0.7", | ||
| "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", | ||
| "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", | ||
| "license": "MIT", | ||
| "dependencies": { | ||
| "forwarded": "0.2.0", | ||
| "ipaddr.js": "1.9.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">= 0.10" | ||
| } | ||
| }, |
| "node_modules/qs": { | ||
| "version": "6.15.3", | ||
| "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", | ||
| "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", | ||
| "license": "BSD-3-Clause", | ||
| "dependencies": { | ||
| "es-define-property": "^1.0.1", | ||
| "side-channel": "^1.1.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">=0.6" | ||
| }, | ||
| "funding": { | ||
| "url": "https://github.com/sponsors/ljharb" | ||
| } | ||
| }, |
| "node_modules/qs": { | ||
| "version": "6.15.3", | ||
| "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.3.tgz", | ||
| "integrity": "sha512-O9gl3zCl5h5blw1KGUzQKhA5oUXSl8rwUIM5o0S3nCXMliSvy5Dzx7/DJcI+SwgICv+IneSZwhBh1oSyEHA71A==", | ||
| "license": "BSD-3-Clause", | ||
| "dependencies": { | ||
| "es-define-property": "^1.0.1", | ||
| "side-channel": "^1.1.1" | ||
| }, | ||
| "engines": { | ||
| "node": ">=0.6" | ||
| }, | ||
| "funding": { | ||
| "url": "https://github.com/sponsors/ljharb" | ||
| } | ||
| }, |
This PR starts the Enterprise V2.0.0 migration as an additive extension of the existing V1 system, preserving current runtime behavior while introducing the core platform boundaries and contracts needed for phased extraction. It also establishes baseline and migration artifacts so future slices can move safely without duplicating services or APIs.
V1 freeze + migration intelligence
docs/enterprise-v2/V1-BASELINE.md).docs/enterprise-v2/PHASE0-INVENTORY.md), including duplicate/risky workflow observations.docs/enterprise-v2/MIGRATION-MATRIX.md,MIGRATION-GUIDE.md).V2 platform foundation (new architecture boundaries)
apps/,packages/, andservices/structure with initial bootstrap inapps/api/index.js.packages/shared/*.services/adapters/v1-server-adapter.js).Core domain service extraction scaffolds
services/orchestratorservices/repair-engineservices/deployment-engineservices/monitoring-engineservices/ai-engineservices/ledger-enginePlugin/security governance primitives
packages/plugins/sdk/*) with restricted load-root enforcement.packages/security/*) with stronger key hashing (scrypt) and permission checks.Delivery and release artifacts for V2 track
docs/enterprise-v2/reports/.VERSION.mdand V2 changelog/migration docs to support release planning.Staged CI quality gate for V2
.github/workflows/enterprise-v2-validation.ymlwith dependency audit gating, secret scanning (gitleaks), V2 foundation test execution, and V1 runtime smoke check.scripts/check-security-audit.js.