mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-12-04 06:21:59 +09:00
- ruflo-mods guard (tool.check): read-only fast path on e.isReadOnly (2.1.304) that skips the policy-projection stat while a full check found none in the last 2 s (web tools excluded so the research ask still fires); a chain deny returns without file reads; decider "person" on every ask ruflo raises; agentId names the subagent on ruflo's reason; the chain's ceiling survives a tightening; .catch documented for 2.1.301 semantics, still fails closed. - ruflo-console: console_state and console_run registered with isDeferred: false (2.1.293); console_open/console_set stay deferred. - console + swarm: Text bold -> weight (2.1.299 deprecation), codemodded; bold: true -> weight: "semibold" (what the host already maps bold to). Engines before 2.1.299 refuse a tree with an unknown Text prop, so the kit maps weight back to bold there (text-weight.ts, via $.session.version()). - tests for 2.1.318's kit: $.tool.call now raises tool.check first (guidance test); stub answers are validated (swarm prompt.fill stub); stale expectations fixed (probe session.compact, learning-loop handshake). - console kit tests: timeoutMs 30_000 (the 5 s default timed out 19-58 end-to-end tests under load, on 2.1.289 and 2.1.318 alike), and the mock clock advanced past runner.ts's VERIFY_RETRY_MS in actions/settings tests. Co-authored-by: r <r@x>
59 lines
2.4 KiB
TypeScript
59 lines
2.4 KiB
TypeScript
/**
|
|
* The Optimizer in the Overview page: findings with a scope that limits the fixes offered, and a fix whose confirm opens right under
|
|
* the finding that raised it, before anything runs.
|
|
*/
|
|
import type { TestBody } from 'claude-code/testing'
|
|
import { describe, expect, mock, test } from 'claude-code/testing'
|
|
|
|
import { RUFLO_FILES } from './fixtures/ruflo-run'
|
|
import { command, elementsOf, keyOf, paneAt, PLUGIN, SESSION, textOf, worldOf } from './fixtures/world'
|
|
|
|
type Body = Parameters<TestBody>
|
|
|
|
const keys = (tree: Parameters<typeof elementsOf>[0]) => elementsOf(tree, 'Button').map(keyOf)
|
|
|
|
async function opened($: Body[0], on: Body[1]) {
|
|
const world = worldOf(on, RUFLO_FILES)
|
|
|
|
mock.clock(on)
|
|
await $.session.start(SESSION)
|
|
await $.command.run(command('overview'))
|
|
|
|
const pane = await $.ui.mount({ ...paneAt(150), surface: 'terminal' as const, plugin: PLUGIN })
|
|
|
|
await pane.drawn()
|
|
|
|
return { world, pane }
|
|
}
|
|
|
|
describe('optimizer', () => {
|
|
test('the Overview opens with an Optimizer: findings, the scope chips, and only the safe fixes at first', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { pane } = await opened($, on)
|
|
const tree = await pane.drawn()
|
|
const order = keys(tree)
|
|
|
|
expect(textOf(tree)).toContain('OPTIMIZER')
|
|
expect(textOf(tree)).toMatch(/\d+ findings?/)
|
|
expect(order).toEqual(expect.arrayContaining(['opt-scope-safe', 'opt-scope-balanced', 'opt-scope-deep', 'opt-ask-performance-unprofiled']))
|
|
expect(order).not.toContain('opt-fix-performance-unprofiled-perf-optimize')
|
|
await pane.press({ key: 'opt-scope-balanced' })
|
|
expect(keys(await pane.drawn())).toContain('opt-fix-performance-unprofiled-perf-optimize')
|
|
await pane.unmount()
|
|
})
|
|
|
|
test('a fix asks first, and its confirm sits right under the finding that raised it; nothing runs until yes', { timeoutMs: 30_000, options: { boot: false } }, async ($, on) => {
|
|
const { world, pane } = await opened($, on)
|
|
|
|
await pane.press({ key: 'opt-scope-balanced' })
|
|
await pane.press({ key: 'opt-fix-performance-unprofiled-perf-optimize' })
|
|
|
|
const asked = await pane.drawn()
|
|
const order = keys(asked)
|
|
|
|
expect(textOf(asked)).toContain('CONFIRM NEEDED')
|
|
expect(order.indexOf('confirm')).toBe(order.indexOf('opt-ask-performance-unprofiled') + 1)
|
|
expect(world.runs.filter(argv => argv.includes('optimize') || argv.includes('performance_optimize'))).toEqual([])
|
|
await pane.unmount()
|
|
})
|
|
})
|