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(ruflo-mods): pin registeredEvents to what register() hooks across every option combination (#3805)

Dragan Spiridonov810fb0de4813
diff --git a/plugins/ruflo-mods/hooks/probe/index.ts b/plugins/ruflo-mods/hooks/probe/index.ts
index 39f5298ab9..b5ebbb9d47 100644
--- a/plugins/ruflo-mods/hooks/probe/index.ts
+++ b/plugins/ruflo-mods/hooks/probe/index.ts
@@ -27,8 +27,8 @@ const MAX_LINE = 240
/**
* The events this module registers, by name. The engine reads `on` calls
- * statically (it refuses a wrapped or aliased `on`), so the list is kept here
- * and a test fails when it drifts from the `on('<event>', ...)` calls in hooks/.
+ * statically (it refuses a wrapped or aliased `on`), so the list is kept here;
+ * tests/probe.test.ts fails when it drifts from what register() hooks under any option combination.
*/
const ALWAYS = ['command.run', 'engine.create', 'prompt.submit', 'session.end', 'session.start', 'tool.call', 'tool.check', 'turn.complete'] as const
diff --git a/plugins/ruflo-mods/tests/probe.test.ts b/plugins/ruflo-mods/tests/probe.test.ts
index 6a63fc714f..67a47c4917 100644
--- a/plugins/ruflo-mods/tests/probe.test.ts
+++ b/plugins/ruflo-mods/tests/probe.test.ts
@@ -1,6 +1,8 @@
import { describe, expect, test, tier } from 'claude-code/testing'
+import { readOptions } from '../hooks/options'
import { probeLine, probeState, registeredEvents, versionText } from '../hooks/probe'
+import { register } from '../hooks/register'
import { run } from './fixtures/consumer'
import { HELPER, ROOT, START, world } from './fixtures/world'
@@ -32,6 +34,19 @@ describe('capability probe, pure (ADR-451 item 5)', () => {
)
})
+ test('registeredEvents matches what register() hooks, for every option combination', () => {
+ const B = [false, true]
+ for (const costBudgetUsd of [undefined, 5]) for (const costHardStop of B) for (const sessionRollup of B)
+ for (const agentTrim of B) for (const modTrust of ['observe', 'off']) for (const toolHints of B)
+ for (const deliveryScreen of B) for (const compactCarry of B) {
+ const o = { costBudgetUsd, costHardStop, sessionRollup, agentTrim, modTrust, toolHints, deliveryScreen, compactCarry, capabilityProbe: true }
+ const seen = new Set<string>()
+ const chain: { catch: () => unknown } = { catch: () => chain }
+ register(((name: string) => (name !== '*' && seen.add(name), chain)) as never, o as never)
+ expect(registeredEvents(readOptions(o as never)), JSON.stringify(o)).toEqual([...seen].sort())
+ }
+ })
+
test('events hooked only under an option are counted only under it', () => {
const base = { toolHints: false, agentTrim: false, deliveryScreen: false }
const off = registeredEvents(base)