Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

test(console): kill the two surviving mutations (per-command verify permission, rotation inside the write chain)

ruve00c40da9b9e
diff --git a/plugins/ruflo-console/tests/ap-review.spec.ts b/plugins/ruflo-console/tests/ap-review.spec.ts
index 16229840b5..603ac6f5e7 100644
--- a/plugins/ruflo-console/tests/ap-review.spec.ts
+++ b/plugins/ruflo-console/tests/ap-review.spec.ts
@@ -5,6 +5,7 @@
*/
import { describe, expect, it } from 'vitest'
+import { rotate } from '../hooks/ap-maint'
import { apTick, refreshAutopilot, storeOf, stopNow, wireAutopilot } from '../hooks/ap-live'
import { outcomesOf, propose, reversal, type Tunables, DEFAULTS } from '../hooks/data/ap-adapt'
import { hashOf, type Envelope } from '../hooks/data/ap-envelope'
@@ -169,6 +170,32 @@ describe('the journal over a long run', () => {
})
})
+describe('rotation waits for the write chain', () => {
+ it('a write still in flight lands before the snapshot is taken: nothing is archived or replaced until the chain is free', async () => {
+ const r = rig()
+ const state = stateWith([])
+
+ started(r, [])
+ wireAutopilot(state, r.host)
+ await refreshAutopilot(state, r.host, T0 + 1000)
+
+ const store = storeOf(state)
+ let release: () => void = () => undefined
+
+ store.chain = new Promise<void>(resolve => { release = resolve })
+
+ const before = r.files.get(J)
+ const done = rotate(store, r.host, CWD, T0 + 5000)
+
+ await new Promise(resolve => setTimeout(resolve, 20))
+ expect([...r.files.keys()].some(name => name.startsWith(`${J}.`))).toBe(false)
+ expect(r.files.get(J)).toBe(before)
+ release()
+ await done
+ expect([...r.files.keys()].some(name => name.startsWith(`${J}.`))).toBe(true)
+ })
+})
+
describe('what adaptation learns', () => {
const step = (over: Record<string, unknown>) => ({ id: 's', task: 't', cls: 'edit', attempt: 1, startedAt: 0, deadline: 1, status: 'failed' as const, tier: 'mid', par: 1, endedAt: 10, ...over })
diff --git a/plugins/ruflo-console/tests/security-audit-live.spec.ts b/plugins/ruflo-console/tests/security-audit-live.spec.ts
index dcd8ecebce..5c5cd24610 100644
--- a/plugins/ruflo-console/tests/security-audit-live.spec.ts
+++ b/plugins/ruflo-console/tests/security-audit-live.spec.ts
@@ -156,6 +156,22 @@ describe('live: kill-switch latency and TOCTOU', () => {
})
})
+describe('live: per-command permission', () => {
+ it('a verify command the person\'s rules deny is not run even when the class-level preflight allows Bash', async () => {
+ const r = rig()
+ const state = stateWith([task('r1', 'completed'), task('r2', 'pending'), task('r3', 'pending')])
+
+ started(r, [dangling()])
+ wireAutopilot(state, r.host, { toolCheck: async (_tool, input) => ({ decision: input === undefined ? 'allow' : 'deny' }) })
+ storeOf(state).bootMs = T0 - 1
+ ready(state, T0 + 1000)
+ await apTick(state, r.host, T0 + 1000)
+
+ expect(r.runs.some(a => a[0] === 'true')).toBe(false)
+ expect(journal(r).some(e => e.t === 'step.done')).toBe(false)
+ })
+})
+
describe('live: double execution', () => {
it('two sessions that both start the same step: neither hands it over', async () => {
const r = rig()