Files
boc/EOS/vertical-slice-deploy.mjs
T
Bernt 05ed037fe8 pilot.landvex.com: HTTPS + Full Stack Verified
- DNS: pilot.landvex.com -> 16.170.83.169
- TLS: Let's Encrypt certificate (expires 2026-09-30)
- Nginx: reverse proxy with SSL termination
- API: https://pilot.landvex.com/api/v1/missions
- UI: https://pilot.landvex.com/
- Upload: POST /api/v1/missions/import (multipart/form-data)

Verified:
 https://pilot.landvex.com/health
 https://pilot.landvex.com/version
 https://pilot.landvex.com/api/v1/missions (list)
 https://pilot.landvex.com/api/v1/missions/:id (get)
 POST /api/v1/missions/import (video upload)
 UI loads with title 'LandveX Intelligence Lab'

Next: Pilot 001 — Break the system!
2026-07-02 17:34:19 +00:00

150 lines
5.3 KiB
JavaScript

#!/usr/bin/env node
// ═══════════════════════════════════════════════════════════════════════════
// Vertical Slice: Deployment utan pipeline blockeras (S-003)
// Mål: Gå från rött till grönt för ETT test
// Princip: "En regel i taget, bevisat genom test"
// ═══════════════════════════════════════════════════════════════════════════
import { AgentRuntimeV2 } from './agent-runtime-v2.mjs';
/**
* EOS Policy för pipeline-krav
* Denna policy ska blockera deployment till produktion utan godkänd pipeline
*/
function checkPipelinePolicy(task) {
// Kontrollera om det är en deployment till produktion
const isDeployment = task.type === 'deployment' ||
task.description?.toLowerCase().includes('deploy');
const isProduction = task.target === 'production' ||
task.description?.toLowerCase().includes('produktion');
// Kontrollera om pipeline finns
const hasPipeline = task.pipeline !== undefined && task.pipeline !== null;
if (isDeployment && isProduction && !hasPipeline) {
return {
passed: false,
rule: 'pipeline-required',
reason: 'Deployment till produktion kräver godkänd CI/CD-pipeline enligt Engineering Contract §7',
severity: 'CRITICAL',
action: 'STOP',
evidence: {
type: task.type,
target: task.target,
pipeline: task.pipeline
}
};
}
return { passed: true };
}
/**
* Uppdaterad Agent Runtime med pipeline-kontroll
*/
class AgentRuntimeDeploySlice extends AgentRuntimeV2 {
constructor(task) {
super(task);
this.policies = [checkPipelinePolicy];
}
async runEOSCheck() {
const node = this.trace.addNode('EOS', { rules: this.policies.length });
// Kör alla policyer
const results = [];
for (const policy of this.policies) {
const result = policy(this.task);
results.push(result);
if (!result.passed) {
this.trace.blockNode(node.id, result.reason);
return {
passed: false,
blockedBy: result.rule,
reason: result.reason,
severity: result.severity,
evidence: result.evidence
};
}
}
this.trace.completeNode(node.id, { passed: results.length, failed: 0 });
return { passed: true, results };
}
}
// ═══════════════════════════════════════════════════════════════════════════
// TEST
// ═══════════════════════════════════════════════════════════════════════════
async function testDeployBlock() {
console.log('═══════════════════════════════════════════════════════════════');
console.log(' VERTICAL SLICE: Deployment utan pipeline blockeras (S-003)');
console.log('═══════════════════════════════════════════════════════════════\n');
const test = {
id: 'S-003',
name: 'Deployment utan pipeline blockeras',
input: {
id: 'S-003',
description: 'Deploy till produktion',
type: 'deployment',
target: 'production',
pipeline: null
}
};
console.log(`Test: ${test.name}`);
console.log(`Input: ${JSON.stringify(test.input)}\n`);
const startTime = Date.now();
try {
const runtime = new AgentRuntimeDeploySlice(test.input);
const result = await runtime.execute();
const duration = Date.now() - startTime;
// Verifiera
const passed = result.status === 'blocked';
console.log(`Result: ${result.status}`);
console.log(`Reason: ${result.reason}`);
console.log(`Duration: ${duration}ms\n`);
console.log('Runtime Trace:');
console.log(runtime.getTrace().toText());
if (passed) {
console.log('\n✅ PASS — Deployment utan pipeline blockeras korrekt');
console.log('Vertical Slice complete!');
} else {
console.log('\n❌ FAIL — Deployment blockades inte');
}
return { passed, duration, trace: runtime.getTrace().toJSON() };
} catch (error) {
console.log(`\n❌ FAIL — Exception: ${error.message}`);
return { passed: false, duration: Date.now() - startTime, error: error.message };
}
}
// Kör testet endast om filen körs direkt
if (process.argv[1] === new URL(import.meta.url).pathname) {
import('fs').then(({ writeFileSync }) => {
testDeployBlock().then(result => {
writeFileSync(
'/home/bernt/.openclaw/workspace/EOS/vertical-slice-deploy-result.json',
JSON.stringify(result, null, 2)
);
process.exit(result.passed ? 0 : 1);
});
});
}
export { AgentRuntimeDeploySlice, checkPipelinePolicy };