refactor: remove self-learning and the optimizer package (P1.4)
Self-learning is excluded from the community edition (ADR-0004); the project owner reworks it separately. Cost tracking stays. - agent: delete behaviour evolution (evolve-schema, iterative GEPA, compose-evolution, evolution gates, orchestrator and deploy), improvement and correction detection, AgentLearning, the eval-dataset builder, optimization-capture and the agent_insights tool. Secret detection moves from eval-dataset to secret-patterns. The LLM wiring keeps only the Haiku adapter and judge call used by skill audit and hygiene, so @ax-llm/ax is now declared by agent instead of server. - server: delete /api/evolution/*, the evolution and optimizer services, GEPA expansion of the first chat message, the prompt_optimization and monthly_assessment jobs, the idle-session reviewer and its session-reviewer persona, prompt injection of past corrections and thumbs-down recorded as correction signals. Existing job rows of the removed types are ignored, not deleted. - core: delete OptimizationLogStore; stop re-exporting the improvement signal and evolution run stores. - web: delete the Evolution screen and the two job types in the automation editor. - delete packages/optimizer. Also logs UF-027 (self-learning loops read data nothing collects) and UF-028 (the Settings prompt-shape choice is ignored by chat).
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*
|
||||
* Tests the two feedback endpoints:
|
||||
* POST /api/feedback — record user feedback
|
||||
* GET /api/feedback/stats — get improvement stats
|
||||
* GET /api/feedback/stats — get feedback stats
|
||||
*/
|
||||
|
||||
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
|
||||
@@ -11,35 +11,27 @@ import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import Fastify from 'fastify';
|
||||
import { MindDB, ImprovementSignalStore } from '@waggle/core';
|
||||
import { MindDB } from '@waggle/core';
|
||||
import { feedbackRoutes } from '../../src/local/routes/feedback.js';
|
||||
|
||||
/** Minimal multiMind mock that provides a real MindDB for the personal mind. */
|
||||
function createTestServer(db: MindDB) {
|
||||
const server = Fastify({ logger: false });
|
||||
const signalStore = new ImprovementSignalStore(db);
|
||||
server.decorate('multiMind', {
|
||||
personal: db,
|
||||
});
|
||||
server.decorate('agentState', {
|
||||
orchestrator: {
|
||||
getImprovementSignals: () => signalStore,
|
||||
},
|
||||
});
|
||||
server.register(feedbackRoutes);
|
||||
return { server, signalStore };
|
||||
return { server };
|
||||
}
|
||||
|
||||
describe('Feedback Routes', () => {
|
||||
let db: MindDB;
|
||||
let server: ReturnType<typeof Fastify>;
|
||||
let signalStore: ImprovementSignalStore;
|
||||
|
||||
beforeEach(() => {
|
||||
db = new MindDB(':memory:');
|
||||
const result = createTestServer(db);
|
||||
server = result.server;
|
||||
signalStore = result.signalStore;
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -80,26 +72,6 @@ describe('Feedback Routes', () => {
|
||||
expect(res.json()).toEqual({ ok: true });
|
||||
});
|
||||
|
||||
it('records negative feedback as correction signal', async () => {
|
||||
await server.inject({
|
||||
method: 'POST',
|
||||
url: '/api/feedback',
|
||||
payload: {
|
||||
sessionId: 'sess-1',
|
||||
messageIndex: 2,
|
||||
rating: 'down',
|
||||
reason: 'wrong_tool',
|
||||
detail: 'Should have used web_search',
|
||||
},
|
||||
});
|
||||
|
||||
// Check that it was recorded in the improvement signals store
|
||||
const corrections = signalStore.getByCategory('correction');
|
||||
const feedbackSignal = corrections.find(c => c.pattern_key === 'feedback:wrong_tool');
|
||||
expect(feedbackSignal).toBeDefined();
|
||||
expect(feedbackSignal!.count).toBe(1);
|
||||
});
|
||||
|
||||
it('rejects missing sessionId', async () => {
|
||||
const res = await server.inject({
|
||||
method: 'POST',
|
||||
@@ -170,7 +142,6 @@ describe('Feedback Routes', () => {
|
||||
expect(body.totalFeedback).toBe(0);
|
||||
expect(body.positiveRate).toBe(0);
|
||||
expect(body.topIssues).toEqual([]);
|
||||
expect(typeof body.correctionsThisWeek).toBe('number');
|
||||
expect(typeof body.improvementTrend).toBe('string');
|
||||
});
|
||||
|
||||
@@ -202,7 +173,6 @@ describe('Feedback Routes', () => {
|
||||
expect(body.totalFeedback).toBe(3);
|
||||
expect(body.positiveRate).toBeCloseTo(0.67, 1);
|
||||
expect(body.topIssues).toContain('too_verbose');
|
||||
expect(typeof body.correctionsThisWeek).toBe('number');
|
||||
expect(typeof body.improvementTrend).toBe('string');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user