Skip to content

Introduce additive Enterprise V2 foundation, migration artifacts, and security-governed platform primitives - #573

Merged
SolanaRemix merged 13 commits into
mainfrom
copilot/upgrade-to-v200
Oct 16, 2026
Merged

SolanaRemix merged 13 commits into
mainfrom
copilot/upgrade-to-v200

Conversation

Copilot AI commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

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

    • Added a baseline freeze of current runtime/API/workflow surface (docs/enterprise-v2/V1-BASELINE.md).
    • Added Phase 0 inventory and risk findings (docs/enterprise-v2/PHASE0-INVENTORY.md), including duplicate/risky workflow observations.
    • Added explicit V1→V2 mapping and compatibility strategy (docs/enterprise-v2/MIGRATION-MATRIX.md, MIGRATION-GUIDE.md).
  • V2 platform foundation (new architecture boundaries)

    • Introduced apps/, packages/, and services/ structure with initial bootstrap in apps/api/index.js.
    • Added shared runtime config, service contracts, event topics, event bus, and service registry in packages/shared/*.
    • Added V1 compatibility adapter for progressive internal rerouting (services/adapters/v1-server-adapter.js).
  • Core domain service extraction scaffolds

    • Added initial service modules for orchestrator, repair, deployment, monitoring, AI routing, and ledger:
      • services/orchestrator
      • services/repair-engine
      • services/deployment-engine
      • services/monitoring-engine
      • services/ai-engine
      • services/ledger-engine
    • Orchestrator now dispatches typed tasks via event-driven flow and records outcomes to ledger.
  • Plugin/security governance primitives

    • Added plugin manifest validation + loader (packages/plugins/sdk/*) with restricted load-root enforcement.
    • Added RBAC + policy engine (packages/security/*) with stronger key hashing (scrypt) and permission checks.
    • Hardened URL validation in repair-engine for GitHub repo targeting.
  • Delivery and release artifacts for V2 track

    • Added enterprise V2 report set (architecture, migration, security, performance, test, blockchain, deployment) under docs/enterprise-v2/reports/.
    • Added VERSION.md and V2 changelog/migration docs to support release planning.
  • Staged CI quality gate for V2

    • Added .github/workflows/enterprise-v2-validation.yml with dependency audit gating, secret scanning (gitleaks), V2 foundation test execution, and V1 runtime smoke check.
    • Added reusable security-audit parser script: scripts/check-security-audit.js.
import { createEnterprisePlatform } from '../../apps/api/index.js';

const platform = createEnterprisePlatform();
await platform.start();

platform.schedule({
  id: 'task-1',
  type: 'repair-engine',
  payload: { repoUrl: 'https://github.com/SolanaRemix/node' }
});

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +8 to +16
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')
});
Comment on lines +4 to +5
const queue = [];
const inFlight = new Map();
Comment thread services/orchestrator/index.js Outdated
Comment on lines +18 to +20
eventBus.subscribe(EventTopics.TASK_SCHEDULED, async (task) => {
validateTask(task);
queue.push(task);
Comment on lines +46 to +49
async stop() {
await Promise.allSettled([...inFlight.values()]);
queue.length = 0;
},
Comment on lines +45 to +50
verify() {
for (let index = 1; index < chain.length; index++) {
if (chain[index].previousHash !== chain[index - 1].hash) return false;
}
return true;
},
Comment on lines +8 to +16
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, ''));
Comment on lines +5 to +8
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)));
}
Comment on lines +3 to +6
export function createAiEngineService({ providers = ['openai', 'anthropic'] } = {}) {
return {
name: ServiceNames.AI,
async start() {},
Comment thread services/adapters/v1-server-adapter.js Resolved
Comment on lines +24 to +36
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}`);
}
}
@SolanaRemix
SolanaRemix self-requested a review July 25, 2026 16:47

@SolanaRemix SolanaRemix left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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.
  2. 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.
  3. Pass the "V1 Baseline Smoke": The node --check server.js command must successfully run, verifying that the V1 runtime remains syntactically valid and untouched.
  4. 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.
  5. 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
SolanaRemix self-requested a review July 25, 2026 16:48

@SolanaRemix SolanaRemix left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Required Actions:

  1. Run the V2 validation workflow - The .github/workflows/enterprise-v2-validation.yml must pass completely
  2. Fix failing tests - The tests/v2/enterprise-platform.test.js suite must pass 100%
  3. Resolve security audit - The npm audit gate must pass (critical/high vulnerabilities must be fixed)
  4. 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:

  1. Run the workflow on this PR
  2. Fix any test failures or security issues
  3. 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.

Copilot AI commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Required Actions:

  1. Run the V2 validation workflow - The .github/workflows/enterprise-v2-validation.yml must pass completely...

Addressed in commit 34372f7.

  • Added typescript@5.9.2 to resolve the npm ls --all dependency gate failure (cosmiconfig-typescript-loader peer requirement).
  • Re-ran the required gates locally:
    • npm ls --all ✅
    • npm audit --omit=dev + node scripts/check-security-audit.js ✅ (critical/high: 0)
    • node --test tests/v2/enterprise-platform.test.js ✅ (7/7)
    • node --check server.js ✅

The "🧭 Enterprise V2 Validation" workflow was triggered on this commit, but the run is currently action_required with no jobs created (manual approval needed in Actions before it can execute).

@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 4616e00607c269e4...

✅ 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
@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 4616e00607c269e4...

✅ Status: Successfully repaired with elite self-healing capabilities

🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0

@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 4616e00607c269e4...

✅ Status: Successfully repaired with elite self-healing capabilities

🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Agentic Swarm Elite v1.7.0

Metric Value
Swarm ID swarm-1785003603-30167897162
Active Agents 5
WASM Modules 0
Swarm Intensity 7/10
AI Confidence 99.97%

✅ Swarm Actions Completed

  • 🧠 Multi-agent orchestration
  • 🦞 WASM module optimization
  • 🔒 Security audit
  • 🧪 Test execution
  • 📊 Performance analytics

🤖 Swarm intelligence by Atomic Swarm Gods Elite v1.7.0

@SolanaRemix SolanaRemix left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 --force

What 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 SolanaRemix left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! 🚀

@SolanaRemix

Copy link
Copy Markdown
Owner

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! 🚀

@SolanaRemix
SolanaRemix marked this pull request as ready for review October 15, 2026 19:56
@SolanaRemix

Copy link
Copy Markdown
Owner

@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>

Copilot AI commented Oct 15, 2026

Copy link
Copy Markdown
Contributor Author

@copilot resolve the merge conflicts on this branch.

Resolved. I merged main into this branch and fixed the workflow merge conflicts in commit 1e1275c.

@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 23729bebbef517c6...

✅ 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
@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 23729bebbef517c6...

✅ Status: Successfully repaired with elite self-healing capabilities

🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0

@github-actions

Copy link
Copy Markdown
Contributor

🔱 Atomic Swarm Gods Elite v1.7.0 - Auto-Repair Complete

Metric Value
Repair Type elite-full
Dynamic Shifting adaptive
Confidence 99.97%
Risk Score 30.0%
Blockchain Audit 23729bebbef517c6...

✅ Status: Successfully repaired with elite self-healing capabilities

🤖 This auto-repair was performed by the Atomic Swarm Gods Elite AI Agent v1.7.0

@github-actions

Copy link
Copy Markdown
Contributor

🐝 Agentic Swarm Elite v1.7.0

Metric Value
Swarm ID swarm-1792107909-38798547657
Active Agents 5
WASM Modules 0
Swarm Intensity 7/10
AI Confidence 99.97%

✅ Swarm Actions Completed

  • 🧠 Multi-agent orchestration
  • 🦞 WASM module optimization
  • 🔒 Security audit
  • 🧪 Test execution
  • 📊 Performance analytics

🤖 Swarm intelligence by Atomic Swarm Gods Elite v1.7.0

Comment thread package-lock.json
Comment on lines +811 to +831
"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"
}
},
Comment thread package-lock.json
Comment on lines +1573 to +1585
"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"
}
},
Comment thread package-lock.json
Comment on lines +1586 to +1601
"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"
}
},
Comment thread package-lock.json
Comment on lines +1586 to +1601
"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"
}
},
@SolanaRemix
SolanaRemix added this pull request to stack #1621 October 15, 2026 23:50
@SolanaRemix
SolanaRemix merged commit e91e88f into main Oct 16, 2026
26 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants